Conflict0: Revolution is a turn-based strategy game where you join the forces with Sovereigns to march into “Plaza de La Libertad” and remove the corruption, getting into the fight by foot or piloting armed robots. Available for platforms Tizen and Android, it can be downloaded free.
Conflict0: Revolution is available for Tizen and Android devices for free.
In the beginning, we tried to answer two main questions: Which technique could be used by the agent model in order to give it a more fluid way of thinking? How to implement it within Unity and make it modular? (We were in prototyping phase and changes would always be welcome).
Firstly we tried to observe through a prototype (cardboard made by the design team) some units would have higher priority roles/actions due to their class, for example, a healer would prefer to cure a near ally rather than attack an enemy, or enter in an Auto (if it is empty and close to him), it could even be intimidated by other classes and move closer to a stronger ally, since a soldier often prefer to attack the enemy, if he was with too low hp could walk close to a healer, or protect himself inside an Auto.
Healer moving to restore ally health.
We then decided to go with utility theory, realizing that information such as hp, distance and area of movement could be used as utility meters to model which actions should be taken by a particular unit. (If you don't know utility theory I recommend that you access this link which contains awesome information about it)
To answer the second question, we start by creating a component called Intelligence which contains a list of ScriptableObjects of type Decision. Decision contains a weight and a list of ScriptableObjects of type Consideration. Each consideration contains a utility function that tells you how important it is in that particular state of the game.The higher the utility, the higher the final decision average, and the higher the chance of being chosen by the Intelligence component.
Class diagram with relationship among Intelligence, Decision and Consideration.
For example, the attack decision may have the following considerations:
- IsEnemy - Filters the list of units passed by the Decision class, if it does not exist, its utility is downloaded and the class Decision that contains it will have little chance of being executed
- IsInRange - Checks the filtered list has someone in range interaction, if it exists, filters the list with these units and returns the value of the utility function
- IsInMove - Checks the filtered list has someone in the range of the move, if it exists, filters the list with these units and returns the value of the utility function
And so it goes on until all the decisions are evaluated, there are also cases in which if a consideration returns a value very close to zero the decision is interrupted and goes to the next one. At the end, the decision with greater weight is selected and executed, the target will be the first unit in the list.
The inspector of the Decision class in Unity, we can create new Decision adding or removing considerations. Realize that in some cases, changing the order of execution, we change the order of filtered units
Through the utility function, we can tell which decision has the greatest weight for a particular game state, making units with different classes having functions with different utilities, transforming data such as distance, hp, position, etc. into actions of fear, caution or bravery.