Having gotten my Gemini server and initial content for my capsule into shape, I started initial work on my multiplayer roguelite, Vanquish Vanguard Online or VVO, after work today.
I'm writing the server in Golang to continue my study of that language. For the client, I decided to use Electron, because I think essentially wrapping up a webpage into a desktop application will be the overall easiest way to roll a client given the graphical style (simple, static sprite-based tile graphics) and UI I want to go for.
I've never used Electron before, but getting an Electron app up and running was surprisingly easy, as was getting the client and server to talk to each other. From here, I'm taking a very "agile" approach and, rather than having a detailed plan, I'm just kind of winging it and writing code as I go. :3 (I say that somewhat tongue-in-cheek. Somewhat.)
I got to where the client can request map data, the server will return it, and the client will display it, using a few tiles ripped from Dungeon Crawl Stone Soup. (This is just for testing purposes, the final version will of course have original graphics.) But, that was just with some simple hard-coded map data.
Naturally, as a roguelite, VVO will have lots of randomly generated levels, so I decided to work on a random level generator next, because I find random level generation algorithms fun to work on, and that was as good a next step to take as anything.
A long time ago, when I was in grad school, I made a really cool random dungeon generator that works as follows: It generates a random grid maze (I think I used Prim's algorithm back then), then adds extra connections based on a tweakable "connectivity" parameter, then it randomly selects from a set of precreated terrain chunks I call geomorphs, rotates them at random, and plops those down at each of the nodes in the maze. Finally, it adds connections between each of the geomorphs wherever there are connective edges in the maze. I've long since lost that code, but I decided to recreate that algorithm for VVO.
As a side note, each map cell just has two values: two integers, one representing the terrain type and the other defining the graphic. These are separate so that different tilesets can use different graphics for the same underlying terrain types. So I only need one algorithm for generating the terrain, and then applying whatever graphics for the current terrain set is an easy operation.
I got almost the whole thing working -- the only step that isn't complete yet is that very last one, adding the connections to the final map to reflect the edges on the originally generated maze. For the "real thing," the geomorphs will be a decently chunky size (around 11x11 cells or so?) so that they're big enough to create a decent variety of terrain configurations. But for testing, I just made three 5x5-cell geomorphs (each of which is completely bordered by 0s, representing no terrain, to be bridged during the final step) and generated a 4x3-node maze. Here are the results from one particular run, with the 0s replaced with .s for clarity:
Random Maze: *-*-*-* | | | *-* *-* | | | *-*-*-* Random Level: [. . . . . . . . . . . . . . . . . . . .] [. 7 4 1 . . 7 2 7 . . 7 2 7 . . 7 4 1 .] [. 8 5 2 . . 8 3 8 . . 8 3 8 . . 8 5 2 .] [. 9 6 3 . . 9 4 9 . . 9 4 9 . . 9 6 3 .] [. . . . . . . . . . . . . . . . . . . .] [. . . . . . . . . . . . . . . . . . . .] [. 3 9 5 . . 5 6 1 . . 4 7 3 . . 7 8 9 .] [. 7 2 6 . . 9 2 8 . . 8 2 9 . . 2 3 4 .] [. 4 8 1 . . 3 7 4 . . 1 6 5 . . 7 8 9 .] [. . . . . . . . . . . . . . . . . . . .] [. . . . . . . . . . . . . . . . . . . .] [. 9 8 7 . . 3 9 5 . . 5 6 1 . . 3 9 5 .] [. 4 3 2 . . 7 2 6 . . 9 2 8 . . 7 2 6 .] [. 9 8 7 . . 4 8 1 . . 3 7 4 . . 4 8 1 .] [. . . . . . . . . . . . . . . . . . . .]
Keeping in mind a few points -- that the numbers will be rendered as tile graphics by the client, that the geomorphs for the real thing will be much bigger than these small test ones, and that I haven't connected them yet (and the connections will be variable-width) -- I think that, with sufficient variety in the geomorphs, this will be a pretty good algorithm for generating random levels.
Not bad progress for one evening's work.