When Creatures Attack

Part of the code upgrade from Soulcaster 2 to Soulcaster 3 is the way creatures attack one another. Since we’re going to have lots of complex equipment, magic, and creatures in the game, there needs to be a flexible system that can handle a wide variety of special abilities:  Life steal, stuns, poison, regen, invulnerability, mind control… All of these things need special code, and need to be informed of the events of an attack so they can play their special role.

Exposing events for customization like this is called adding hooks.

There are two phases to any attack: targeting (finding a suitable foe) and collision (the actual hit where damage is done). Let’s look at both of these in depth to see how it handles everything behind the scenes.

In this case, our immortal archer, Shaedu, is wielding a bow with a poisoned arrow. A rat is nearby.

rat1

First Prototype – Playtesting Results

Last night, I had the opportunity to show the latest build to some friends, who are developers themselves. Now usually I take pity on any poor soul who has the misfortune of asking a developer to playtest his or her game–but I have to say how impressed I was with their restraint; all three simply offered feedback from a player’s perspective, and didn’t rework the design of the game from the ground up, like I have a tendency to do.

My friends shall remain anonymous here, since I didn’t ask permission to use their real names in this post, and these days, one can never be too cautious about this sort of thing.

The one who played the longest actually took the time to clear the entire floor of monsters (which took about 15 minutes). He said he was compelled to do this because

  1. He likes to completely clear games out of principle
  2. The rats were so repulsive he felt the need to exterminate them to extinction

It made me realize one of the things the prototype is sorely lacking: state changes on the in-game map, to show which rooms have been discovered and cleared. It also made me think a bit about rewards for clearing an entire region–maybe this is how you get the boss to appear, or maybe a special NPC (like a merchant) appears only once the realm is free of monsters. Or I could go full Captain Eo style, and have the boss turn into a friendly NPC after you break the corruption within him. (Bonk’s Adventure did this too, now that I think about it.)

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.