First Prototype Complete

Victory lap time. I am right on track with my week’s goal of a playable prototype. It came at the cost of some tremendously ugly code, but I hacked together a playable demo that gives a solid impression of what the game will become.

The whole procedural level thing was an experiment. I built this prototype to prove the concept to myself–and I think it really works. This is is going to bring the ground combat of Soulcaster to a new level.  See for yourself:

Central Room Features Operational

I added a new type of pattern to the room generator today: the central feature. This is not anchored to a doorway or corner, but is centered in the room, and can be flipped and rotated to fit (or just for variety).

The pattern authoring and placement code is starting to get funky. It’s going to take some cleaning up, but I’m saving that for next week, since I want to just power through and get some monster spawners in there.

One thing that will need to be fixed first is the priority system for merging multiple overlapping patterns. You can see some of the issues that are created below:

sc3 testroom 1
Top right and bottom left corner decorations have blocked the path to the left and bottom exits
sc3 testroom 2
Access to TOO MANY doors here–the top door should be an inaccessible split, but the floor buffer from the central enclosure tore down the pillars.
sc3 testroom 4
Most of the rooms generated are actually okay, like this one. The gate is controlled by the floor switch on the other side, so you have to come in through the bottom to access that door.

Dungeon generation is coming along really nicely. For the first time, I have a 5×5 grid of randomly generated rooms, and about 50% of the time, the entire map is navigable.

Interactive Gadgets in Patterns

All right, two great accomplishments today on the room layout engine.

Complex Patterns

A gadget in Soulcaster is any customizable element in the room: floor switch, gate, moving platform, monster spawner, item pickup. Until today, patterns ignored any gadgets in their area, and just copied the floor and wall tiles. Now I can finally add those epic shortcuts: the ones where you have to go the long way first to press the switch, but then you have a direct connection between the rooms.

sc3 shortcut
If I handle this right, I can make it just as satisfying as kicking down the ladder in Undead Burg

Room State Storage & Restoration

It’s been possible to move among rooms in the map for a few weeks now, but each time a room loaded, it rebuilt itself from its original state. Any switches you pressed before would be reset, which kinda defeats the utility of the shortcuts. To solve this, I created a RoomHistory class that keeps track of every change, to recreate the room just as you left it. Right now it only affects the trigger/gate system, but it will be extended to keep track of destroyed spawners, picked up items, etc.

I think I have all the basic ingredients in place to make a proper (but boring) dungeon layout. Next up: populating the rooms with monsters.

Improved Room Decoration with Pattern Collections

The procedural room layout engine continues to improve. Today I added two main features:

1. The entire dungeon generation is deterministic for a given random number seed. Thanks to Chris Pavia for recommending I do this early on–it’s already helped out in testing a lot. If I find a flaw in the layout, I can keep working on the same room until it’s fixed.

2. The pattern merger takes the doorway positions into account, so it won’t block off an exit to the room. It also has a list of available decorations (currently just to serve as room corners and island splits), and picks one at random that is small enough to fit without blocking any doors.

Here’s how I design the corner decoration patterns:

sc3 corner designer