Sponsored By

The process of modeling and developing artificial intelligence for the Conflict0: Revolution

This post talks about a bit of the idealization process and implementation of the artificial intelligence in game Conflict0: Revolution.

Game Developer, Staff

November 26, 2018

4 Min Read
Game Developer logo in a gray background | Game Developer

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.

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 near to a ally to restore his health.

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 between Intelligence, Decision and Consideration.

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

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.

Read more about:

Featured Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like