• Register

Moira is a single-player progression deck builder for Windows PC. The player takes control of a witch that lives and studies in a modern city and needs to find and kill creatures of Portuguese folklore to become more powerful while collecting their remains to combine with stronger cards to be able to hunt even stronger legends and creatures.

Post news Report RSS Devlog #01 - Battle Basics

Welcome to our first devlog! Here we'll explain a bit how our combat system is being developed.

Posted by on

Hey everyone! Welcome to Moira's first Devlog. Here we'll give you updates regarding the current stage of the game's development and some interesting nits and bits regarding some implementations (be it art, code, or design). Since this is the first one, then, we'd like to delve a bit into how we've programmed the battle system.

The battle system in Moira relies on the iterator pattern. In C#, the foreach statement is what allows you to make use of this pattern. If a type implements IEnumerable<T>, it can be iterated over using foreach (see more about iterators in C#).

Furthermore, by writing an iterator method with the yield keyword, you can construct an enumerable sequence with a lot of flexibility-- our combat system uses this, and the battles are then resolved over a series of events. An event could be a card being played, a heal effect being resolved, an enemy attacking or taking damage... Events are taken, one by one, by the game's presentation layer (the graphics and UI) and things on screen are animated accordingly. This approach has the advantage of separating the battle engine and rules from the way the player gets information and communicates their decisions to the game, meaning that the battle logic is separate from the user interface.

Entities doing battle can describe their behaviour using iterator methods. Here's what a simple enemy's turn could look like:

public override IEnumerable<BattleEvent> Act()
{
    battle.Logger.Log(
public override IEnumerable<BattleEvent> Act()
{
    battle.Logger.Log($"{Name} attacks you!");

    yield return new MoveEvent(this);

    DamageEvent ev = battle.Witch.Hurt(new Attack(2, Element, new List<string>()));
    yield return ev;
}
quot;{Name} attacks you!"); yield return new MoveEvent(this); DamageEvent ev = battle.Witch.Hurt(new Attack(2, Element, new List<string>())); yield return ev; }

This iterator method yields two events: a MoveEvent and a DamageEvent. The MoveEvent informs that the entity is performing its move. This can be used by the view to animate the enemy attacking. Then, a DamageEvent specifies that an entity has taken damage. The view can trigger a "hurt" animation and show some damage numbers.

That is just a brief glance on how the combat system works. Of course, there are many more parts to connect here, like how the cards work, how turns are diferentiated, how we do enemy AI, etc... But to not overwhelm anyone, we'll be finishing here for today! In future Devlogs we'll talk more about the battle system as well, but for now have a little peek on how our deck manager's screen is currently looking:

Alright, we'll continue this on the next devlog, then. See you all!

TarotByte Studio


Post comment Comments
KaiSaturn
KaiSaturn - - 16 comments

Congrats on your first devlog! The game is looking pretty nice so far, the art looks really interesting and the overall game's plot sounds really captivating.

Reply Good karma Bad karma+1 vote
oscarfabianleites
oscarfabianleites - - 82 comments

fantastic work! If you need music for the gameplay or to promote the game (trailer), let me know.🤗👌🏻😁🎮🤗🎶
Youtube.com

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: