Aug 02

Tiled Terrain Editor update

Greetings,

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:

https://code.google.com/p/radanz-game-code/source/browse/#svn/TiledTerrainEditor

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.

Cheers.