MZ Room-based Dungeon Randomizer Plugin/transfer player randomizer

hello! I am currently working on a prototype for a roguelite rpg project in rpgmaker MZ, and for that I want a very specific kind of randomize level layout. one that would most likely require a plugin and/or some specific scripting

basically what I am wanting is:
  • a Dungeon made out of set of pre-made rooms that I can assign/make an event to basically be a directional exit to another room within this defined set of pre-made rooms on a N/S/E/W direction (so for example, leaving a room at its "East Exit" will warp the player to be in front of a "west exit" in a another room)
  • these randomized connections are consistent and seedable for a run (as multiple runs will occur across a single file)
  • there will be multiple dungeons with this kinda of randomized element, so any kind of setup needs to be somewhat programmatic, as I want to avoid hard-coding things as much as possible.
  • Additionally for ease of use, my ideal setup is one where all the rooms are a child map to a core parent map, and I can just call a function of the plugin, give it that parent map ID and a directional ID, in which is searches all that parents children map for exit points matching that ID (possibly found with reagion IDs?)
  • Lastly, and more "nice to have" feature, would be if possible to controll room rotaion in the algoritm, so say, certain rooms can't appear unless certain conditions are met. (again a nice to have, possibly too complex).
is there a plugin that already exists that aproximatly has all these features? if not, the followup question, how do i make one. (I have a few years coding expeirence on and off in C#, but have no experice in javascript spesifically, so can easily understand the underlying logic, I just have no familarity with the spesific syntax).

also lastly, thank you for reading this/apologies if this is in wrong fourm catagory or whatnot.
Hi!

There are some plugins around that can help you. There is this one:

This author also seems to have a lot of rogue like stuff

This one

And this one

maybe you can use them as a starting point?
I had actually checked Aerosys and Visustella's already, and sadly neither look particularly helpful with what I am going for specifically. Aerosys is generous enough to have a trail version I could play with, and messing with it, I concluded it couldn't be used for my purposes. Visustella's I haven't gotten to try, and from the their description/documentation I might be able to do what I want it to with it, but just based on the images provided It looks like all the dungeons it can make are very Mystery Dungeon in style, which is not what I am going for. I am in their discord (had questions about the class change system a while back) can probably go poke around there for more clarity on this plugin, but I am currently doubtful I can use it for my specific needs.

as for the other 2, checking them quickly, KoTC doesn't seem to have a plugin relevant to my specific use case, and munokura's plugin also appears to be another procedural map maker like aerosys and visustella.

So yeah, I can look more into visustella's again just to be sure, but otherwise I don't think any of those plugins will be useful for me sadly.
Thump/update I suppose. since none of those plugins really do what I am looking for (and because looking up a lot of stuff on maze generation, what I am going for is fairly non-standard), I guess I'm just gonna have to make it myself! (I dunno if I should make another thread for this then , or if this could get moved from plugin requests to the more appropriate place. plz do tell me)

so I started work on my own maze maker algorithm in C#, which when its done I plan on then rewriting in javascript. here is what I have so far:

Spoiler: step 1 image
example_rooms_1.PNG
so step one is easy, just make a grid of the amount/size I want.
Spoiler: step 2 image
example_rooms_2.PNG
second step, I have the maze maker place down rooms labeled essential, either randomly, or if they have an assigned spot, there. each room also have the distinction on which directions its open to (north, south, east, west)
Spoiler: step 2 part 2 image
example_rooms_3.PNG
now, while it is also placing down rooms, its keep track of connections, as rooms connect to whatever room is on the same axis as it is, so for example at this stage, the start room connects to the shop, which then connects to the boss room. connections with both ends established are black, while open connections are red. open connections will all get closed by the end of maze maker, but for now they stay open.

Spoiler: step 3 image
example_rooms_4.PNG
Step 3, we then add an assigned amount of additional unique rooms (basically other maps made but not labeled "essential"), and also place them randomly, and keep track of their connections as well. also note, while placed randomly, there is a viability check function to make sure rooms are not place in any spot that would make the maze impossible to solve

now Step 4 and 5 are currently where I am stuck/mid production. Step 4, making sure the maze is completely closed, is fairly easy, as I am keeping track of all connections. I can simply make a generic room to close them all up as shown here,
Spoiler: step 4 image
example_rooms_5.PNG
this maze while closed, is not fully connected, and thus not a valid maze.

my initial plan of attack to solve this was approaching the closing of connections more intelligently than just putting dead-ends on every connections. what I was thinking was
  • first, check any open connections from 1 exit rooms. if it doesn't cross any other connections, generate a 3 point room at furthest point on connection
  • then, go thru all connections again, this time looking for any point where 2 connections cross. at that spot, generate a 2-4 point room, depending on what best covers this. also it should check for this connections from the furthest to the closets point on the connection, so as to catch any connections with multiple crossovers
  • lastly, go thru any remaining open connection, and place a dead end spot at its furthest point.
this plan would cover most permutations of the maze, but most is not good enough, so this is currently where I am stuck.

additionally, to at least write down my current goals, once I solve this issue and get a maze that is fully closed and connected 100% of the time, there are 3 additional features I plan on implementing before starting to port this to javascript

  1. allow the maze to be loopable horizontally and vertically
  2. Add "tunnels" as a type of keyword for maze rooms that have non-directional connection to another maze room, so when one is added, both are, and to have that tunnel be taken into account when checking for full connectivity of the maze
  3. add the function to "splice" a complete/finished maze with additional rooms when certain conditions are met (so while playing if the player triggers a requirement for a special room, that room gets added to the maze while they are still in it)
after all that, its just porting it from C# to javascript, and also figure out how I am going to approach "generic rooms" on the RPG maker side of things. so really kind of a lot. XP
okay, update/bump on this since I have made progress.

the prototype in C# now works and fills all the specific edgecases/conditions for what I am wanting. which having now finished I realize I prolly wasn't explaining properly, given I'm not trying to make a maze on a single map, but a more controlled and directionality constant version of a Zelda Randomizer for connecting rooms, where all the rooms are premade, but the connections between them is randomized each run. which uh, Ce la Vie on that I guess, but moving on.

Spoiler: more in depth explanation of what I built
example_rooms_6.PNG

so here the visualizer for the code I wrote. here you can see it has made a basic dungeon.

the player starts in the starting room (with the red dot), which has been defined as only having an east exit. when the player hits whatever event is defined as the east exit, and instead of calling the hard coded transfer player, it will call a plugin command telling it to go east from this room. the plugin will then, using the grid visualized above determine the room east of the starting room is "River Loop Top" and the plugin will transfer the player to that map, as wherever point is designated its "west entrance". it will do the same for all directions associated with each room, which as you can see in the visualizer is a closed circuit.

we can also see from this visualization 2 of my 3 extended features I wanted for this, tunnels and looping grids. if a dungeon has a looping grid, than connections can go off the edge, so in this scenario, the room "street access"'s south exit connect to the room "trash heap" which is technically north of it on the map. and for the tunnel, we have defined that rooms river loop top and bottom have tunnels to each other (which would be normal hard set player transfer in the respective maps), so if one room gets added to the dungeon, both get added. and additionally how the code handles transferring from room to room is not messed up by this at all.

example_rooms_7.PNG

the 3rd stretch function can be demonstated here, as as already made dungeons can be told dynamically to expand with additional rooms, and it will add these added rooms in appropriate places to fit the dungeon and keep it closed. so in this case, maybe getting the key from the key room also triggers a call to add 3 more rooms to the dungeon, which it now has.

the next thing i need to do is port this prototype i wrote from C# to RPGmaker as plugin, which I believe is javascript correct? are there any good resources for learning the synatx and whatnot? I don't imagine it'll be that difficult but this sounds like it could get annoying, especially when the inevitable bugs pop up.

Update: so following Trihan's anatomy of a plugin, plus a few other posts along the same vein, I have the shell of the plugin shaped, and think i get the basics of porting the functions over from one language to the other. the thing i am moreso getting tripped up on is how i need to go about translating is the bigger concept stuff like the class variables, or the custom helper structs and emums I made for it. anyone know how to go about those for this plugin?

Original thread: https://forums.rpgmakerweb.com/threads/room-based-dungeon-randomizer-plugin-transfer-player-randomizer.182600/