Author Topic: Screenies of my cave generating algorythm  (Read 18897 times)

Endorya

  • Rogueliker
  • ***
  • Posts: 513
  • Karma: +0/-0
  • The non-purist roguelike lover
    • View Profile
    • Email
Screenies of my cave generating algorythm
« 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/ZXebdii.png

[Beta version]
A new screenie. This one has water samples
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.
« Last Edit: July 17, 2013, 07:45:52 PM by Endorya »
"You are never alone. Death is always near watching you."

Endorya

  • Rogueliker
  • ***
  • Posts: 513
  • Karma: +0/-0
  • The non-purist roguelike lover
    • View Profile
    • Email
Re: Screenies of my cave generating algorythm
« Reply #1 on: July 17, 2013, 02:01:53 PM »
Updated the main thread.
« Last Edit: July 17, 2013, 07:08:13 PM by Endorya »
"You are never alone. Death is always near watching you."

ekolis

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 186
  • Karma: +0/-0
  • get ye dennis
    • View Profile
    • Ed's home page
    • Email
Re: Screenies of my cave generating algorythm
« Reply #2 on: July 17, 2013, 07:09:32 PM »
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?
The Ed draws near! What dost thou deaux?

>EAT SANDVICH

Endorya

  • Rogueliker
  • ***
  • Posts: 513
  • Karma: +0/-0
  • The non-purist roguelike lover
    • View Profile
    • Email
Re: Screenies of my cave generating algorythm
« Reply #3 on: July 17, 2013, 07:20:38 PM »
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:
« Last Edit: July 17, 2013, 07:35:20 PM by Endorya »
"You are never alone. Death is always near watching you."

dscreamer

  • Rogueliker
  • ***
  • Posts: 65
  • Karma: +0/-0
    • View Profile
Re: Screenies of my cave generating algorythm
« Reply #4 on: July 17, 2013, 08:36:29 PM »
These look great. The scale seems about right for exploration, too.

Endorya

  • Rogueliker
  • ***
  • Posts: 513
  • Karma: +0/-0
  • The non-purist roguelike lover
    • View Profile
    • Email
Re: Screenies of my cave generating algorythm
« Reply #5 on: July 17, 2013, 08:48:43 PM »
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.
« Last Edit: July 17, 2013, 08:50:24 PM by Endorya »
"You are never alone. Death is always near watching you."

eclectocrat

  • Rogueliker
  • ***
  • Posts: 81
  • Karma: +0/-0
  • Most of your personality is unconscious.
    • View Profile
    • Mysterious Castle
    • Email
Re: Screenies of my cave generating algorythm
« Reply #6 on: July 17, 2013, 08:53:25 PM »
Cool, what way do you seed the algo? Seems like there is some bias there to ensure the elongated shape.

Endorya

  • Rogueliker
  • ***
  • Posts: 513
  • Karma: +0/-0
  • The non-purist roguelike lover
    • View Profile
    • Email
Re: Screenies of my cave generating algorythm
« Reply #7 on: July 17, 2013, 09:11:30 PM »
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:
Code: [Select]
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:
Code: [Select]
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
« Last Edit: July 18, 2013, 09:19:35 AM by Endorya »
"You are never alone. Death is always near watching you."

Trystan

  • Rogueliker
  • ***
  • Posts: 164
  • Karma: +0/-0
    • View Profile
    • my blog
Re: Screenies of my cave generating algorythm
« Reply #8 on: July 17, 2013, 10:16:13 PM »
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.

Endorya

  • Rogueliker
  • ***
  • Posts: 513
  • Karma: +0/-0
  • The non-purist roguelike lover
    • View Profile
    • Email
Re: Screenies of my cave generating algorythm
« Reply #9 on: July 17, 2013, 10:34:57 PM »
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.
« Last Edit: July 18, 2013, 12:12:13 AM by Endorya »
"You are never alone. Death is always near watching you."

requerent

  • Rogueliker
  • ***
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Screenies of my cave generating algorythm
« Reply #10 on: July 18, 2013, 03:57:34 AM »
Is your game logically 3D Or 2.5D?

Looks awesome.

ekolis

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 186
  • Karma: +0/-0
  • get ye dennis
    • View Profile
    • Ed's home page
    • Email
Re: Screenies of my cave generating algorythm
« Reply #11 on: July 18, 2013, 05:45:12 AM »
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.
The Ed draws near! What dost thou deaux?

>EAT SANDVICH

Endorya

  • Rogueliker
  • ***
  • Posts: 513
  • Karma: +0/-0
  • The non-purist roguelike lover
    • View Profile
    • Email
Re: Screenies of my cave generating algorythm
« Reply #12 on: July 18, 2013, 09:32:35 AM »
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.
"You are never alone. Death is always near watching you."

Endorya

  • Rogueliker
  • ***
  • Posts: 513
  • Karma: +0/-0
  • The non-purist roguelike lover
    • View Profile
    • Email
Re: Screenies of my cave generating algorythm
« Reply #13 on: July 18, 2013, 09:42:11 AM »
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.
« Last Edit: July 18, 2013, 02:51:13 PM by Endorya »
"You are never alone. Death is always near watching you."

requerent

  • Rogueliker
  • ***
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: Screenies of my cave generating algorythm
« Reply #14 on: July 18, 2013, 09:44:45 AM »
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/