I am making a flight simulator for a class im in. I would like to generate infinite terrain that spawns in chunks as the plane travels through the world. I have generated python code that creates a 2d noise map but I am confused on how to implement my code into the BGE such that it updates the terrain in realtime.
My noise generator spits out a 2d list of noise values that I can create a simple height map for which I can use with a displace modifier on a subdivided plane, but how can I change that texture each time I run the game?
premade planes
is not that hard to do, create your terrain and just split the world into pieces, save it’s coordinates put it in a list and add some kind of lod to them (close, load them in, far away unload/remove them).
generated terrain
this is much harder to do, and the only one i know that eats generated terrain is @BluePrintRandom, so if you’re in luck he will point you in the right direction.
only on start, a random plane/world or only swapping a texture
this is not hard to do, you can use multiple planes where you can add 1 of them into the world, or you can use replaceMesh() option swapping the looks of a plane (basically the same as above). Or you can change the texture itself and load in a new one, i have a resource for it here: Change textures in-game/during runtime from HDD
To keep track on what you load in you can use a property and save that to your hdd, and use it again the next time you start your game. Easiest way for this is to use the globalDict() all data you put in can very easy be saved by python or simply use the logic bricks save and load. Or you can grab a save and load script out of the resource section (on this forum) there are a few around.