User Tag List

Page 3 of 5 FirstFirst 1 2 3 4 5 LastLast
Results 21 to 30 of 50

Thread: Random Dungeon Generation Help

  1. #21
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    I'm sure this won't be of any use to the OP, but perhaps others reading might be interested...

    I dug out an old random map generator of mine:
    https://1drv.ms/u/s!Atq7cUIJ7uexhSTBo2CoNEpiP8d0

    It generates maps that look something like this:


    You can probably get a fair idea of how it works already, just from that:
    First, the map is divided into a 4x4 grid, and a room is randomly placed inside each cell (using binary space partitioning would have created more varied maps).
    Next, the remaining space is completely filled with a maze of corridors, using the depth-first search algorithm here: https://en.wikipedia.org/wiki/Maze_generation_algorithm
    A doorway is then added to connect each room to a corridor (it would be better if some rooms had more than one entrance).
    Corridors that only lead to a dead-end are then detected and removed (using a very crude method that should not be copied - this could be done much more efficiently just by detecting the dead-end and then tracing the corridor back to a junction).
    Finally, the map is drawn, using a fairly standard auto-tiling method.

    Anyway, I hope someone finds that helpful...

  2. #22
    Clicker Install Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    May 2016
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That looks great! I'll try it out. Although my method is working now, but I'm not very happy with it as the corridors are overcrowded.

  3. #23
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,281
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    Thanks MuddyMole. This will be good for learning. Although I am still stuck as to why my simple room arranger isn't working. Can anyone take a look?

  4. #24
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Apr 2007
    Location
    Australia
    Posts
    1,151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great example MuddyMole! Have you ever tried doing a similar thing to say Zelda or the Binding of Isaac, where it's just rooms connected to each other without the need for passages? I tried messing around with something similar to your Spelunky example but ended up frustrated trying to make the map generate outwards from a center point rather than starting in the top row and ending in the bottom like the Spelunky map. I have a feeling I could use something similar to the auto-tiling method when it comes to connecting the rooms, it's just the generation pattern that stumps me.

  5. #25
    Clicker Fusion 2.5Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    zip2kx's Avatar
    Join Date
    Jun 2015
    Posts
    780
    Mentioned
    17 Post(s)
    Tagged
    0 Thread(s)
    Great example!

  6. #26
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    @RhysD:
    I'd have thought Prim's algorithm should be perfect for that - you could use it to generate a maze, where each cell represents a room:
    http://weblog.jamisbuck.org/2011/1/1...im-s-algorithm

    It would be very easy to implement in MMF2 - just use an array to keep track of each map cell's walls, and whether or not the cell has been visited already

  7. #27
    Clicker Install Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    May 2016
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am thinking of using detectors for the neighboring cells, but I don't know how to make the walls between the cells.
    Or should I use different graphics for each room? But that creates a new problem: for example, the graphics for each room is a door at a side and walls surrounding the remaining border, how are they going to connect?
    If you can make an example, it would definitely helps a lot.

  8. #28
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Apr 2007
    Location
    Australia
    Posts
    1,151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MuddyMole View Post
    @RhysD:
    I'd have thought Prim's algorithm should be perfect for that - you could use it to generate a maze, where each cell represents a room:
    http://weblog.jamisbuck.org/2011/1/1...im-s-algorithm

    It would be very easy to implement in MMF2 - just use an array to keep track of each map cell's walls, and whether or not the cell has been visited already
    Thanks for the link, I'll check it out!

  9. #29
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,281
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    MuddyMole: This is a great interpretation of that algorithm. I am especially impressed by the way you make a string for the possible directions and choose a random direction with the length of the string. A nice approach I will have to add to my own coding arsenal. I see what you mean about handling the dead ends. You aren't allowing for even a small amount of dead ends. But it is easy to follow as you have it now, so I wouldn't say it is a bad approach.

    The part that confused me was how you move 2 cells at a time. Since your grid is 2 (pixels), can I assume that your array is storing the wall and open space separately? Or am I misunderstanding? I would have assumed the array cells would simply store a value to describe the configuration of the cell, but I guess it is simpler to include the walls as cells?

  10. #30
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Thanks
    The thing with picking a random character from a string (using it a list basically) is a little trick that I use a lot - I'm sure all my pathfinding examples will do the same sort of thing quite a bit.
    The problem with the dead-end removal isn't so much that it removes too many dead-ends - I'm sure that could be adjusted - the problem it's that it's extremely inefficient, as it re-scans the entire map many times, looking for dead-ends. If I were doing it properly, I'd have a single loop that scans over the whole map, and then every time it finds one, a second nested loop would follow the corridor back to a junction, filling it in with wall as it goes. That would be much faster.

    Every map space contains only a single value, representing either "wall", "corridor" or "room" - it doesn't store any information about adjacent cells. This is simpler, but also, it just makes far more sense when you consider how it would likely be used in an actual game, where you're going to need to store other information for every individual tile (eg. the position of the player, monsters, items etc is not going to be aligned to a grid of 2x2 tile blocks).
    The only time I'd do it the other way, would be when walls don't fill a cell, but straddle the boundary between two adjacent cells instead, which tends to be mostly in games with isometric graphics, or in boardgames.
    eg. http://gamervets.com/wp-content/uplo...fo-defense.jpg
    eg http://3.bp.blogspot.com/-xBQJwKufLw...me%2Bsetup.JPG

Page 3 of 5 FirstFirst 1 2 3 4 5 LastLast

Similar Threads

  1. Roguelike - dungeon generation system
    By adrian09_01 in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 19th September 2015, 07:34 PM
  2. Procedural Dungeon Generation (1st person rendering)
    By bad_rick in forum Guides, Tutorials, Examples, Widgets
    Replies: 11
    Last Post: 28th December 2014, 12:13 AM
  3. Random dungeon help.
    By blub in forum Multimedia Fusion 2 - Technical Support
    Replies: 13
    Last Post: 8th March 2012, 01:22 AM
  4. Random Dungeon Generation
    By nivram in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 30th October 2011, 07:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •