Basic block terrain

Hey guys,

I’d like to write a little block engine (like in minecraft) not because I wanna copy the game but to understand how it works and learn how it’s done. I assume that shouldn’t be a big issue using low poly models (same size, different textures) and place them pseudo-randomly into the scene.

But I don’t know how to improve my project any further. I do know that I may need some terrainQuads and I suggest LOD is certain by this amount of models. However the most important for me would be the get the Idea of how to deal with the random gerneration of the (infinite) map using models instead of textures only.

Ok first of all the staff that I made therefor:

  • Block class (abstract, used to load model, set textures, set position, actions later on …)
  • BlockGrass, BlockEarth, BlockWoodblock … (each extends Block, handle textures usage, convert to Spatial)
  • MapReader (creates terrain based on a heightmap)
  • A scene with my skybox
  • Main (put all things together)

    I read about seeds and their attributes but can’t imagine how this works on a heightmap.

    So I tried to reach my aim by performing the next few steps:

  • For the terrain I took the heightmap image width and set a custom value for the height.
  • I looped all three axis and saved my coordinates to a Vector3f array. The y coordinate I got from the function getTrueHeightAtPoint() and let it snap to grid:

    [java] int realY = (int) heightmap.getTrueHeightAtPoint(x + MAP_WIDTH / 2, z + MAP_WIDTH / 2);

    int y = 0;

    if (realY % Block.BLOCK_SIZE != 0) {

    y = ((int) Math.round(realY % Block.BLOCK_SIZE)) * Block.BLOCK_SIZE; // SNAP TO GRID


  • Added directionalLight to be able to see the models
  • Looped array with Vector3f from MapReader
  • Let yMin be 0 and yMax the y position of the current Vector3f (from MapReader)
  • Loop y axis

    Finished …

    Can somebody help me get the right idea of what I have to learn, read trough or deal with in the editor?

    PS: It is not the idea, that you have to present me the source code right away I mainly need some Ideas. :slight_smile:

    Thanks for any hint! I’d appreciate it.

What you need to search for is “Voxel” on the forums. There are several voxel games underway and lots of support for them on these forums. Here is one link:

Basically you will not be using TerraMonkey. Voxel worlds have the whole area made up of blocks, and those blocks are not individual cubes. They are joined together as a single object (say every 32x32x32 spaces). Lots of individual objects results in slow performance, so they get grouped together.

You could use a heightmap to help initially generate your terrain, the heightmap classes can help you translate an image into height values on a grid. But for the actual block stuff, you have to write that yourself or use

you were not the first who asked how to make a minecraft-alike engine. Just search the forums. here are some hints: those “blocks” are called voxels, you might find more information when you search for “voxel engine”. but “minecraft” should also give you plenty results here…

This should be fine.

Sorry for asking, the problem was that I didn’t know the right keyword to search for and I didn’t know what was possible as I am a still a beginner of jm and 3d in general.

Many thanks.

Cool … thanks for the jme3-voxel link … new inspiration :smiley:

Hi crazymonkey … have a look at our “minecraft clone”

Currently I try to cleanup the engine code. You can find the new project here: GitHub - ahoehma/bloxel-engine