Best Practices for Semi-Procedural Games

Hello everyone!

I've been doing a lot of thinking about how to best tackle a semi-procedural world for RPG Maker and I've gotten some ideas as to how I could tackle them, but in the end, I feel like I'm either overthinking a lot of things that could be much simpler, or haven't found a way to iron out some of the little problems that are cropping up - I would love to get some feedback on this if possible, so I don't start building myself into a deadlock right from the getgo!

The Problem:
The game world consists of many rooms. Those rooms can, logically speaking, have exits on either cardinal direction. All of these rooms will be handcrafted and come in various forms (e.g. "Left & Right Exit", "Top Exit Only"...) and with various purposes (e.g. "Resources", "Important Event", "Part of Puzzle X", "Locked Door", "Key to Locked Door"...). The general idea is that, at the start of the game (or on map transition if more efficient), these rooms should be connected in a way that allows the game to be beatable - perhaps not every door is able to be opened, but at the very least, all "important events" should be reachable so the game can beaten with at least one of the conditions necessary for an ending.

The Ideas:
Please keep in mind that my JavaScript Knowledge is at a pretty basic level - if I make any mistakes, I'd much appreciate being corrected so I can learn from them! I do have decent familiarity with C, C++ & Java, so feel free to draw any parallels if you feel it might illustrate something better ;;

All Ideas have one thing in common - there is a seed being generated at the very beginning, from then on, they differ quite a bit. The goal is not to have a "truly" random game, but to let it be "random enough" (think 1000+ possible combinations rather than millions from exponential growth for a "true" implementation with enough parts).

  1. Have a JSON file ready that can be read, including information about every room in the game as follows: Which exits exist and which purpose the room serves (see above, puzzle, events, resources...) as a "tag". Have a "center" room with four cardinal directions - generate an array of interconnected rooms and save them in a $gameVariable (since I'm not entirely sure how variables in plugins are treated when the game is saved) for easy access, then, in each transfer event, refer to the array as to where to transport the player. (Instead of arrays, perhaps a chained list or map might work better?)

    Potential pitfall for me here is how "interconnected" paths would work - a chained list could potentially have multiple "outliers" that connect to other parts, but it's just a theoretical thing right now.

  2. The without-any-code solution, take the seed mod a reasonable number (like 2-6) and then, based on that number, connect the transfer event to a set map - on that map, back to the origin based on the same calculation to ensure it's consistent. These could be as complicated and as easy as I'd like, but the problem I see is the room for manual error (what happens if I connect something wrong? Does the game become unbeatable? Is the player stuck in an "alternate" version he shouldn't have access too? Also, it obviously doesn't have as many possible variations - which might not be a particularly big problem, as depening on the work put it, the numbers could still be high enough so that it's unlikely one player will get the same layout twice.

  3. Very similar to the former, but in addition to one JSON that holds the "information", the actual "path" could be its own JSON File (Name+SaveFileNumber or something for persistence), although that might pose a problem on web builds of the game, potentially? This "second" JSON would hold all rooms that "made it" into the current playthrough of the game and where they connect to. This data could then be read for the transfers (I hope).
If there's something super convenient or easy I could do, I'd appreciate any sort of help or input a lot! My intention with this post is mostly to discuss if any of these ideas make sense, what else I could possibly consider and how it would make most sense to approach this problem in itself!

Best regards~
I dabbled in procedural for a bit, and planning to do so more in the near future. So I've thought about this topic a lot, and been through a few different forms of it.

For dungeon creation, it can be done via events. It's hard to explain, and honestly, I don't feel like going into a essay long post followed by essay long responses in order to explain it for a game that may never be made by some stranger I've never met, but the three core concepts are...

Build a grid via variables.
Have it go one block at a time assigning rooms. (making sure they logically connect while you do it)
Have some sort of logical checklist at the end to ensure the dungeon is beatable (so it can restart the process if need be)

And last but not least, whatever combinations you think you have, do at least one square root on em. Why? Because whatever you technically have, is not what you actually have.
Brainstorming about Eventing it.

1. For example your dungeon is 4x4 Rooms = 16, you could make 100 or more Rooms to choose from for those 16.
2. While game creation you would need 16 Variables for each Room 1, each remembers which of the 100 Rooms is on their particular Mapslot.This also helps with teleporting the player later on.
3. The Rooms could be categorized like you mentioned, 20 Push Rock Puzzle Rooms for example, but only 1 is in the Game. The categories are helping us to find the correct possible rooms for this Room Slot, which is determined by the Room Maze Sample about which i will tell now.
4. Lets make predefined empty Room Maze Samples with only the directions for the doors and which category the room needs to be + Start and End Point + All the Stuff for the important Puzzles which i cant randomize because i dont know how =).
01,02,03,04
05,06,07,08
09,10,11,12
13,14,15,16
Room 1 could be Map 1 to 100.

5. For example i need push rock puzzle map for Room 15, now at game start the game ran through the predifined 20 push rock maps i made and selected one with fitting amount of doors by random. So even if the same Room Maze Sample got choosen while game start, the levels can still be different.
5. A 3rd and 4th Layer of variability could be added, but it comes all down to have some predefined.
6. Sadly this means there would be a pre defined number of Ways to reach the Exit. The Rooms on those trek to the Exit would be different each time.
7. 16 Rooms Dungeon - 10 Maze Samples. - 6 to 20 Room Categories with each minimum 20 or more Room Maps also with sub categories for different doors. - 16 Roomslots each with a Variable to see which Map is used for that Room.
8. The math behind the code to connect those rooms would be the next step... but that also doable with Eventing.

Hope this somehow helps, even if there is no real solution included.
I've been working with the same concept for Team Fortress 2, and I started with this template.
nuevo-1.jpg


and here's the premise of it:
-enter by A
-exit by either P or Q
-always exit opposite of the entrance.

each section has it's own logic controller, which activates the exit based on the input that is triggered, so, let's say:
-B is triggered.
-B triggers either H or F, randomly.
-if H is triggered, N must be triggered, because J would loop back nowhere.
-since N is triggered, Q is opened, and the premise is held.

so:
Q implies N or L. N, implies H. H, implies B. And B implies A, by definition.
if not N but L, L implies D, OR, F. F implies B, and B implies A.
so, either by B or D, Q must be opened, regardless.

eventually, THAT, devolved into this mess:
mvm_junction_layout.jpg

exit must be J or K, by decree, because that part of the map is already made. J is a vent, and K is a staircase. Since J is a vent, and J must imply L, I made a vent linking both points. Once entered through L, it can only be exited to J.
but that vent, would have covered G, which ended up right below it under the junction,..... so I moved G all the way back next to C, and now C implies going up into G, implies dropping down the junction in section 8, exiting the room, and going up the stairs through K.
by doing that, F had to be moved back, making A-E another narrow space with a staircase with a new F (which I haven't resolved yet) and E, which is an underground passage leading to the far end of section 4..... and the far end of section 4 implies I, but if I, opening the climb to J would be too obvious, so I can open the outer passage over to 5, go up through L, cross back over, and exit to J.
so, A, E, outer I, L, J.
if, say, B.... then P, N, and potentially G, then J.... OR, G, drop down in 8, exit, and K.
it all depends on which section is enabled initially, and when that section is enabled, which exit triggers by that section's own logic.

it wasn't going to be this messy initially, but by fixing J as a vent, I had to make L part of a vent as well, because of the initial premise (exit opposite to the entrance),.... and that bled over to the whole project.

make the core logic centered on the rooms rather than the exits, and have each room trigger it's own exit, and be triggered by the room whose exit is triggered.
The games I’ve just finished working on have 100% procedurally generated worlds, but my real breakthrough in achieving this came when I left the default engines map system behind, although I’d say that required a moderate skill level in JavaScript.

Something you might consider if you don’t want to have to transition the player to lots of different maps, is Shaz’s Tile Changer script which allows you copy groups of tiles from one map to another. Using this you could have whole rooms stored, parts of rooms, and even the passages. There are also a few event spawner/copier scripts which would allow you to populate these dungeons. Combining these plugins with enough graphical diversity could easily create maps which seem completely random.

Original thread: https://forums.rpgmakerweb.com/threads/best-practices-for-semi-procedural-games.110782/