Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(3 edits) (+1)

It’s been about a month, so I think it’s time for another update! Unfortunately I didn’t get as much done as I wanted this month, because I developed carpal tunnel syndrome early on and went on hiatus for few weeks in order to recover. I’m starting to feel better so development has resumed at a very slow pace, but obviously I didn’t finish everything I was planning on. For now I’m just taking my time, better to work slowly for a while than to jump back in and have to stop entirely.

However, before all that happened I did get some things done. let’s take a look!

A Big AI Revamp

In the original demo video at this start of this thread, the enemies don’t have AI so much as a list of moves that they randomly select from. That may be enough for a very simple encounters, but for boss fights and more complex enemies there needs to be something more complex. So, I added 3 new features to accommodate that:

Behavior Trees

The first thing I added was a simple behavior tree system. It supports a small set of useful patterns, like conditional branches and performing actions in sequence over the course of multiple turns. I don’t want to load this post with too many details, so instead here are a few examples showcasing the kind of flexibility I have:

Attack pattern: Alternate between attacking and using a random special attack

ai.sequence {
    "fight.lua",
    ai.shuffle {
        "special_attack_1.lua",
        "special_attack_2.lua",
    },
}

Attack pattern: Perform special attacks in order, randomly interspersing the pattern with regular attacks

ai.shuffle {
    "fight.lua",
    ai.sequence {
        "special_attack_1.lua",
        "special_attack_2.lua",
    },
}

Attack pattern: Randomly select a regular or special attack. When health gets low, change to a different special attack

ai.shuffle {
    "fight.lua",
    ai.condition (low_hp,
        "special_attack_1.lua",
        "special_attack_2.lua",
    ),
}

This is a good start, but what if we want monsters to use attacks in response to what the player’s doing?

Reactions

Reactions are special behavior trees that sit separate from the monster’s main AI. These allow the monster to immediately respond when a hit with an attack or when the monster dies. It’s not uncommon to have counters and revenge moves in turn-based games, so I felt it would be useful to make the system available to any actor in a fight. In theory this can also work for party members, though right now it’s only being used for monsters.

Unlike regular moves, reactions are called immediately after the attack resolves and any attack that comes from them takes priority over anything that was already queued. They also only trigger if the original attack that caused them wasn’t a reaction… mostly to avoid the possibility of two actors reacting to each other forever.

Anyway, these are nice but you don’t usually want them all the time… Usually you want counters to come with characters changing their stance or form to indicate that attacking is a bad idea. This could be accomplished using status effects, but I elected not to do that because it could be a mess to manage. I also could’ve used the old-school RPG trick of replacing a character with a different one and copying over certain stats, but historically that trick has caused a lot of bugs in various games. So insteaaaad…

States

…I added states. States are very simple, they’re basically a set of overrides for character properties like their appearance, stats, AI, etc. When a state change is triggered, the actor refreshes its properties and takes any values in the state over those in the base stat-block. That way, the monster stays the same and only replaces the values that need to change. It also means that if I add new features to monsters, states can automatically take advantage of them.

With all that in place, I’m able to produce some fairly complex interactions and strategies for the AI. Nothing on the level of what you’d need to mimic a human opponent, but enough to present interesting and unique challenges to the player. And that’s exactly what I want!

The New FX System

One more thing that I started prior to my health issues was an FX system for the game. I want to accomplish more than what simple pre-rendered effects can give me, so I set up a more concrete system with various forms of animation, tweens, and particle effects. In the long term I also want the ability to assign customs shaders to parts of effects and fullscreen post-processing as well, but I’m not there yet!

Right now I’m only using the initial version of the system for attacks attack animations in combat, but eventually I’ll be using it on the map in cutscenes and pretty much anywhere I need it. I also want to add a way to integrate existing values and objects in a scene into FX to allow for things like a projectile that moves from one object to another, or a particle effect that accompanies a certain sprite animation. I also really need to make some kind of editor for these, as the animation data can get really complex and verbose. But again, health issues… we’ll get there eventually.

Putting it Together

To demonstrate of what I discussed above, here’s a little video:

This is the same mimic fight from the first post, but with AI adjustments and combat effects. It plays out a little bit like a typical 1st boss of a Final Fantasy game–it sometimes closes its box, and counters with a powerful attack if disturbed. You can also see a status effect in this video, poison. I don’t remember if I mentioned adding support for those in the past, but they exist.