Temple of The Roguelike Forums
Development => Programming => Topic started by: Endorya on July 17, 2013, 01:51:00 PM
-
Bellow are some screenies of the algorithm I started to developed yesterday. The algorithm seems quite flexible and capable of producing narrow and claustrophobic cave systems as well as huge open space cavern systems. I just thought of sharing these alpha pictures with you because you tend to add those extra ingredients I might not be aware of.
Note: The color seen in the caves tells the floor depth, being darker areas deeper floors. I've already changed the floor so they don't go generally too deep (at least visually). I hope to upload some more screenies as I finish to implement the water in the algorithm.
Each cave seen is an independent render; each image shows multiple examples.
[Alpha version]
http://i.imgur.com/TNHqnKC.png (http://i.imgur.com/TNHqnKC.png)
http://i.imgur.com/ZXebdii.png (http://i.imgur.com/ZXebdii.png)
[Beta version]
A new screenie. This one has water samples
http://i.imgur.com/dUD130u.png (http://i.imgur.com/dUD130u.png)
These pictures are not what the player will see. These are just for you to have an idea of what the algorithm is capable of producing.
-
Updated the main thread.
-
Hmm. These "caves" are more like valleys or canyons, then? Since (if I'm reading it right), there's no way to have an empty tile beneath a solid tile...
Also, is it intentional that each screenshot shows several disconnected "cave" systems?
-
Hmm. These "caves" are more like valleys or canyons, then? Since (if I'm reading it right), there's no way to have an empty tile beneath a solid tile...
??? The floor color oscillation tells only the floor depth of each tile, darker means deeper. They are all empty tiles.
Also, is it intentional that each screenshot shows several disconnected "cave" systems?
Each disconnected cave is an unique example produced with the algorithm, there is no connection whatsoever with the adjacent cave.
This is the a small cave without color code:
(http://i.imgur.com/ymVSNjJ.png)
-
These look great. The scale seems about right for exploration, too.
-
These look great. The scale seems about right for exploration, too.
Thanks! The scale can be adjusted to whatever size desired. Most of the caves seen in the screenshots have about 10 seeds, each one lasting 600 turns.
-
Cool, what way do you seed the algo? Seems like there is some bias there to ensure the elongated shape.
-
Cool, what way do you seed the algo? Seems like there is some bias there to ensure the elongated shape.
In C# I simply do this:
Random rnd = new Random(); //this automatically builds a random object with a random seed
Random rnd = new Random(1230044) //Initializes the random object with a specific seed
You can control the elongated effect just through a random number. I do this:
int iDirection = rnd.Next(0, 5); //Returns an random number from 0 to 4
if (iDirection == 0) //Moves south
if (iDirection == 1) //Moves East
if (iDirection == 2) //Moves West
if (iDirection >= 3) //Moves North
The above code tells that moving north has twice the chances of coming up because it triggers with a 3 or 4. You can further increase the elongating effected simply by increasing the X: rnd.Next(0, X) to a higher number.
Sorry if get too detailed or if I end up describing the obvious. I simply like to explain things pretty clearly, even though I tend to describe my game pretty badly. :D
-
The above code tells the moving north has twice the chances of coming up because it triggers with a 3 or 4. You can further increase the elongating effected simply by increasing the X: rnd.Next(0, X) to a higher number.
I like the longer caves - much cooler than the big blobby things most caves end up being. Weighted randomness is always cool too.
Since we're talking about implementation details; another way to get longer paths is to use forward, left & forward, and right & forward instead of north, south, east, west. If forward is more common then turn & forward then you'll tend to get longer paths that meander a bit. Or you can have a certain % chance that it just repeats the same direction instead of choosing a new one.
-
The above code tells the moving north has twice the chances of coming up because it triggers with a 3 or 4. You can further increase the elongating effected simply by increasing the X: rnd.Next(0, X) to a higher number.
I like the longer caves - much cooler than the big blobby things most caves end up being. Weighted randomness is always cool too.
Since we're talking about implementation details; another way to get longer paths is to use forward, left & forward, and right & forward instead of north, south, east, west. If forward is more common then turn & forward then you'll tend to get longer paths that meander a bit. Or you can have a certain % chance that it just repeats the same direction instead of choosing a new one.
I used that method first but the results were not satisfactory, it would look a bit artificial and threads would not pass over tiles they had been before to create depressions on the ground.
I concluded that a 100%(4 random direction) random seed would give more realistic results and that could pass over the same places more efficiently.
-
Is your game logically 3D Or 2.5D?
Looks awesome.
-
Hmm. These "caves" are more like valleys or canyons, then? Since (if I'm reading it right), there's no way to have an empty tile beneath a solid tile...
??? The floor color oscillation tells only the floor depth of each tile, darker means deeper. They are all empty tiles.
What I mean is, a cave has passages that are located under the ground. What your algorithm appears to generate is just a heightmap - it has no way of generating passages located beneath solid ground.
-
Is your game logically 3D Or 2.5D?
Looks awesome.
Thanks. I'm still deciding but I probably go with 2.5D game logic. There is already too much complexity in the whole project and some parts of it should stay "less" complicated.
-
What I mean is, a cave has passages that are located under the ground. What your algorithm appears to generate is just a heightmap - it has no way of generating passages located beneath solid ground.
Some caves will have many levels in depth which will be accessible through a specific tile. It is the same concept as exploring a dungeon in most roguelike games, where a stairway leads to another dungeon level, either up or down. Usually, these entrances will be located on deeper parts of the cave system and some cave levels will actually have several "tunnel entrances" leading to other cave levels.
-
Is your game logically 3D Or 2.5D?
Looks awesome.
Thanks. I'm still deciding but I probably go with 2.5D game logic. There is already too much complexity in the whole project and some parts of it should stay "less" complicated.
Nice example of a 2.5D party roguelike. http://www.mysteriouscastle.com/
-
Is your game logically 3D Or 2.5D?
Looks awesome.
Thanks. I'm still deciding but I probably go with 2.5D game logic. There is already too much complexity in the whole project and some parts of it should stay "less" complicated.
Nice example of a 2.5D party roguelike. http://www.mysteriouscastle.com/
It seems rather interesting! I will look into it. Thanks very much for sharing it!
-
Neato! I really like the look of the cavern! The islands are similar to other implementation I've seen of terrain :)
-
Neato! I really like the look of the cavern! The islands are similar to other implementation I've seen of terrain :)
Thanks camarade! But what islands are you referring to?
-
Sorry, I've been in a naval mood lately, and was interpreting caves as islands ;)