[Help] Unlimited terrain

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 ???
PS. Im using LWJGL

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?

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).

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

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.

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?

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.

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 :slight_smile:

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 :slight_smile:

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:

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

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 :slight_smile:

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^^

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?

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

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

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.

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

Just render the blocks that are visible. No point in rendering if you can’t see it. :stuck_out_tongue:

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 :slight_smile: