itch.io is community of indie game creators and players

Devlogs

Big Backend [B]improvements

Blog
A downloadable Blog

This is a programming post. If you don't have any interest in that, feel free to skip this one! I should have some new gameplay to show sometime next week.

A lot of major changes have been made to the game over the last few days, but it's mostly invisible changes. There are some things that are visible, but they're a bit too subtle to come across over video, so I'm not gonna bother recording anything this time. Instead I'm gonna discuss some technical stuff.

Auto battlers can get really mechanically complex, and it is imperative that individual actions are given their own time to breath. That can be difficult if one action could cause many reactions, and many of those reactions could cause even more reactions. If you look at an auto-battle in Hearthstone Battlegrounds, a thing you might notice is the pauses between actions. Everything is enunciated clearly, and actions are rarely overlapping with one another.

This can be a tricky thing to get right! If you have abilities that can trigger before an attack, during an attack, after an attack, when something is damaged, when something *else* is damaged, when something dies, things can get very messy and it can be hard to properly allocate time and space for everything without your codebase becoming a rats nest.

My solution to this is called Agendas, which you can download from my github if you're a GameMaker user. In layman's speak, an Agenda is a todo list. When all todos are completed, the Agenda is finished. Agendas can be chained together, so when one Agenda finished, the next one in the chain starts. It's a really powerful way to sequence events with real time animations. 

To further explain why this is useful, here's an example. In the card game, there's a card that says "Before attacking, deal 3 damage." What this means is, when this minion starts to attack an enemy, it will first deal 3 damage to that enemy, and only continue with the attack if it's still alive. There's another enemy with a similar effect: "Before attacking, steal 1 attack." Which steals 1 attack point from the minion its attacking. These abilities trigger at the same point in the standard minion attack sequence, but their animations take different amounts of time! With Agendas, I can pass a todo into these abilities, and only move on to the next Agenda in the chain when the Todo completes. This even works if an ability triggers another ability, like if "deal 3 damage" hits an enemy with an ability that activates when they take damage.

Anyway, I'm quite pleased with this system. If you use GameMaker and this sounds like something you'd like to use, there's an example project in the latest release on github which shows Agendas in action. I'm also happy to provide support to anyone that chooses to use them.

Read comments (3)