So much like last month, this is going to be a very short update. I was still concentrating on the 2nd edition of my book so not a ton of work on the first-person RPG. However, at this point my part of that work is pretty much done, and I can shift back to concentrating on my games! There’s still a lot more work needed before the book is released, but it’s not work that I’m doing; there are months of copy-editing and layout to be done once the actual writing is complete. The first draft was finished last month, so this month I worked with editors and reviewers to make revisions. I do still need to make one pass of revisions, but that’s more of a sanity check to make sure nothing is missing, than actually writing anything.
Anyway, now I’m planning what to work on as I shift back to development. When I first mentioned the first-person RPG I described it as “basically a clone of Shining in the Darkness”. Well, that “basically” implies that it’s not exactly the same, and one of the bigger changes will be procedurally generated dungeons. The mazes probably can’t be quite as intricate as a result, but then it’ll probably be more fun if there’s less emphasis on memorizing the dungeon mazes and more variety each playthrough.
I’ve actually started writing code for this, and expect to have a playable prototype fairly soon. There are really two parts to this: maze generation, and then building a 3D mesh.
For the first part, there is lots of literature about maze generation online, and many of those algorithms come very close to what I need. However for gameplay reasons I don’t want “perfect” mazes (ie. there’s only one path connecting a point in the maze to any other point) and most maze algorithms generate perfect mazes. I actually do want loops and redundant passages, to reduce the tedium of getting stuck in dead-ends and needing to backtrack.
Furthermore, I want to have some larger rooms. Most maze generation algorithms produce 1 unit wide corridors for the entire thing, which is exactly what you want in, say, a newspaper’s puzzle section, but an RPG dungeon should have rooms.
Fortunately for me, there are lots of resources about generating dungeon mazes too. Mostly those resources are talking about roguelikes, such as this resource that is closest to what I’m after. As a first pass, I’m planning to basically implement that exact methodology in Unity, and then modify it to my needs.
Long story short, the method is to place a bunch of rooms randomly throughout the grid, and then fill in the space between them using depth-first maze generation. Once the first pass is done, I’ll need to modify things a little. In particular, I’m probably going to need methods in order to add locked doors; ensuring that the needed key is accessible will probably involve flood fills to check connectivity.
Alternatively, I might try this method first because it’s also pretty close to what I want, and is a lot simpler. In this case, the algorithm is a lot simpler because there’s no back-tracking to previous cells (and thus no need to store previous cells), but may not be flexible enough for everything I plan to do. We’ll see!
Meanwhile, building a 3D mesh from the generated dungeon plan is relatively straightforward. All the maze generation resources assume the maze will be used for a top-down 2D game, but I’m going to extrude them up into 3D walls and put the camera inside. As a result, I’ll probably need simpler mazes (it’s easier to find your way around twisty corridors when you can see the rest of the maze) but that’ll be tuned in playtesting.