Combat System Modularity


Hello! I'm Noodle, the guy who writes the devblogs and also the main programmer / developer in our project. I handle all the functionality in our game. This is a quick post I said I would make in our latest devblog about the combat system, specifically on its modularity. I want to first of all preface that this combat system has been in development for probably close to a year now, and I was thankfully able to port it into Chimera as it fit our needs for the game.

Before I rant about how I made this system far more modular I want to quickly give a huge shout out to Lawless Games. Lawless Games is an Irish youtuber who developed a system for tactics style gameplay similar to games like Fire Emblem for Unity. The foundation for this combat system was originally built based on Lawless Games tactics toolkit that I recreated (after purchasing and reviewing the code) and altered to suit my own needs. If you are interested in making a similar system yourself go and check out all of his stuff. Here is a quick link to his YouTube channel. The system used in our game has been greatly altered, but much of the foundations is based on the incredible systems he made.

Now, for the modularity I recently added. I am sure there are better designs out there and if you know any PLEASE let me know I would love to learn new programming techniques. In our game, Combat is an extremely complex system involving multiple different scripts and objects. Attempting to have all of these objects find and interact with other scripts manually would cause a huge issue for keeping the project organized. Instead, the combat system uses Unity Events to translate any action taken in the combat system. When combat starts, an event is called that any script can subscribe to, and run code based on that event. Want to attack an enemy unit in a fight, a signal is sent out globally, which the combat handler listens to and then sends new signals to the unit being attacked since it keeps track of the fight. 

You might be seeing where I am going with this. Since it sends out all of these signals globally, creating and adding a new script that listens for that signal is extremely simple. Every combat has a name. A string value that acts as the combat encounters title. When starting combat, a signal including this combats name is sent out. Whenever we want to have unique interactions happen during a specific fight, such as only allowing the player to press the attack button during the tutorial for example, then we can setup another script that listens for the start of the players turn. It only listens to this event, when it hears a combat start with the string value of "Tutorial_Combat". This customization allows us to create so many unique events and interactions within the combat system without having to develop a new version of the system that meets the specific unique requirements of this fight.

Alright, well, that is basically it haha. I have no idea how to end this post. Please ask questions if you have them.

Bye for now I guess!!!

Get Chimera

Leave a comment

Log in with itch.io to leave a comment.