I am looking for procedural terrain generation resources
by Kyrah Abattoir · in Torque 3D Professional · 07/22/2012 (12:45 pm) · 51 replies
I thought it could be interesting to create and destroy on the fly terrain blocks using a deterministic terrain generator.
The idea behind this would be to make a working multiplayer "infinite" world where the clients do not have to hold the complete terrain/object placement data and can generate it on the fly on their own.
Could anyone point me in the right direction?
The idea behind this would be to make a working multiplayer "infinite" world where the clients do not have to hold the complete terrain/object placement data and can generate it on the fly on their own.
Could anyone point me in the right direction?
About the author
3D artist, programmer, game designer, jack of all trades, master of none.
#42
08/20/2012 (10:18 pm)
That is the voxel terrain stuff. I may in the future use that code to create another object. Then the voxel object could be used for whatever, even terrain. It is just a picture of what someone has done with the voxel stuff.
#43

The TS looks like this:
I am looking into using threads to put the heavy processing in worker threads to keep the main thread from pausing.
08/22/2012 (10:18 pm)
Okay, I have some functionality now working:
The TS looks like this:
function GenTerrainGui::testOp(%this){
%filename = "testOp.ter";
if(getFileCount("art/terrains/" @ %filename)){
fileDelete("art/terrains/" @ %filename);
}
%tobj = createTerrain(%filename,512,"core/art/grids/512_red.png",true);
%tobj.applyDeformLayer("hmap","art/terrains/bitmaps/flat.png",0,512);
%tobj.applyDeformLayer("hmap;add","art/terrains/bitmaps/add.png",0,32);
%tobj.applyDeformLayer("hmap;sub","art/terrains/bitmaps/subtract.png",0,64);
%tobj.applyDeformLayer("hmap;mul","art/terrains/bitmaps/multiply.png",1,2);
%tobj.delete();
}I am looking into using threads to put the heavy processing in worker threads to keep the main thread from pausing.
#44
Is this starting to look more usable?
I intend on more functions in addition to "hmap":
Please suggest types of operations you might want for building a scene. My goal is a tool to be able to build scenes that would be playable without any editing AND to provide a tool for building a starting point from which to build a scene.
08/22/2012 (11:55 pm)
@Kyrah,Is this starting to look more usable?
I intend on more functions in addition to "hmap":
- hmap[add,sub,mul]
- noise[fBm,sinus,fractals,etc]
- gen[mountains,rivers,roads,etc]
- wear[wind,water,etc]
- place[objects,vegetation,fog,etc]
- texture[?]
Please suggest types of operations you might want for building a scene. My goal is a tool to be able to build scenes that would be playable without any editing AND to provide a tool for building a starting point from which to build a scene.
#45
From a random generation standpoint, any algorythm expert who could enlighten me in how this game might decide to place roads?
http://www.blendogames.com/atomzombiesmasher/
08/25/2012 (2:16 am)
Does any of you played atom zombie smasher?From a random generation standpoint, any algorythm expert who could enlighten me in how this game might decide to place roads?
http://www.blendogames.com/atomzombiesmasher/
#46
You just need modular art to support this. Textures, height maps or models. I would draw a random grid of lines using a some sort of branching algorithm. Probably a maze solving algorithm modified to create the grid. Then once the grid was created it is a matter of defining what kind of art goes where. Straight road, intersections (4 way, 3 way), textures, etc.
08/25/2012 (7:41 am)
Roads on a grid would be easy. Just putting textures or prebuilt models down. You could even draw roads right onto the terrain and apply textures. Like the ADD function would work. Is that something you are looking for?You just need modular art to support this. Textures, height maps or models. I would draw a random grid of lines using a some sort of branching algorithm. Probably a maze solving algorithm modified to create the grid. Then once the grid was created it is a matter of defining what kind of art goes where. Straight road, intersections (4 way, 3 way), textures, etc.
#47
-pick a direction NS or EW
-draw 1 to 3 roads with at least 1 block between two roads and not closer than 1 block from the edge of the city block.
-count the created slices.
-Pick the other road direction, and place 3 to 6 road segments, pick one of the slice and go from edge to edge of the slice.
Then you add building/parks, with detailed enterable assets where a building can have it's door against the road, for the rare blocks where it's not possible, use low detail filler buildings.
I really like the aspect of the city blocks that atom zombie smasher creates, but the creator doesn't give enough information on how his road network is built.
Second problem is that i cannot adapt this design for "infinite generation"
To take another example, minecraft has proper edge generation, in the sense that no matter where your world generator start, the edges of one sector will always match the edges of all the neightboring sectors.
An easy way would simply to have freeway bordering all the sectors and not really worry about edge connection much more than that, but i get the feeling it would feel way too regular and unnatural...
Anyone has a paper on continuous generation? All the algorythms i've seen are usually designed for filling a specific data set, like for creating roguelike dungeons, while what i'm really after is something where you can move in any points of your game world and have this place generated in a 100% predictable manner, seamless with the adjacent sectors.
08/25/2012 (4:57 pm)
Initially i was thinking about an algorythm that would more or less do this:-pick a direction NS or EW
-draw 1 to 3 roads with at least 1 block between two roads and not closer than 1 block from the edge of the city block.
-count the created slices.
-Pick the other road direction, and place 3 to 6 road segments, pick one of the slice and go from edge to edge of the slice.
Then you add building/parks, with detailed enterable assets where a building can have it's door against the road, for the rare blocks where it's not possible, use low detail filler buildings.
I really like the aspect of the city blocks that atom zombie smasher creates, but the creator doesn't give enough information on how his road network is built.
Second problem is that i cannot adapt this design for "infinite generation"
To take another example, minecraft has proper edge generation, in the sense that no matter where your world generator start, the edges of one sector will always match the edges of all the neightboring sectors.
An easy way would simply to have freeway bordering all the sectors and not really worry about edge connection much more than that, but i get the feeling it would feel way too regular and unnatural...
Anyone has a paper on continuous generation? All the algorythms i've seen are usually designed for filling a specific data set, like for creating roguelike dungeons, while what i'm really after is something where you can move in any points of your game world and have this place generated in a 100% predictable manner, seamless with the adjacent sectors.
#48
08/25/2012 (8:43 pm)
@Frank - That voxel stuff is very nice. I don't make decisions on what goes in and what doesn't, but I'll try to bring it up....
#49
Okay that helps. So you want to be able to create terrains that match up with the next piece and give some nice city scapes. That I think could be done with the way I am tackling the terrain work. So you go to the next terrain piece (in next mission or possibly adjacent terrain blocks in the same mission and everything lines up more or less.
I think the algorithm to create roads would be a recursive branching algorithm. Maybe something similar to a BSP tree, but probably not that complex. This is kind of out of the scope of what I am working on, however, I will dig up some algorithms and implement them in Torque Script as this would be a good generic road builder for city scapes. I will think about this as I get the terrain gen code working. It will make a nice way to demonstrate how it all works for different terrain situations.
08/26/2012 (7:16 am)
@Kyrah,Okay that helps. So you want to be able to create terrains that match up with the next piece and give some nice city scapes. That I think could be done with the way I am tackling the terrain work. So you go to the next terrain piece (in next mission or possibly adjacent terrain blocks in the same mission and everything lines up more or less.
I think the algorithm to create roads would be a recursive branching algorithm. Maybe something similar to a BSP tree, but probably not that complex. This is kind of out of the scope of what I am working on, however, I will dig up some algorithms and implement them in Torque Script as this would be a good generic road builder for city scapes. I will think about this as I get the terrain gen code working. It will make a nice way to demonstrate how it all works for different terrain situations.
#50
It is a PDF. I found this searching google for: "city road algorithm"
3rd link down.
08/26/2012 (12:40 pm)
Haha! Check this out: www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&...It is a PDF. I found this searching google for: "city road algorithm"
3rd link down.
#51
I might be late to the party, but we're just wrapping up a complete rewrite of our terrain generator for Xenocell. We used to have Torque generate the terrain and all objects on it via some of the built-in methods and a few made by me, but as it turns out, the ultimate tool to generate heightmap data is a combination of scripted Photoshop and PHP GD2. :)
We're getting some really cool results, generated very quickly (compared to the previous method). The image at the link shows the heightmap and the game minimap over the compiled height, terrain material and forest maps.

Edit: embedded image in place of the FB link.
08/28/2012 (12:33 am)
What a cool thread!I might be late to the party, but we're just wrapping up a complete rewrite of our terrain generator for Xenocell. We used to have Torque generate the terrain and all objects on it via some of the built-in methods and a few made by me, but as it turns out, the ultimate tool to generate heightmap data is a combination of scripted Photoshop and PHP GD2. :)
We're getting some really cool results, generated very quickly (compared to the previous method). The image at the link shows the heightmap and the game minimap over the compiled height, terrain material and forest maps.

Edit: embedded image in place of the FB link.
Ahsan Muzaheed
Default Studio Name
in the picture that cave type thing,is that a separate model or part of terrain?
if terrain part then it would be a perfect solution of cave type things in t3d.
if u see in desert demo,there are so many separate things only for not having any alternative solution to produce them from terrain.