Apr 24

Hiatus

Yes, it is.

After last post I ended up getting so frustrated with memory leaks from the 3D engine I was using (the asset-loader side of it) that I gave up on it. I decided it was painful enough that moving to a different engine would be less painful.

So I started to make the move over to Unity3D

In learning the new engine and language added to all the other issues in my life at that time I basically lost all my enthusiasm on the project and stopped.

I still keep my ideas and notes and still add to them, the project isn’t totally abandoned just on hold. Right now I have my job(s) and a whole heap of real world projects that are consuming all my spare time.

So for now I’ll keep the game project on my, rather large, list of things to do and note progress on if and when I get to it.

I’ll try to get around to listing and making progress reports on all these Other projects on my main blog – radans.net.

Until then, thanks for reading.

— Radan.

Apr 25

Not Dead…

Evenings,

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

Cheers,

-Radan.

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.

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:

MapGenerator

 

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)

Cheers

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!

Cheers.

Apr 16

Quick update

Sorry for the delay, been off this project for a bit as I’ve started work on a hardware project with a friend, one that may possibly lead to a new career for me so it’s important! Also I have build a CNC machine… 😀

Still working on this as time allows so updates will continue sporadically.
Right now the terraintiler-library plugin is finally available from the jME SDK Plugin list so I’ve removed it from the the google code repo. Anyone using this code can now add the plugin and then add the library to their project and it will work.
The google code repo at https://code.google.com/p/my-terraintiler-test/ now just has the demo-test code for the library. I’ll be slowly building the TiledTerrain editor up within this code until it is mature enough to be standalone. I’m still undecided as to how the editor will work: either as a jME SDK Integrated plugin or as a standalone application… integrated would be nice but I’ll have to see if it is even possible….

Until next update.
Enjoy!

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);
                            tree.setName(id);
                            treeList.put(id, tree.clone());
                            rootNode.attachChild(treeList.get(id));
                        }
                    }
                }

                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())) {
                            rootNode.detachChild(treeList.get(id));
                            treeList.remove(id);
                        }
                    }
                }
            });
            terrainTiler.setEnabled(true);
            rootNode.attachChild(terrainTiler);

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.

Thanks.

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… 😉

Enjoy!

 

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 🙂

Thanks!

 

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.

Enjoy!

Early Terrain Generator

Early Terrain Generator