Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [Help] Unlimited terrain  (Read 4814 times)
0 Members and 1 Guest are viewing this topic.
Offline deadteck

Senior Newbie





« Posted 2012-04-26 15:24:35 »

Hey, im making a 3d game and right now I can only have up to 1000 block grid size without lwjgl freaking out. I would like to know if anyone knows how to have an unlimited terrain sort of like minecraft Huh
PS. Im using LWJGL

The best ideas will come from the weirdest and sometimes most f***'d up places, you just have to realize them.
Offline DavidW

Junior Devvie


Medals: 3
Exp: 7 years



« Reply #1 - Posted 2012-04-26 15:44:33 »

I am also wondering about this.

Here is my guess about what you need to do.  I'm sure someone else who knows more about this will be able to tell you more useful information.  I assume that you have to do some sort of memory management by removing things from memory when they are far away.  I believe Minecraft does this by storing "chunks" of some size and only bothering to draw the chunks that are close enough to the player.  Everything else gets deleted from the GPU's memory, so you have to constantly be loading/deleting chunks as the player moves around.  Again, this is only my guess about this, maybe the GPU is smarter than I think it is?

Hello!
Offline sproingie

JGO Kernel


Medals: 202



« Reply #2 - Posted 2012-04-26 16:38:56 »

That's exactly what Minecraft does, yes.  Chunks are 16x16 square and 256 deep, and only the surrounding chunks are streamed into memory from disk (or generated if they weren't already there).  It does some pretty basic visibility culling (not drawing blocks you can't see), then draws it into a display list (something any modern game probably shouldn't use, preferring VBOs instead).
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline deadteck

Senior Newbie





« Reply #3 - Posted 2012-04-27 18:12:12 »

So then how would you set something up like that? Is there a certain way, and for the saving terrain what would you do?

The best ideas will come from the weirdest and sometimes most f***'d up places, you just have to realize them.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #4 - Posted 2012-04-27 18:26:29 »

You can always look at the minecraft wiki if you want to clone what minecraft does: http://www.minecraftwiki.net/wiki/Chunk_format

It's not all that sophisticated, it's a file per chunk, encoding the X and Y in the filename.  Can't recall if it does any directory hashing or if it just bogs the filesystem with tens of thousands of files in one dir -- I don't really play minecraft anymore.  You could use something like Berkeley DB or HSQLDB instead of the filesystem if indexing large numbers of chunks are a concern.

Really though, you need to start simple.  Get your game working on a smaller map with all your chunks in memory first, then worry about streaming them in from persistent storage.  You move mountains one teaspoonfull at a time.

Offline deadteck

Senior Newbie





« Reply #5 - Posted 2012-04-28 15:46:30 »

You can always look at the minecraft wiki if you want to clone what minecraft does: http://www.minecraftwiki.net/wiki/Chunk_format
Thanks, but isnt it copyrighted so I cant use it in my game, or could I use some of the code but change the most of it?

The best ideas will come from the weirdest and sometimes most f***'d up places, you just have to realize them.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #6 - Posted 2012-04-28 16:34:03 »

No one's saying use the Minecraft code directly, it's only useful for Minecraft anyway.  The wiki just contains a high level description of the format you can use for ideas.  Even so it's not really a good idea to try to copy the format without trying to design something of your own first, since you don't want someone else's design dictating yours.
Offline deadteck

Senior Newbie





« Reply #7 - Posted 2012-04-28 18:19:30 »

That is very true, and so to basically make an unlimited world you would have to continue on rendering blocks whenever needed. Well, never thought about it that way ut it does make a lot of sense in a way Smiley

The best ideas will come from the weirdest and sometimes most f***'d up places, you just have to realize them.
Offline matheus23

JGO Kernel


Medals: 113
Projects: 3


You think about my Avatar right now!


« Reply #8 - Posted 2012-05-03 16:41:18 »

Also, one more thing I'd like to add:

Minecraft heavily uses Display lists.
They have chunks, as sproingie said, which they split up into 16x16x16 mini-chunks again. These mini-chunks have their own display list. And before compiling that display list, they look, which sides of what block are visible. Then they create these Display-Lists, and when drawing they only call that display list.

The reason for the chunks being split up into 16x16x16 mini-chunks is, that everytime you break a block, or build a block, minecraft has to recalculate the display-list.

Thats all I know about Minecraft's techneques... I hope it helps Smiley

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline davedes
« Reply #9 - Posted 2012-05-03 17:08:22 »

Probably better to use VBOs than display lists.

In addition to chunking, you should also think about instanced drawing if the user supports it:
http://sol.gfxile.net/instancing.html

Some more reading:
http://gamedev.stackexchange.com/questions/22664/how-can-i-improve-rendering-speeds-of-a-voxel-minecraft-type-game

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Archibald

Junior Devvie


Projects: 1



« Reply #10 - Posted 2012-05-03 19:59:48 »

Related topic: http://www.java-gaming.org/topics/minecraft-voxel-performance/26097/view.html (just one reply, not too much to read Smiley)
Offline Icecore

Senior Devvie


Medals: 5



« Reply #11 - Posted 2012-05-28 17:15:20 »

I have class called Nod, hi have 3 dimension array
Short[][][] (better use 1 dimension ,but 3 dim better for debug)
Every nod have links to near Nods
Like
Nod Left
Nod Right,
Nod Top
You can hold them all not sorted in simple arraylist, same easy you can add new one

For render I use part of Nod (nod Quit big)
And create display list, why display ? test show display faster then VBO
Its quit simple get access to data in near nods, and + you have unlimited Y axis, not ZX  like Minecraft
Cheers Smiley

Sorry don’t update own project, have managed rewrite my engine many time,
don’t have full gave for now(or part that’s can be played),
trying do Ai, also and 2D and 2.5(isometric)
http://imageshack.us/g/213/20120528200723.png/

Also I decide that’s all games I relize will be fully free without payments, or stupid ads.
Maybe later add free donations, but not now Wink
I really want do open source, but cant, its may produce to many not quality clones.

also slowly teaches pixel art use dune 2 like reference^^
Offline ags1

JGO Wizard


Medals: 72
Projects: 3
Exp: 5 years


Make code not war!


« Reply #12 - Posted 2012-05-28 18:47:05 »

I don't feel so dumb now - I was planning on chunking the landscape myself.

But what about VERY far way stuff, like a mountain which might be two chunks away but still would be visible... Is there a way of rendering a horizontal projection of a scene to am image that can then be used as a backdrop? Or is that planned for OpenGL 9?

Offline Icecore

Senior Devvie


Medals: 5



« Reply #13 - Posted 2012-05-28 19:55:09 »

Yep ,you can render all you need in texture(pixels) and then render like Quad or cylinder like background.
opengl render to texture
or GPU PBO
Offline ags1

JGO Wizard


Medals: 72
Projects: 3
Exp: 5 years


Make code not war!


« Reply #14 - Posted 2012-05-28 20:03:19 »

Awesome - I love this stuff! (I program for a bank by day...)

Offline Danny02
« Reply #15 - Posted 2012-05-28 20:13:48 »

there are a lot of different LOD(Level of Detail) approaches out there, Imposters(rendering an image of a far a way object and displaying then only the image) is one of the many.

Just from the top of my head, when you already have a world like Mincraft(lots of blocks) which are in a way Voxels. Why not try some LOD methods which are used for Voxels, one thing Voxels a really great for in comparison to triangle meshes.

Lets say your normal chunk has Data for 100x100x100 single blocks which you render by converting the data to some triangle mesh which treats each block as one cube.
Now you could easily add something to your conversion process to change how detailed this generated triangle mesh should be.
For example instead of creating 100x100x100 cubes why not create only 10x10x10 cubes for chunks which are far away.
Offline ags1

JGO Wizard


Medals: 72
Projects: 3
Exp: 5 years


Make code not war!


« Reply #16 - Posted 2012-05-28 21:07:39 »

Hey, im making a 3d game and right now I can only have up to 1000 block grid size without lwjgl freaking out. I would like to know if anyone knows how to have an unlimited terrain sort of like minecraft Huh
PS. Im using LWJGL

To be fair to lwjgl, a thousand block grid is one billion blocks Smiley

Offline Longarmx
« Reply #17 - Posted 2012-05-29 04:04:54 »

Just render the blocks that are visible. No point in rendering if you can't see it.  Tongue

Offline princec

« JGO Spiffy Duke »


Medals: 422
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #18 - Posted 2012-05-29 09:17:02 »

This sort of question appears to be the new "Where can I find tuts to make an MMORPG". They are beginning to get on my nerves a little.

Cas Smiley

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (33 views)
2014-11-22 12:13:56

xFryIx (73 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (40 views)
2014-11-12 21:09:33

kovacsa (65 views)
2014-11-07 19:57:14

TehJavaDev (70 views)
2014-11-03 22:04:50

BurntPizza (68 views)
2014-11-03 18:54:52

moogie (83 views)
2014-11-03 06:22:04

CopyableCougar4 (82 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!