Random Dungeon Generator (with demo)

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
374
First Language
Sarcasm
Primarily Uses
Dungeon Generator Script v1.0
Created by Neon Black

What is it?
This script is one I have wanted to do since I started working with VX. It allows a random dungeon to be created from a number of rooms of any size and shape. This allows for more controllable dungeon design.

How can I use it?
To use this script, place it under “Materials” but above “Main”. To use a random dungeon, simply use the following script call:

  • create_dungeon(length, alts, width, height)
After using this call, just transfer to a map tagged with “<random>” and the random dungeon will be created. The 4 arguments of the script call are meant to be numeric and are as follows.

  • length – The total length of the main path of the dungeon. Using a higher number will create a larger dungeon.
  • alts – The max number of treasure paths to create. These paths can be any length between 1 and “length” rooms and will start from any existing room EXCEPT the start and end rooms.
  • width – The total allowed width of the dungeon in rooms. By default a buffer of one room is placed on each edge of the dungeon and includes empty rooms.
  • height – Same as width only vertical.
Maps must be created with a total of 40 “rooms” that the dungeon selects to draw from. This creates a set of rooms that is 8 wide and 5 tall. Every room must be the same size, but the size of the rooms and the size of the set is pretty much infinite. The first 16 rooms are the standard rooms that will show up based on the random value you set in the config section.

The next 16 tiles follow the same pattern. These are the “uncommon” tiles that only appear with a certain chance based on the random value set in config.

The final 8 tiles are the start and end points. The first 4, your start points follow the pattern up, right, down, left. The last 4 are the end points and follow the same pattern.

The end result map should be something like this:

There are 2 types of special events that can be placed on a map. These are as follows:
  • <super> - Any events with this in their name will get placed in the very upper left hand corner of the map. This is useful for parallel processes and other such events.
  • <treasure> - The event with the lowest id and this in it's name will get placed on all tiles in treasure rooms that have an ID of 3.
Regions are very important for telling the map where certain things should happen. The region tags that are reserved by the generator are 1, 2, 3, 4, 6, and 8.

Region 3 is used by the generator to determine where to put treasures. When a room is designated as a treasure room (the end of an alt path) it will search the room for a region 3 and place treasure chests on ANY found (see above for how to mark these).

Regions 1, 2, 4, 6, and 8 are used for the start points. As it is creating the dungeon, it will take the last of these regions that it copies and set it as the start point. As a general rule, only put one of any of these in each of the 4 start rooms. When using region 1, the player's facing direction is determined by the transfer event. If you want the direction to change based on which room the player ends up in, user 2, 4, 6, or 8. These will set the player to face the same direction as the same number on the numpad, for example, region 8 will place the player facing up.

All other events work normally. When a room is copied over to the newly created map, all events are taken with it and placed in exactly the same spot. The only exceptions are events marked as treasures and events marked as super.

What does it work with?
This script may not work with scripts that modify how maps, tilesets, or events work.
This script adds an additional command to my Basic Console script that allows you to see a map of the dungeon generated. To do this, type “map” in the console screen.

How can I get the code?
Version 1.0 (base script, 9.8.2012) is available from my pastebin account here or the demo on my mediafire account here.

I would like to use this code.

This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
Permissions beyond the scope of this license may be available at http://cphouseset.wordpress.com/liscense-and-terms-of-use/.

Author’s Disclaimer:
I had created a similar dungeon generator to this with events in rpg maker 2k3 and it actually worked really well! Of course with scripts it’s a lot more controllable. The main focus of this dungeon generator is to allow large dungeons with multiple “rooms” to be created which allows more control to the shape of dungeons. The result is random dungeons similar to Persona 4. Rather than being small, ugly paths, you can create large, robust rooms, and due to standard and special rooms, you can even have some simple little challenges in some of those rooms. This may be a bit tricky to use, so I included a demo which shows how several aspects of the script work. If you’re having trouble, be sure to check that out. As always, enjoy!
 
Last edited by a moderator:

hyde9318

RMC Coordinator
Veteran
Joined
Apr 1, 2012
Messages
2,593
Reaction score
680
First Language
English
Primarily Uses
RMMV
Thats pretty damn cool, I will say. I just tried it out. It works perfectly.
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
374
First Language
Sarcasm
Primarily Uses
Does this correctly create auto-tiles?
This script copies the "rooms" 100% as you make them. See the "Stone Dungeon" map in my demo. This does make it a bit tricky because you have to shift click to create certain rooms. But no, this does nothing with auto tiles. This is the first time I've ever really worked with maps, and honestly may be the only mapping script I make (unless I come up with something else really cool).

And I'm trying to stay out of the whole autotile argument. I like them, but there seem to be a lot of people that hate them with a passion.
 

Adon

ADONKADONK
Veteran
Joined
Mar 24, 2012
Messages
93
Reaction score
15
First Language
English
Primarily Uses
This is a really awesome awesome awesome awesome script, and would work perfect with my vx game since it doesn't use autotiles. Only if you made one for it...

Very useful script, I am sure I will find some use for it!
 

Neon Black

The Classy Prostitute
Veteran
Joined
Mar 17, 2012
Messages
1,149
Reaction score
374
First Language
Sarcasm
Primarily Uses
This is a really awesome awesome awesome awesome script, and would work perfect with my vx game since it doesn't use autotiles. Only if you made one for it...

Very useful script, I am sure I will find some use for it!
I'll see about converting it. Not sure how different maps are in VX, but it shouldn't be too hard. I'll let you know within the week.
 

timk1980

Apprentice
Member
Joined
Mar 15, 2012
Messages
123
Reaction score
42
First Language
English
Primarily Uses
I'll see about converting it. Not sure how different maps are in VX, but it shouldn't be too hard. I'll let you know within the week.
Relative to what you're likely doing, by copying "rooms" from the map in order to create a generated map, they work almost identically. You just only copy three layers instead of 4, since VX didn't have the fourth layer to control regions and shadows.

I have my own generator, not coded cleanly enough for public consumption, but works very similar to yours... uses only 16 "rooms" though. I added variability to the visuals by making the second layer of the map embellishments get copied randomly.. so, sometimes the mud or cracks will be there, other times they won't, basically.

This looks to be very nicely done!
 

Revenant of Anubis

Admin of Chronalis and Creator of it's RPG
Member
Joined
Dec 30, 2012
Messages
16
Reaction score
1
First Language
HTML, NERD & RP
Primarily Uses
Can I suggest an idea for a wicked way to implement your script with maybe a sort of wicked twist?? How about using your script in an arena like setting.... or a running of the Gauntlet..... so like example.... Taking your building on the demo you have... the sign next to the doorway maybe has a slot for some rare item you found.. let's say a Fireheart Ruby... ok Now when used on that changes the tiles in the place to be more lava looking and fire based...... or a Frozen Nymph's tear... makes it more snowy and ice looking... or a Void Crystal for the dimensional look..... but then add in an encounter script where the deeper you go the harder the spawns and depending which element or terrain is inside means more frequency of some enemies and other maybe little to none at all..... now modify it just a hair bit more..... Take the idea of lets say 10 floors deep or 20 the number could be specified by the user or such.... then make it connect to a special like boss room.. which would always be a set specific area... not generated like the rest of the dungeon was.... could make some seriously fun dungeon delving and interesting rewards according to what you encounter and what you end up facing... and at the same time... if you chicken out early you lose all those super nice stuff that lied in wait.

Oh and would have to kinda make a sort of Boss Respawn script....... just for that final section..... gives an interesting element of design with your creation.

I know it sounds like a lot of coding and madness to combiine it..... but even if you don't script it out for anyone else, at least possibly try giving a demo or what not to me so I can see it in effect... I had the idea come to me based on the customizing idea from Dungeon Maker 2 using kits to change elements and spawn types but they normally only did one section at a time and I mean like a piece of a hallway not an entire dungeon..... But it also makes the fun of a neverending Cycle of Treasure hunting if your strong enough.... and might contain the best rewards..... Sorta like Disgaea and its boss floors on every 5th floor or so but without the headache of the same looking maps all the time.
 
Last edited by a moderator:

Ravenith

Veteran
Veteran
Joined
Mar 27, 2012
Messages
263
Reaction score
15
First Language
Greek
Primarily Uses
You can event that.
 

Revenant of Anubis

Admin of Chronalis and Creator of it's RPG
Member
Joined
Dec 30, 2012
Messages
16
Reaction score
1
First Language
HTML, NERD & RP
Primarily Uses
You know I hear that... eventing.... as newbie of me it sounds...... but care to explain what you mean?
 

KingDragoon

Warper
Member
Joined
Jan 4, 2013
Messages
1
Reaction score
0
First Language
English
Primarily Uses
Well, to be honest I skimmed because i'm pretty wiped out, but, for an arena: Create said maps for your 'levels' i'm guessing a Dante's Inferno (Story) style of hell.

No you can use this (script) to create where your items and main events are (creating the foes and players yourself).

Once you have some stuff set up, create your text, event graphics, a few switches/variable (or do it as you go along), with conditional branches.

Now, do this:

@>Condition [Win/Loss] <<Switches or even the battle victory/defeat

  @> [Win]

     >Teleport [MAP002, X, Y] << next map

  @> [Loss]

     >[text]

     >Teleport [LOBBY, X, Y] << a starting poiny before the arena (if implemented)

 @>if else

 @Branch_End

...and so one for each 'arena pit'.

though the dungeon creator WILL help with placing events to make this easier (and possibly) faster.

If you need more eventing help, just contact me i'd be VERY glad to help.

P.S. Like all the parenthasis? I don't...
 

ShadowFox

Adventurer
Member
Joined
Mar 13, 2012
Messages
255
Reaction score
10
First Language
English
Primarily Uses
Nice script. However there is a slight problem and I am not sure if it is on my end or not.

Basically when you try to enter the glass dungeon the game crashes with "Can not find Grid" file error.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,569
Latest member
Shtelsky
Top