Ai archetypes.json

From Halfway
Jump to: navigation, search


The AI of Halfway can be split up in 6 different types:

  1. Standard
  2. Berserker
  3. Tank
  4. Turret
  5. Sniper
  6. Scout

Each has its base behavior you can build upon. In this json this base behavior can be tweaked and defined as "Brains". Currently each AI type has one brain, called "default" but you can add as many new ones as you'd like.

Each brain has to have two sub-brains: One Strong (AI is health, this gets used) and a Weak (AI is wounded (below 25%) now this brain gets used) That allows to define different patterns if an enemy is wounded.


Also in this file , the noise are defined elemets in the game are creating. They are then used to activate the AI and make them follow noises.

Note about noise an visibility:

  • If a AI can't see you, but hears a noise, it will go to that noise an will look what is going on.
  • If a AI it self does not hear anything and can't see you, but another AI agent is hearing/seeing something, the first AI will then follow the second one to help him and see what is going on.
  • Only player are producing noise. AI are muted because this lead to AI chasing AI problems as the game only knows one type of noise and can't say the difference between player produced noise and the one done by the AI. ;)
  • Important;Don't make the noise radius to big as it can lead to stutters and slow downs in the game.

Basic Overview how the AI works

The AI system is working with a heat map to make decisions. The AI can see you, he can hear you and they can talk to each other to give information on where you are.

The heat map goes about 2 turns in the future to decide which places are the best do go and the lowest hit chances.

The consider:

  • How many players can hit me:
    • This turn
    • Next turn
  • How high is the hit chance on this tile
  • How far can I target an player
  • They can use items:
    • Medkits
    • Grenades

Example Standard Brain

   "Standard" : {
     "Brains" : {
       "Default" : {
         "Weak" : {
           "AttackProbability" : 1,
           "DefendProbability" : 1,
           "EnemyHitChanceEvaluationAccuracy" : 0.95,
           "SeekCoverProbability" : 1,
           "MaximumFireDistance" : 12,
           "MinimalAttackHitChance" : 0.1,
           "MinimalTeamMateDistance" : 0,
           "MinimalEnemyDistance" : 3,
           "HitChanceEvaluationAccuracy" : 1,
           "GrenadeThrowProbability" : 0.1,
           "UseMediKitProbability" : 1
         "Strong" : {
           "AttackProbability" : 1,
           "DefendProbability" : 0.5,
           "EnemyHitChanceEvaluationAccuracy" : 1,
           "SeekCoverProbability" : 1,
           "MaximumFireDistance" : 10,
           "MinimalAttackHitChance" : 0.3,
           "MinimalTeamMateDistance" : 0,
           "MinimalEnemyDistance" : 3,
           "HitChanceEvaluationAccuracy" : 1,
           "GrenadeThrowProbability" : 0.1,
           "UseMediKitProbability" : 0.05
     "Behaviour" : {
       "SteppedTurnProbability" : 0

Values Description

This is the short overview of the values that you can change. Please note that AI Brains tweaking is alot of testing and trying out different settings. There is no fast way to make it work.

  • AttackProbability: This defines the probability (0-1) if the AI is going to attack a target if he has:
    • A bullet left in the gun
    • Can see a target and is in range
    • Has an attack left.
  • DefendProbability: Defines the chance if the enemy is going to make retaliate if he wont move or has no attack left.
  • EnemyHitChanceEvaluationAccuracy: How accurate can the AI see the hit chances the player has in the Heatmap.
    • This is like a noise that is applied to the correct values in the heat map. The lower the value here the more random and wrong decision the AI will going to make. (0-1, were as 0 means the values the AI gets are totally random to 1 the AI knows exactly the right values)
  • SeekCoverProbability: This defines how important it is for an AI to seek cover while moving.
    • Low values means the AI ignores the environment and just runs the shortest way to its target.
    • High values means that he will search for cover and if possible go behind on while moving.
  • MaximumFireDistance: Defines the maximum distance in tiles the AI will fire his weapon.
  • MinimalAttackHitChance: This is the minimum hit chance the AI needs to have or else he won't shoot but move in closer. (0-1, Which translates into: 0%-100%)
  • MinimalTeamMateDistance: The distance in tiles the AI will keep from other AIs if possible.
  • MinimalEnemyDistance: The minimum distance the AI tries to keep from the player character if possible.
  • HitChanceEvaluationAccuracy: How accuarate the values are the AI gets for his own hit chances. (Noise for the heat map similar to the EnemyHitChanceEvaluationAccuracy above).
  • GrenadeThrowProbability: If an AI carries a grenade in the backpack, how high is the chance that he will use it.
  • UseMediKitProbability: If the AI carries a Medkit in the backpack, how high is the chance that he is going to use it. It makes sense to have a very low value for the strong brain, because it could happen that he uses it even though he is 100% healthy.