Hyeve's Cloud

< Unseen Diplomacy 2 >

UD2 - Unseen Diplomacy 2 - is the first major commercial game project I've worked on!

I worked on UD2 primary as a programmer, but as the team was very small (~10 people at the largest, with most on contract!), I also did a fair amount of generalist work - mainly in the form of setting things up properly in editor to be placed around and used by our designer.

I also did the edit and graphics for the initial reveal trailer and the full release trailer above, as I was the only one on the team that had a significant amount of video production experience and education. UD2 was a fun project to work on, and I'm pretty proud of the systems I created for it!

One of the first major things I did on the project was a complete rework of the maze generation system in the game - UD2 has a semi-proceedural system for levels, which for the most part means that levels are assembled randomly out of designer-authored rooms, but it also has a few systems for fully procgen rooms, like the mazes.

When I started work on the project, there was already a simple implementation of mazes that worked by evenly dividing up your space into squares and randomly placing walls between them, with constraints to prevent the maze from becoming unsolvable. However, that had some problems - the mazes weren't very interesting to navigate, and more seriously, the difficulty of them was completely dependant on the amount of space you had available, since the tiles didn't scale.

If you had a giant room, you'd end up with an incredibly dense and almost impossible to navigate maze, whereas if you had a very small room, you'd often end up with almost no maze at all, just a few oddly shaped corridors with the exit immediately obvious.

I solved this by completely reworking how the maze tile placement system worked. Instead of fixed size tiles, I implemented an algorithm that creates a number of differently sized tiles based on the total size available - on average resulting in the same total number of tiles regardless of your space. Those tiles are then placed into a randomizer pool that's drawn from in order to construct the actual maze layout, using a tetris-like placement algorithm - dropping a tile in from a side of the maze and letting it 'fall' until it reaches the other side or connects with an existing tile.

That worked fairly well, and could easily be tuned for difficulty by changing how many tiles the algorithm tries to use, but lead to some other problems, most notably holes in the mazes - since tiles weren't all the same size, and the placement algorithm had no way of knowing to fill gaps in the maze, it was quite common for it to place some large tiles in such a way that left gaps between them that'd never get filled.

The fix for this is a bit more complex than you'd expect - I don't want to just fill the gaps with more tiles, because that skews the difficulty, and the whole point of the algorithm is to generate an approximately average number of tiles no matter the playspace size. Instead, I needed to detect if there was any completely isolated tiles, and then place connecting tiles specifically joining to those, which mostly preserves the difficulty of the maze and makes sure the whole maze is accessible.

Figuring out where to place the exit in a randomized maze is also a bit difficult, since you obviously want to try and make sure that actually finding the exit can also be tuned for some difficulty, and if it can randomly be placed right next to the entrance, that's a problem!

The approach I ended up doing was to compute the minimum distance (in terms of tiles you have to pass through) from the entrance tile to every other tile, and then place the exit on the tile 'furthest away', which works pretty well!

The maze gen still struggles a bit in very small spaces, which is unfortunately just a result of it being very difficult to place many walkable tiles in that situation, so mazes are forced to be very simple. We considered some possible ways to get around this, like making mazes have multiple vertical layers, but that was never implemented.

Aside from the mazes, I also did the majority of NPC behaviours for the bots in the game, and many other misc systems and props. Overall, I'm pretty proud of my work on the game, though I must admit that developing for VR is lot more of a pain than 2D!

You can find the trailers and link to the Steam page below, and the game is also available on the Meta Quest store if you want to check it out!

[sneaky spy sounds]