Random Dungeon Generator v1.0
Author: timm1980 (aka tkirch)
Author: timm1980 (aka tkirch)
This is my first script that I'm posting here, so bear with me, and please forgive my relative newness to the process.
Using this requires not only a script, but one important event, and a few special maps. See the example project for all the details.
Basically, the idea is, you make a script call when you're about to enter a dungeon, and the dungeon will be randomly generated based upon parameters you specify: width, height, depth, and seed. seed is what determines the effects of the random number generator. So a 5x5x3 dungeon with seed 0 will always be the same, but a 5x5x3 dungeon with any other seed value will be very different.
Give it a try and let me know what you think!
Two different types of random dungeons can be created.
* A "maze" of individual rooms, forming a three dimensional structure
* Each room is it's own mini-map, a part of the greater dungeon
* Events, and other elements can be placed on cells to only appear in the "far point" (furthest distance from entrance) or in random cells (by using the RDZ_SPECIAL_VALUE variable to control whether or not the event is shown)
* 16 Different cells are used, for each possible combination of paths top/bottom/left/right
* 0 = no paths, 1 = bottom, 2 = left, 3 = bottom/left, 4 = top, 5 = top/bottom, 6 = bottom/left, 7 = top/bottom/left, 8 = right, 9 = right/bottom, 10 = right/left, 11 = right/left/bottom, 12 = right/top, 13 = right/top/bottom, 14 = right/top/left, 15 = right/left/top/bottom
* Each of the cells must be the same size, but any size can be used (and these can be edited right within RPG Maker VX!)
* Also note that the X coordinate of the top/bottom entry point from each cell must be the same across all cells, ditto for the Y coordinate of the left/right entry point
* Because only a single cell is loaded at once as the game map, this doesn't use a lot of system resources... thus the overall dungeon implied internally can effectively be quite large (in fact, the script imposes no particular limit!)
* Do note, though, that larger dungeons will take more time to generate... to be precise, the generation time is roughly linear with the number of cells in the dungeon, e.g. length * width * depth
Flat-map format, which is currently limited to a single floor, but the entire dungeon exists on a single flat map
* The single-floor dungeon is still constructed in the same maze-like manner, but it is all assembled into a single map
* Cells (which are all rectangular blocks of tiles, 5x5 in my example project) are all cut from a single Map created in RMVX
How to Use
I HIGHLY recommend looking at the demo, because the nature of the maps and events that must be precreated for this to work well are more than can be adequately described in text. (Despite my mini novel above)
Credit and Thanks
None of this script comes from anyone else; the idea for it was loosely borrowed from both Dragon Quest 9, and the original Legend of Zelda, however.
There is no arbitrary limit on how large of a dungeon can be created; larger dungeons will be slower to create and load, and may approach the limits of what RMVX can handle well, however.
Currently, I know this won't work right if you save a game while inside of a random dungeon.
Likely Future Features to Include
* Ability to Save/Load while in a random-dungeon (either Zelda or flat style)
* Flat-style dungeons will multiple floors
* Flat-style dungeons will randomly placed treasure chests or other events
* Flat-style dungeons automatically copy only some random layer two map features (I'm thinking for embellishments like moss, skeletons, etc, so that each cell of the finished map looks a bit different, despite being created from only 16 cells)
* Any other ideas that are suggested that seem feasible and worthwhile?