jME Terra development thread

I think these should be reserved for interpolated height coordinates (when you input a float or a double), cause I think that's how it works for TerrainBlock etc. I'll try to get your changes in soon and do a new release of the source just for this thread.

terrain block is



public void setHeightMapValue(int x, int y, int newVal) {
        heightMap[x + (y * size)] = newVal;
}



terrain page is


 public void setHeightMapValue(int x, int y, int newVal)






Well, that then… :slight_smile:

Please advise where the latest src can be obtained from, I can then add checks that the map is loaded for the point and add javadocs

Well, from the site. In fact since your copy has your changes, that is the latest copy at the moment  :smiley:

? am i looking in the wrong place ??



http://www.tijl.demon.nl/jme/terra/

No. The source there is the latest. I did some changes after that but in my working copy I reverted back to that release.

To support dynamic loading from file, I'm guessing all that needs to be done is add a new DistancePass that loads the terrain data so that when the DistanceLoadingPass tells the TerraManager to create blocks, there is something to create blocks out of.



And another thing, if you wanted to add dynamic loading for environment objects like buildings, trees, bushes, grass, etc all you would need to do is add another distancepass that adds and removes objects from the scene graph right?



Is there a better way? Do my ideas even stand a chance of working?

What do you mean load dynamic from a file? Of course the system can already load from files… you mean dynamically create something, and then make sure it's also stored in a file? That shouldn't be too hard, there's a save method for a map, where you can use your own implementation for storing.



You're on the right track for adding objects too, I wrote a bigger post about that in the source release thread. No time to look it up for me right now though.

when i say dynamically i mean as needed.

just like Terra creates blocks dynamically.



for situations where you can't hold the whole map in memory at one time.

Need to bare in mind that the system may be a client that downloads the data. Need some type of reactor pattern perhaps

In my case, the map will be dynamically loaded and expanded with data retrieved from the game server via XMPP (Jabber). Definitely useful then :slight_smile:

People, loading maps dynamically from a datasource when needed is what the framework is all about. In fact it can't do anything else! Currently there's two sources it can load from, a jME AbstractMap in memory, or a file system source (either by reading the files or by memory mapping them).



I have personally used the file system some pretty damned big maps (over 100.000 by 100.000) based on real life heightmap data. This is all explained in the topic by the way (and there's a demo for loading from files and even saving to them). I also implemented an HTTP data source once (very quick and dirty)

Llama - all due respect, sometimes there is too much data to have available locally, there must be a way to put some kind of Future framework in to say that the data is now available to take. Some of the data may be created on the fly on some laggy server somewhere - last thing you want is a synschronous wait



It needs to be asynschronous - Terra passes the xyKey to the loader to advise it that terra needs the data. When Terra is passed the data and the key from the loader - Terra then decides wether it still needs to render it…

might also be nice to register something with terra so that it can tell the relevant component to decorate the terrain with other objects

Well, all of that is possible already in the framework, there's just specific loaders and passes that would have to be implemented.

im happy to take this on - I can start on it around next friday



Llama, I know you are streched for time, but is it possible you can add some quick documentation and the setHeight changes before next Friday and release version .06. as this will help immensly.



Regarding scene objects that are added, has anyone any thoughts how best to wrap this. guess what will happen is that there are a bunch of geoms, shaders ?? and the like needing to be added. terra could add them so that the state remains intact within update process, but it might be better to add them outside of terra

what are you thinking in terms of files? will the objects be in the same file as the height map or some other file? What format are you thinking of using?

The format is something you can implement yourself… for a reference implementation I'd probably go for a seperate file.

Asynchronous map loading will be started tomorrow.



Reservation i have is scene objects, guess that a method should be invoked from terra to the sceneObjectLoader to indicate that it should add the scene objects to the scene graph. If there are a lot of scene objects, the sceneObjectLoader should be allowed to add objects gradually each frame ( over many update cycles ).



I will look to do a demo with a random hightmap generation and random placings of veg.



Once this is checked in - would appreciate it if someone could look at tidying up the quad/oct tree boundings of the veg's to make faster culling