The game


War of Tanks is a survival team game in which each team has a set of tanks. The last team standing is the winner. The main goal of each team is to destroy all enemy tanks and survive. Each tank has three main parameters which determine its level of vulnerability:

  • Health.It is a real number between 0 and 100. Each time a tank is shot, it loses some health. When the health value reaches 0, the tank is destroyed.
  • Power.It is a real number between 0 and 100. Each time a tank executes an action, it consumes some power. The tank cannot execute actions if its Power is 0.
  • Ammo.It is an integer number between 0 and 100 that indicates the number of cannon bullets. Each time a tank shoots, it consumes a bullet. When the tank runs out of bullets it cannot shoot anymore. Reloading is not possible.

Every time unit (e.g., every second) each tank decides the action to perform based on its current situation (enemy and ally tanks positions, health level, available ammunition, and power left), and motivation (a tank can use either a defensive or an aggressive strategy). The possible actions are:

  • Escape.It moves in the opposite direction of the closest enemy tank, to get out of its shooting range.
  • Shoot.It shoots at the closest enemy tank.
  • Chase enemy.It moves towards the closest enemy tank to get it into the shooting range.
  • Join ally.It moves towards the closest ally tank.
  • Stop.It stops in order to save power.

Model of the game


The model for the War of Tanks game is shown below. Its main elements are the following:


Time simulation
  • Class Clock is used to simulate the passage of time in the game. Its attribute “now” stores the current time in seconds using the POSIX format. Time advances “betweenTickLapse” seconds in each execution of the function tick(). The function run() invokes tick() one hundred times.
  • Abstract class Active Object declares the operation action() which is invoked in each execution of the function tick(). Every object which inherits from this class makes an action in every tick of the Clock. In our case, each tank will make a decision in every tick.
Tanks

Class Tank represents the playing tanks. Each object stores the tank's position (xPos, yPos), its team and its vulnerability parameters (power, health, ammo).

Some additional parameters worth mentioning include:

  • powerConsumption. Each time a tank executes an action, it consumes an amount of power equivalent to the value of this parameter. Shooting costs twice as much.
  • maxDamage. The maximum amount of health that a shot can take.
  • visionRadius. Tanks can only detect other tanks if they are located within this range.
  • range. This is the shooting range. Tanks can only shoot enemy tanks within this range.
  • drift. When a tank shoots, the probability to fail increases in proportion with this parameter.
  • angle. This is the angle (in radians) that defines the direction in which the tank moves.
  • speed. The speed at which the tank moves.
  • vulnerability and vulnerabilityBound. These parameters determine the vulnerability state of the tank. They are further explained in the Behaviour section below.
Behaviour

Class Behaviour stores and gathers the data required in the decision-making process.

The tank behaviour depends on several factors. The first one of the vulnerability level of the tank: Low Vulnerability or High Vulnerability. Such a level depends on the value of attribute “vulnerability”, which is calculated by adding a third of the values of power, health, and ammo. Depending on whether such a value exceeds that of attribute “vulnerabilityBound” or not, the state of the tank will be “Low Vulnerability” or “High Vulnerability”.

In addition to the current vulnerability, two main forces influence the tank’s decisions about the next action to carry out: the Situational context and the Motivational force.

  • Situational Context. It defines the situation in which the tank is, given the allies and enemies surrounding it and its vulnerability level. The following table shows the probabilities associated with each possible action of a Tank in each vulnerability state.


  • Motivational Force. It defines the motivations of a tank in its decision-making process, sorting them according to their utility in the tank’s strategy. Some tanks will play aggressively and try to destroy all enemy tanks in its shooting range (Bold) while others will play defensively and simply try to survive (Cautious). The following table shows the weights assigned to the possible tank actions depending on its strategy.


Simulation parameters

Class Simulation Parameters declares two attributes which are used to deal with uncertainty in the simulation.

  • The attribute precision is the initial measurement uncertainty of UReal attributes in the system. For example, the initial positions of the Tanks have a certain amount of uncertainty which depends on the precision of the measurement tools used to provide the data.
  • The attribute truthThreshold is the minimum confidence that UBoolean values must have to be considered true in our model.

Scenarios


The following HTML files contain the traces of various battle simulations. They are represented using a 3D chart, where the X and Y axis represent the planar coordinates of the tanks in the battlefield, and the Z axis represents time. Tanks are displayed as coloured big dots. Thus, a tank that does not move will be represented by a vertical dotted line. In the charts, if you hover over each of the tanks’ positions, the attributes involved in the decision-making process are displayed.

Two-tanks scenarios

The following four scenarios represent a situation with only two tanks, t1 (blue dot) and t2 (red dot).

Scenario 1 (two bold tanks in shooting range)

Both tanks are in Low Vulnerability state and in Situational Context C3, i.e. enemy in shooting range and no allies detected. These tanks have a bold personality, so they have an aggressive strategy. They start shooting at each other, and t2 is destroyed after three shots.

Interactive 3D chart.

Scenario 2 (two cautious tanks in shooting range)

Both tanks are in Low Vulnerability state and in Situational Context C3, i.e. enemy in shooting range and no allies detected. These tanks have a cautious personality, so they have a defensive strategy. Therefore, once the simulation starts they escape from each other until they get outside their respective vision ranges, and then stop.

Interactive 3D chart.

Scenario 3 (one cautious and one bold tank in shooting range)

Both tanks are in a Low Vulnerability state and in Situational Context C3, i.e., enemy in shooting range and no allies detected. Tank t2 has a cautious personality, and tank t1 has an aggressive personality.

The simulation starts. Tank t2 starts moving away from t1. Tank t1 shoots twice while t2 is still inside shooting range. Once tank t2 leaves t1’s shooting range, t1’s Situational Context becomes C2, and it decides to escape from t2.

Interactive 3D chart.

Scenario 4 (bold tank high vulnerability and one cautious tank in shooting range)

Tank t1 is in a High Vulnerability state and in Situational Context C3, i.e. enemy in shooting range and no allies detected. Tank t2 is in a Low Vulnerability state and the same Situational Context. Tank t1 has a bold personality, while t2 is cautious.

The simulation starts. Tank t1 shoots twice at t2, which starts escaping. Tank t1 chases t2 when t2 gets out of its shooting range. After three time units, t2 is out of t1’s vision range, and both tanks decide to stop.

Interactive 3D chart.

Multiple tanks scenarios

In the following three scenarios two teams with two tanks each decide to fight.

Team 0:

  • Tank t00 (purple dot)
  • Tank t01 (red dot)

Team 1:

  • Tank t10 (blue dot)
  • Tank t11 (green dot)
Scenario 1 (four bold tanks in shooting range)

The four tanks are in a Low Vulnerability state and have a bold personality, which means that they follow aggressive strategies. Tank t11 is unable to detect its ally tank since it is outside its vision range. Therefore, it is in Situational Context C7, i.e. in minority with enemies in shooting range. The other three tanks are in Situational Context C9, i.e. they are in superiority according to their vision range.

The simulation starts. Tank t10 starts shooting at tank t00. After three shots, t00 destroys t10 and decides to join its ally t01. Meanwhile, t01 is shooting at t11. Tank t11 escapes, and after increasing the distance with t01, it also starts shooting. After three shots, t00 joins the shooting, and team 0 takes down team 1.

Interactive 3D chart.

Scenario 2 (two bold tanks following a cautious highly vulnerable tank)

The two tanks in team 0 are in a Low Vulnerability state and have a bold personality. Tank t10 is in a High Vulnerability state and have a cautious personality. Tank t10 is in Situational Context C3, i.e., no allies detected and enemies in shooting range. The other tanks are in Situational Context C8, i.e., they are in superiority and have allies in their vision range.

The simulation starts. Team 0 starts chasing tank t10. After eight time units, t10 is in their shooting range. Team 0 tanks shoot at it and tank t10 is destroyed.

Interactive 3D chart.

Scenario 3 (multiple repositioning)

Team 0 has a bold personality. Team 1 has a cautious personality. Tank 10 is in a Highly Vulnerable state. Team 0 strategy will be more aggressive, while team 1 will try to escape and survive at all costs.

The simulation starts. Depending on the Situational Context, the tanks will decide to chase enemies, escape, or join an ally. After some time-units, tank t11 is destroyed and t10 escapes to a position out of the other team’s vision radius.

Interactive 3D chart.

Source files


The source files for the full model and some of the execution scripts for the scenarios, are available in our Github.