Jump to content


Photo

Dungeon Map Generator


  • Please log in to reply
11 replies to this topic

#1 StallionTG

StallionTG

    GMC Member

  • GMC Member
  • 142 posts
  • Version:GM:Studio

Posted 23 August 2012 - 03:57 AM

Inspired by spaz_orientation post
This is how I would generate a dungeon map for an exploration game.

Core Version(just the generator scripts)
Download dungeon-mapping.gmk
Press enter to re-generate the dungeon. You will have to download the .gmk to mess with the settings.

Advanced Version(with generated floor tiles, and lighting for each room using a particle system)
Download dungeon-mapping-adv.gmk
W,S,A,D to move your avatar around.

Advanced Demo
Download dungeon-mapping-adv.exe

All in game objects simply contain scripts that can be found in the scripts folder. You will need some understanding of GML, if you don't I hope you find this to be an advanced example to learn from.
scr_create() is where you can set the number of rooms and how many possible neighbors each room can have.
scr_step() is where all the action is. It's commented out.

It will take some know how to translate the basic version into room exploration. My method is found in the adv version. If you would like to add to this project please post updates here!

1. You can edit the boundaries of how far your dungeon will expand as well as how many rooms in total are produced.
2. you can now use a decimal place to edit the maximum number of neighbors a room can have. So setting max_nbor = 2.1 will allow 3 neighbors 10% of the time, otherwise just 2 for example.
3. If you really want to have the room cells be a smaller size, you can adjust the mask of obj_room to match the width and height you want. that should fix it.

UPDATE: I added the functionality of actually roaming around rooms check out the screenshot.
Posted Image

Edited by StallionTG, 10 October 2012 - 07:33 PM.

  • 3

#2 spaz_orientation

spaz_orientation

    GMC Member

  • New Member
  • 30 posts
  • Version:GM8.1

Posted 23 August 2012 - 04:18 AM

Great work here! I love it!
  • 0

#3 Newly Discovered

Newly Discovered

    Harmonious Genius

  • New Member
  • 2467 posts
  • Version:GM8

Posted 23 August 2012 - 07:06 AM

Interesting, and very simple! I like this a lot.
One suggestion would be to give it the option of creating a hallway instead of another room, but then you'd need to set up some checks to select the right sub image for the hallway to connect the rooms correctly. I can't imagine it'd take much, and it definitely improve the example.

Well done and good luck!
  • 0

#4 StallionTG

StallionTG

    GMC Member

  • GMC Member
  • 142 posts
  • Version:GM:Studio

Posted 23 August 2012 - 08:18 AM

Interesting, and very simple! I like this a lot.
One suggestion would be to give it the option of creating a hallway instead of another room, but then you'd need to set up some checks to select the right sub image for the hallway to connect the rooms correctly. I can't imagine it'd take much, and it definitely improve the example.

Well done and good luck!


I think it would be easier to combine 2 rooms into a hallway.
  • 0

#5 StallionTG

StallionTG

    GMC Member

  • GMC Member
  • 142 posts
  • Version:GM:Studio

Posted 25 August 2012 - 10:39 AM

So, I've decided to go all the way and make a full practical demo for this. Complete with actual rooms and a little avatar to walk around from room to room with. Maybe you will find something cool O.o
  • 0

#6 StallionTG

StallionTG

    GMC Member

  • GMC Member
  • 142 posts
  • Version:GM:Studio

Posted 10 October 2012 - 07:34 PM

Update: New advanced version is out. checkout the first post.
  • 0

#7 tombmonkey

tombmonkey

    GMC Member

  • GMC Member
  • 8 posts
  • Version:Unknown

Posted 10 October 2012 - 09:55 PM

Thanks for this, it works great and is a fantastic reference.
  • 0

#8 StallionTG

StallionTG

    GMC Member

  • GMC Member
  • 142 posts
  • Version:GM:Studio

Posted 12 October 2012 - 07:35 PM

I eventually plan on developing this into a small adventure game, where I'd release the code for each aspect. But I've been busy on Fire with Fire.
  • 0

#9 Dendail

Dendail

    GMC Member

  • GMC Member
  • 268 posts

Posted 08 December 2012 - 11:04 PM

I eventually plan on developing this into a small adventure game, where I'd release the code for each aspect. But I've been busy on Fire with Fire.


Wow I really love this! There is something I noticed though when using this on GM: Studio. The first room it makes is the same every time. If you remake the room it appears to be random so that checks out but I was wondering if there is a way to fix the first dungeon it creates? This is on your advanced version.

I see you have creeps in the files but they haven't been expanded on in the GMK. Is this usable for the public? If so how could I randomly generate creeps within the rooms?
  • 0

#10 NightGrader

NightGrader

    Game Maker Hobbyist

  • GMC Member
  • 31 posts
  • Version:GM8

Posted 28 December 2012 - 05:17 AM

Great job on developing this! You deserve praise!
+1
  • 0

#11 hunterfx21

hunterfx21

    GMC Member

  • New Member
  • 2 posts
  • Version:GM:Studio

Posted 11 January 2013 - 08:36 AM

This is great! Just missing the monsters.

Any idea on how to add random generated monsters/treasure to the rooms?
  • 0

#12 StallionTG

StallionTG

    GMC Member

  • GMC Member
  • 142 posts
  • Version:GM:Studio

Posted 23 May 2013 - 07:52 AM

Shouldn't be too hard, track when the player first enters a room and spawn some! keep track of what was spawned in a global array and read from it when changing rooms so that the same thing happens every time they enter that room.

The game is all pseudo rooms. it only actually uses 1 game maker room. So all data is kept track of in arrays.


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users