Apr 25

Not Dead…


This project is not dead but had been pushed to the side for quite a while while I sorted life out. Now I’m only working 2 days a week I have been able to stabilise most of my issues and am feeling ready to get back onto this project. (in between the other projects I have running…)

I’ve been tidying up some of the map maker code and removing external dependencies, mainly to get my brain back to what I was coding back when. Definitely had some “What was I doing here?” moments looking through what I had done as I was cleaning but got back into it ok.

For fun and inspiration I decided to try and 3D-Print the game map concept I had generated a while back:

TheGame 3D-Printed Map

3D-Print of the current concept game map



Aug 02

Tiled Terrain Editor update


Apologies for taking so long at this, available time has not been good and I’ve been doing a lot of experimenting and learning as I go. So far I have Image tile generation running and the menu system for the rest of it going.

I’ve uploaded the current code state to a new svn repository here:


You’ll need the library pngj added to the jMonkeyEngine SDK to compile it or download the compiled dist.zip file here

So far the menu works but the only real function working is: “Generate New Terrain” > “From HeightMap Image” > load any 16-bit Gray-scale PNG image > “Generate” > “Create Image Tiles”.

Only 16-bit Gray-scale png images are supported at the moment, any size, I have two test maps, one small at 1024*1024 and one very large at 8192*8192. The image is loaded one strip of tiles at a time so very large maps can be processed with exceeding memory requirements.

You can choose how many tiles to generate in both directions and the base image map will be scaled and interpolated as required, both bigger and smaller. Number of tiles is 8 minimum to 4096 maximum in each direction. Tile size selectable from 256 to 2048. PNG images will then be created and saved into the selected location under a new directory of the entered name (optional) with the file name: tilexxxxyyyy.png

Not much use for my terraintiler library at this stage but those who use jMe’s TerrainGrid will be able to use the generated tiles right away. Code to load the tiles like this:

        assetManager.registerLocator("path/to/tiles", FileLocator.class);
        this.terrain = new TerrainGrid("terrain", 65, 513, 
                           new ImageTileLoader(assetManager, new Namer() {

            public String getName(int x, int y) {
                String fileName = String.format("tile%04d%04d.png", x, y);
                return fileName;

Next I’ll be working on the ‘j3o’ tile generation for my terraintiler library using textures that can be loaded on the generation screen. More on that later.

Any comments of the code so far would be very appreciated.


Jul 14

MapGenerator Menu

Quick update,

Have managed to load a large height-map image and generate a “mini-map” of it and setup the map generation menu:



As the screenshot shows, the original file is 8192×8192 pixels, in 16-bit gray-scale.

Also populated drop-down boxes to select the “world” size in tiles across and the size of each tile, also there is a list to set the maximum height of the generated world. All in “world units”

Next is to link the drop down boxes to change the “pixels to unit” scale value and also to lock the sliders on the left to keep each one less than the one below it (they are there to set the height percentage for painting the one to four textures based on the terrains height during tile generation)


Jul 11

TiledTerrain Editor

Hi all.

Some visible progress on the terrain editor program, after bitching with Nifty-Gui I think I’m getting the hang of it. just piecing the menus together and adding code functions to them, once they’re all done the real work can begin.

Here’s some screenshots so far:

File Loading screen for loading tilesets or images/textures:

java 2013-07-11 20-57-06-23


The tile-set generator screen (left image pairs for initial height-based textures are diffuse&normal pairs, large right-hand image will show a scaled version of the users heightmap image):
java 2013-07-11 20-57-22-60Until next update!


Mar 16

Further Testing of the TerrainTiler

Another Video. Same camera path as previous posted video but this time a small addition to the code was added to test the Action Hooks for Tile Attached and Tile Detached.

            terrainTiler = new TerrainTiler(cam, 32, uJars, 1, tileDir, this);
            terrainTiler.setGridSize(5);  // grid can be 3,5,7 or 9. Defaults to 3
            terrainTiler.addActionHandler(new TerrainTilerAction() {

                public synchronized void tileAttached(Vector3f center, TerrainQuad tile) {
                    System.out.println("Adding trees to tile: "+tile.getName());
                    float tx = tile.getLocalTranslation().x;
                    float tz = tile.getLocalTranslation().z;
                    int tsize = terrainTiler.getTileSize()*terrainTiler.getTileScale();
                    int num = new Random().nextInt(20)+20;
                    for (int i=0; i<num; i++) {
                        float x = tx - tsize/2 + new Random().nextFloat()*tsize;
                        float z = tz - tsize/2 + new Random().nextFloat()*tsize;
                        float h = terrainTiler.getHeight(new Vector2f(x,z));
                        if (h > 100f & h < 300f) {
                            String id = tile.getName()+i;
                            tree.setLocalTranslation(x, h, z);
                            treeList.put(id, tree.clone());

                public synchronized void tileDetached(Vector3f center, TerrainQuad tile) {
                    System.out.println("Removing Trees from tile: "+tile.getName());
                    Iterator it = treeList.keySet().iterator();
                    while (it.hasNext()) {
                        String id = (String) it.next();
                        if (id.startsWith(tile.getName())) {

Pretty quick and dirty but does the test, “tree” is a Spatial that is a pre-loaded model. The tree model is a very ugly tree imported from a Blender file I found from a quick “free model” search. “treeList” is a ConcurrentHashMap for storing the trees created so it can remove them later. The code throws a random number of trees into the list, provided its location is within a set altitude range. When the tile is detached it finds the trees with the tile ID and removes them.

Next is to test the terrain editing/modifying functions.


Mar 13

TerrainTiler class finalised

Hi again,

My TerrainTiler class is now finalized as far as functions go, I’m now ready to make it a plugin for jME’s SDK for consideration in to the community collection.

Here’s another video showing a nice 4 min fly-over using the latest code. Still a bit plain – needs better textures and objects like trees etc would make it a nice demo.. sooon… 😉



Mar 03

A Video!

Made a quick video to show that this is progressing, almost at clean and optimize stage!

Once the class is stable I’ll be moving on to a World Editor for it. Should be fun 🙂



Feb 19

Terrain Generation

Has started,

Had a major headache in the tiler routine that was causing a big memory leak, still needs to be properly sorted but it’s not leaking at the moment. Still not sure if it was my code or the engine library I’m using. Sort it eventually.

Terrain generation has started coming together, still needs more work but here’s an early screenshot for progress. Needs seam welding between the tiles and better smoothing routines but its a start. Gives me something to work on.


Early Terrain Generator

Early Terrain Generator

Feb 12

TerrainTiler library progress!

Hello again.

The TerrainTiler class library is now progressing very well. Not loading actual tiles yet just random color HillHeightMaps but it’s working and quite flexible: so far I’ve tested a 3×3 grid and a 5×5 grid (shown below)  code also allows 7×7 and 9×9, i’ll test these later, getting late here.

Tomorrow I’ll tackle loading actual terrains with textures and finish off a few functions.

Code is up on GoogleCode so others can look at or test it, currently it’s a project for jMonkeyEngine SDK so you can load the whole project into the SDK and just run it.

Thanks for reading!

TerrainTiler-1 TerrainTiler-2

Jan 31

Delayed but not forgotten

I haven’t forgotten this project, never will. Unfortunately other issues and jobs in my life have caused delays.

Still working on breaking TerrainTiler out into its own class, being an old-school structured programmer for so long its taking me a lot of effort to unlearn old styles and learn the newer OOP stuff. I think I have the concept of classes and objects coming together in my head but making a new class of this scale is proving a challenge. Especially with all the other distractions in my world.

One thing I have been active with is idea and concepts on many aspects of the game itself, the world, the characters and the game play. All just ideas and subject to changes so for now they stay in my head but they will come out here eventually and I get more confident on them.

Currently thinking of going full first person gameplay, I know this is not the normal for an MMORPG but maybe I have a few ideas to make it work and be different from the many other games out there. Maybe, time will tell.

Stay tuned, I am on holidays for a bit as of today and this project will be getting some love.

As always, enjoy.