Collision Purgatory

Pixel accurate movement has taken a bit longer than I thought it would. I was expecting about one week to get things operational–I think I got 75% of the way there in a week, but now it’s the final 20% that could take up 80% of the time.

Pathfinding and general movement works, but needs hacks to work properly. I created a system to help the monsters file through doorways without getting stuck, but it still relies on a system that temporarily disables clipping for monsters that get stuck together for too long. That system works great for declogging the doorways, but when the monsters get close to the player and start phasing through one another, they just stack in a jumbled, writhing mess. I really want it to look like Gauntlet, with mobs flowing gracefully around corners and stacking into nice grids.

I think my collision detection will also have to move from floating point to fixed point, because accumulation errors are probably one of the causes of clipping bugs among monsters. That change will take at least two days, if not more.

I’m pretty confident it will have been worth the trouble once everything is together. For now, it’s in that purgatorial state where the code is broken and ugly… not a place I like to leave things.

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.