Difference between revisions of "Basics"

From Gladiabots Wiki
Jump to: navigation, search
(Moving targets having reached their destination are still detected as moving.)
(48 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
== Basics ==
 +
 +
''Gladiabots'' is a game between two players the {{Tooltip|blue|In training and campaign one may only play as team blue.}} and the {{Tooltip|red|In career and sandbox one can also play as team red.}} team. Both players assign bot classes and programs to each bot starting position of their team. Once they deploy their settings for a match it all depends on their robots and the programs to win the match by destroying enemy bots or by capturing resources.
 +
 
== Maps ==
 
== Maps ==
  
Each map contains one or more bot starting positions for each team. Optionally maps can contain team bases and resources. Normally the same amount of bot starting positions and team bases are used for each team and the map objects have usually [https://en.wikipedia.org/wiki/Reflection_symmetry reflectional] or [https://en.wikipedia.org/wiki/Rotational_symmetry rotational] symmetry. Two starting positions or team bases that are symmetric belong to different teams. There exists an instantiation order for the bot starting positions rarely used in the game[https://forum.gladiabots.com/viewtopic.php?f=7&t=221]. Only a subset of all maps is used for ranked multiplayer.
+
[[Image:Map set your priorities.png|thumb|Best score map: Set your priorities]]
 +
 
 +
Each [[Maps|map]] contains one or more bot starting positions for each team. Optionally maps can contain team bases and resources. Normally the same amount of bot starting positions and team bases are used for each team and the map objects have usually [https://en.wikipedia.org/wiki/Reflection_symmetry reflectional] or [https://en.wikipedia.org/wiki/Rotational_symmetry rotational] symmetry. Two starting positions or team bases that are symmetric belong to different teams. There exists an [[Maps#Instantiation_order|instantiation order]] for the bot starting positions rarely used in the game.
 +
 
 +
Each map has a size of 50x50 meters. If a bot touches the borders of a map, it will explode.
 +
 
 +
Only a [[Maps | subset of all maps]] is used for each league and for unranked games in career as well as for sandbox mode.
  
 
== Game modes ==
 
== Game modes ==
Line 7: Line 17:
 
=== Elimination ===
 
=== Elimination ===
  
The objective is to destroy more bots from the other team within the time limit. Bots can be destroyed by shooting them until they lost their shield and health or pushing them to the map borders. A game is evaluated as a draw if no team could destroy more bots after the time limit. The shield or health state of bots is not relevant to this objective.
+
The objective is to destroy more bots than the other team within the time limit. Bots can be destroyed by shooting them until they lost their shield and health or by pushing them to the map borders. A game is evaluated as a draw if no team could destroy more bots than the other team after the time limit. The shield or health state of bots is not relevant to this objective.
 +
 
 +
=== Best score ===
 +
 
 +
The objective is to gather more resources than the other team within the time limit. Resources can be gathered by picking them up and moving them to an allied base. A game is evaluated as a draw if no team could gather more resources than the other team after the time limit. Neither the shield or health state of bots nor the count of remaining bots is relevant to this objective.
 +
 
 +
== Bot actions ==
 +
 
 +
During each second, there are 4 cycles (or ticks) where the bot decides its next action. Once the bot has decided its action, it will execute this action for the entire duration of the tick. In every tick the bot can decide whether or not to:
 +
 
 +
* attack an enemy
 +
* move towards an {{Tooltip|object|Ally, enemy, resource, ally base, enemy base}}
 +
* flee from an {{Tooltip|object|Ally, enemy, resource, ally base, enemy base}}
 +
* {{Tooltip|catch a resource|The bot will automatically move to the resource, if it is out of catching range: 0.5 meters }} (or pick up a resource)
 +
* drop a resource
 +
* secure a resource (or score a resource) to an ally base
 +
* [[Tags and team tags|tag or team tag]] an {{Tooltip|object|Myself, ally, enemy, resource, ally base, enemy base}}
 +
* [[Tags and team tags|untag or team untag]] an {{Tooltip|object|Myself, ally, enemy, resource, ally base, enemy base}}
 +
* or even decide to do nothing
 +
 
 +
=== Detecting bot actions and edge cases ===
 +
 
 +
Outside of a few edge cases, a bot can detect and use the action another bot or itself was doing in the previous tick to make its decision. However, there are some edge cases that doesn't follow the conventional logic of the actions: (whether it is detecting actions or executing them)
 +
 
 +
* In the very first tick of the game all bots are detected as idling.
 +
* If a bot is moving to an object that it can reach within the current tick, it will move there and idle for the rest of the tick. This action will still be detected as moving, even if the unit has already started the tick at the destination and does not move at all.
 +
* The closest 2 bots can get to each other is restricted by the collision model. The collision model of a bot is a circle with a radius of 0.3 meters for Assault, Shotgun and Sniper and 0.4 meters for Machinegun.
 +
** If one bot moves to another bot and touches it, it will not push the other bot. It will be detected as idle by other bots.
 +
** If one bot tries to pass another bot at a very small distance, the two bots will collide and get pushed away from each other.
 +
* If a bot is catching a resource, it will move to that resource until it is within the range where it then picks up the resource and goes into idle. While moving to the resource, it will be detected as moving to the resource. However, on the tick that it picks up the resource, it will be detected as idle unless it picks up the resource at the very end of a tick.
 +
* Securing a resource follows similar rules to catching a resource, with the difference being that it moves to the base instead of a resource. Also, a bot will refuse to secure a resource if it doesn't have a resource picked up already.
 +
* Both catching and securing a resource can be done 0.5 meters away from the resource or base.
 +
* If bots from different teams are close enough to pick up the same resource and try to do so, neither one will do so, and they will idle instead.
 +
** If several bots from the same team try to pick up the same resource the [[Maps#Instantiation_order|instantiation order]] defines who takes it. If a bot cannot pick up the resource it idles instead.
 +
* The actions dropping a resource or tagging an object don't have their own action to detect, and simply are detected as idle.
 +
* Both aiming and attacking are detected as attacking. There is no way to detect the difference.
 +
 
 +
== Shooting process ==
 +
 
 +
When shooting a bot is able to hit another bot up to a distance of 15 meters. This distance is divided in short range (up to 3 meters), medium range (3 to 8 meters) and long range (8 to 15 meters). Although the bot classes have very different shooting behavior, they all share the same shooting process:
  
=== Best Score ===
+
# The bot will start aiming for the time of their [[Bot_classes#Shooting_stats|aiming duration]].
 +
# They will fire a bullet or group of bullets according to the [[Bot_classes#Shooting_stats|bullet configuration]].
 +
#* Each bullet will either hit with the [[Bot_classes#Shooting_stats|attack power]] or miss completely according to the ''precision''.
 +
#** The bots <code>precision counter</code> will increment by its precision value. The [[Bot_classes#Shooting_stats|precision value]] is determined by what range the target is in at the moment the bullet is fired. There is no difference in the precision value if the target is in the close or further away area of a range. For example targets with a distance of 3.5 and 7.5 meters are both evaluated as mid range. If the target is out of range, the precision value is 0.
 +
#** If the <code>precision counter</code> is greater or equal to 100 the bullet will hit and the <code>precision counter</code> will be decremented by 100. Otherwise the bullet will miss.
 +
#* If bullets are shot exactly at the beginning of a tick, then the AI evaluation is postponed until the bullets are fired.
 +
#* If they have another shot to take during the attack cycle, they will then wait for the [[Bot_classes#Shooting_stats|time between shots]] and repeat step 2. The total time spent shooting all bullets is the [[Bot_classes#Shooting_stats|attack duration]].
 +
# continue with 1.
  
The objective is to gather more resources than the other team within the time limit. Resources can be gathered by picking them up and moving them to an allied base. A game is evaluated as a draw if no team could gather more resources after the time limit. Neither the shield or health state of bots nor the count of remaining bots is relevant to this objective.
+
At the start of a match the <code>precision counter</code> for every bot is 0. There is no reset of the <code>precision counter</code> if there is a target switch or if the shooting process is interrupted.
  
== Time and Space ==
+
Bullets travel through the air with a speed of 40 meters per second.
  
Each map has a size of 50x50 units. Each bot can shoot another bot up to the distance of 15 units. This distance is divided in short range (up to 3 units), medium range (3 to 8 units) and long range (8 to 15 units).
+
=== Sniper misses ===
  
Each second of the game time is divided in 4 ticks each with a duration of 250 milliseconds. At the beginning of a tick each bot uses its program to ''think'' what the next action should be. Then it executes this action for the duration of the tick. As the current time limit is 5 minutes in normal speed, the whole game lasts 1200 ticks.
+
[[Image:Tick timing.png|thumb|Tick and bullet timing]]
  
== Bot Actions ==
+
The bot class Sniper has an accuracy of 100% for short, mid and long range. Bullet accuracy is computed at the moment it is shot so movement of the target after the shot is fired won't change the result. But it can still happen, that a Sniper never shooting out of range [https://forum.gladiabots.com/viewtopic.php?f=8&t=545 misses it's target]. The reason is that bots check the AI only at the beginning of the ticks. However bullets can be fired at the mid or end of a tick.
  
What happens in detail if a bot performs a given action:
+
Example:
 +
* Sniper attacks (or aims at) a Shotgun for 11 ticks.
 +
* At the beginning of tick 12 the Shotgun is at a range of 14.8 meters.
 +
** Sniper checks it's AI: As the target is still in long range the Sniper continues the attack.
 +
* At the end of tick 12 the Shotgun moved out of range to 15.3 meters.
 +
** The Sniper shoots, but as the target is out of range he misses.
  
* Attacking
+
This also affects other bot classes but is most noticeable for the Sniper.
** If a bot '''attacks''' another bot it aims or attacks for the whole tick. This action will be detected as '''attacking''' in the next tick.
+
* Moving and fleeing
+
** If a bot '''moves''' to a target location that is '''within the range''' accessible by the current tick, then it moves there and idles for the rest of the tick. This action will be detected as '''idling''' in the next tick.
+
** If a bot '''moves''' to a target location that is '''out of the range''' accessible by the current tick, then it moves as far as it could in the current tick. This action will be detected as '''moving''' in the next tick.
+
** If a bot '''flees''', then it flees as far as it could in the current tick. If the bot leaves the map by fleeing it will explode. This action will be detected as '''fleeing''' in the next tick.
+
** If two bots come to close to each other when one or both of them are moving or fleeing, they collide and get pushed away from each other.
+
* Catch resource, secure resource, drop resource
+
** If a bot '''catches a resource''' that is '''within the range''' accessible by the current tick, then it moves there, picks up the resource and idles for the rest of the tick. This action will be detected as '''idling''' in the next tick.
+
** If a bot '''catches a resource''' that is '''out of the range''' accessible by the current tick, then it moves as far as it could in the current tick. This action will be detected as '''moving to a resource''' in the next tick.
+
** If a bot '''secures a resource''' to a base that is '''within the range''' accessible by the current tick, then it moves there, scores the resource and idles for the rest of the tick. This action will be detected as '''idling''' in the next tick.
+
** If a bot '''secures a resource''' to a base that is '''out of the range''' accessible by the current tick, then it moves as far as it could in the current tick. This action will be detected as '''moving to base''' in the next tick.
+
** If a bot '''drops a resource''' doesn't move for the whole tick. This action will be detected as '''idling''' in the next tick.
+
* Idle, tag, team tag
+
** If a bot '''idles, tags or team tags''' it doesn't move for the whole tick. This action will be detected as '''idling''' in the next tick.
+
  
== Rough thoughts ==
+
== Health, shield and regeneration ==
  
2 bots want to pick up the same resource in the very same tick - what happens?<br>
+
Based on the bot class all bots have a certain amount of [[Bot_classes#Health.2C_shield_and_regeneration|health]] and [[Bot_classes#Health.2C_shield_and_regeneration|shield]]. The shield absorbs damage before you take any damage to your health, and can regenerate after the bot isn't damaged for over 3 seconds. Any damage taken to your health is permanent. A fully destroyed shield regenerates in 3 seconds for any bot.
Collision size of bots<br>
+
What is the distance a resource can be taken already? Requires testing (or ask gfx)<br>
+
Move speed<br>
+
<br>
+
There should be a different section for this:<br>
+
<br>
+
Attack damage algorithm & Cooldown for recharging shield time to recharge shield.<br>
+

Revision as of 18:35, 16 August 2018

Basics

Gladiabots is a game between two players the blue and the red team. Both players assign bot classes and programs to each bot starting position of their team. Once they deploy their settings for a match it all depends on their robots and the programs to win the match by destroying enemy bots or by capturing resources.

Maps

Best score map: Set your priorities

Each map contains one or more bot starting positions for each team. Optionally maps can contain team bases and resources. Normally the same amount of bot starting positions and team bases are used for each team and the map objects have usually reflectional or rotational symmetry. Two starting positions or team bases that are symmetric belong to different teams. There exists an instantiation order for the bot starting positions rarely used in the game.

Each map has a size of 50x50 meters. If a bot touches the borders of a map, it will explode.

Only a subset of all maps is used for each league and for unranked games in career as well as for sandbox mode.

Game modes

Elimination

The objective is to destroy more bots than the other team within the time limit. Bots can be destroyed by shooting them until they lost their shield and health or by pushing them to the map borders. A game is evaluated as a draw if no team could destroy more bots than the other team after the time limit. The shield or health state of bots is not relevant to this objective.

Best score

The objective is to gather more resources than the other team within the time limit. Resources can be gathered by picking them up and moving them to an allied base. A game is evaluated as a draw if no team could gather more resources than the other team after the time limit. Neither the shield or health state of bots nor the count of remaining bots is relevant to this objective.

Bot actions

During each second, there are 4 cycles (or ticks) where the bot decides its next action. Once the bot has decided its action, it will execute this action for the entire duration of the tick. In every tick the bot can decide whether or not to:

  • attack an enemy
  • move towards an object
  • flee from an object
  • catch a resource (or pick up a resource)
  • drop a resource
  • secure a resource (or score a resource) to an ally base
  • tag or team tag an object
  • untag or team untag an object
  • or even decide to do nothing

Detecting bot actions and edge cases

Outside of a few edge cases, a bot can detect and use the action another bot or itself was doing in the previous tick to make its decision. However, there are some edge cases that doesn't follow the conventional logic of the actions: (whether it is detecting actions or executing them)

  • In the very first tick of the game all bots are detected as idling.
  • If a bot is moving to an object that it can reach within the current tick, it will move there and idle for the rest of the tick. This action will still be detected as moving, even if the unit has already started the tick at the destination and does not move at all.
  • The closest 2 bots can get to each other is restricted by the collision model. The collision model of a bot is a circle with a radius of 0.3 meters for Assault, Shotgun and Sniper and 0.4 meters for Machinegun.
    • If one bot moves to another bot and touches it, it will not push the other bot. It will be detected as idle by other bots.
    • If one bot tries to pass another bot at a very small distance, the two bots will collide and get pushed away from each other.
  • If a bot is catching a resource, it will move to that resource until it is within the range where it then picks up the resource and goes into idle. While moving to the resource, it will be detected as moving to the resource. However, on the tick that it picks up the resource, it will be detected as idle unless it picks up the resource at the very end of a tick.
  • Securing a resource follows similar rules to catching a resource, with the difference being that it moves to the base instead of a resource. Also, a bot will refuse to secure a resource if it doesn't have a resource picked up already.
  • Both catching and securing a resource can be done 0.5 meters away from the resource or base.
  • If bots from different teams are close enough to pick up the same resource and try to do so, neither one will do so, and they will idle instead.
    • If several bots from the same team try to pick up the same resource the instantiation order defines who takes it. If a bot cannot pick up the resource it idles instead.
  • The actions dropping a resource or tagging an object don't have their own action to detect, and simply are detected as idle.
  • Both aiming and attacking are detected as attacking. There is no way to detect the difference.

Shooting process

When shooting a bot is able to hit another bot up to a distance of 15 meters. This distance is divided in short range (up to 3 meters), medium range (3 to 8 meters) and long range (8 to 15 meters). Although the bot classes have very different shooting behavior, they all share the same shooting process:

  1. The bot will start aiming for the time of their aiming duration.
  2. They will fire a bullet or group of bullets according to the bullet configuration.
    • Each bullet will either hit with the attack power or miss completely according to the precision.
      • The bots precision counter will increment by its precision value. The precision value is determined by what range the target is in at the moment the bullet is fired. There is no difference in the precision value if the target is in the close or further away area of a range. For example targets with a distance of 3.5 and 7.5 meters are both evaluated as mid range. If the target is out of range, the precision value is 0.
      • If the precision counter is greater or equal to 100 the bullet will hit and the precision counter will be decremented by 100. Otherwise the bullet will miss.
    • If bullets are shot exactly at the beginning of a tick, then the AI evaluation is postponed until the bullets are fired.
    • If they have another shot to take during the attack cycle, they will then wait for the time between shots and repeat step 2. The total time spent shooting all bullets is the attack duration.
  3. continue with 1.

At the start of a match the precision counter for every bot is 0. There is no reset of the precision counter if there is a target switch or if the shooting process is interrupted.

Bullets travel through the air with a speed of 40 meters per second.

Sniper misses

Tick and bullet timing

The bot class Sniper has an accuracy of 100% for short, mid and long range. Bullet accuracy is computed at the moment it is shot so movement of the target after the shot is fired won't change the result. But it can still happen, that a Sniper never shooting out of range misses it's target. The reason is that bots check the AI only at the beginning of the ticks. However bullets can be fired at the mid or end of a tick.

Example:

  • Sniper attacks (or aims at) a Shotgun for 11 ticks.
  • At the beginning of tick 12 the Shotgun is at a range of 14.8 meters.
    • Sniper checks it's AI: As the target is still in long range the Sniper continues the attack.
  • At the end of tick 12 the Shotgun moved out of range to 15.3 meters.
    • The Sniper shoots, but as the target is out of range he misses.

This also affects other bot classes but is most noticeable for the Sniper.

Health, shield and regeneration

Based on the bot class all bots have a certain amount of health and shield. The shield absorbs damage before you take any damage to your health, and can regenerate after the bot isn't damaged for over 3 seconds. Any damage taken to your health is permanent. A fully destroyed shield regenerates in 3 seconds for any bot.