Initial Prototype


Where the prototype started

The original goal was to get aim for 500 units max,  250 v 250 or even 5 teams of 100. Using neural networks for different layers being, unit, squad and commander. We were playing around fog off warm and lack of knowledge. Each unit will have its set of knowledge and didnt know about anything unless told, heard or seen. 

This was abandoned as I was getting such bad fps problems and optimizations where the big problem. But those optimizations are still there, like spatial grids and events rather then putting everything in the physics calls.

What do we have now?

  • Basic AI loop: perception → decision → action → movement.
  • Basic team spawning and map loading.
  • Added simple pistol/projectile combat.
  • Added health, death and team tracking.
  • Currently a 5v5 which is far more stable
  • Two neural network entries for later, Squad and Unit. (Going to be in V2, as V1 is just making this point fun)
  • If you click on the unit, you can get its knowledge.

Early AI / perception work

  • Added vision range and field of view.
  • Added line-of-sight checks.
  • Units only react to enemies they can actually perceive.
  • Added aiming instead of instantly firing at targets.
  • Added weapon spread.
  • Added sound events for gunfire, impacts, explosions, footsteps, etc.
  • Made sounds wake AI up instead of waiting for its normal perception tick.
  • Added reactions to taking damage.
  • Added target-loss reactions.
  • Added squad enemy reports.
  • Had to make sure squad reports didn't magically give units perfect enemy knowledge.

Performance problems

  • Hit really bad FPS when testing hundreds of units.
  • At one point large tests were running around 1–4 FPS.
  • Vision scans were checking too many enemies.
  • Friendly checks during combat movement were also expensive.
  • Navigation and avoidance became expensive with lots of agents.
  • Added spatial queries so units don't scan the entire battlefield every time.
  • Migrated enemy range queries to the spatial system.
  • Migrated friendly range queries as well.
  • Reduced unnecessary sound/perception work.
  • Tweaked RVO avoidance settings.
  • Increased max_neighbors after testing.
  • Got the large simulation performing much better.
  • Eventually decided that optimizing for 500 units wasn't actually the game I wanted to make.

Navigation / movement problems

  • Units sometimes got stuck around corners. 
  • Units could circle around chokepoints.
  • Some units would stay behind after the rest of the squad moved.
  • Experimented with obstacle avoidance horizons and neighbor counts.
  • Added no-progress detection/debugging.
  • Improved navigation enough that units eventually cleared troublesome corners. Still not perfect.

Pivot to the actual game

  • Changed direction from a 500-unit simulation to a 5v5 tactical prototype.
  • Kept the autonomous AI idea.
  • Units are allowed to override the opening strategy when circumstances change.
  • Prototype currently focuses on elimination.
  • Bomb/objective planned for V1
  • Target eventually around 5v5, possibly 10v10 rather than hundreds of units.

Weapons

  • Started with only a pistol.
  • Created generic weapon data.
  • Added:
    • pistol
    • rifle
    • sniper
  • Added different preferred engagement ranges.
  • Added different useful ranges and fire rates.
  • Added different projectile types.
  • Created a generic WeaponMount path so weapons can be swapped at runtime. 
  • Kept weapon mounting independent from the future shop/inventory system.

Fog of war / knowledge

  • AI does not have perfect global information.
  • Individual units maintain their own enemy knowledge.
  • Enemy weapon is unknown until that unit actually sees it.
  • Teams share last-seen enemy positions.
  • Team knows whether an enemy is alive/dead.
  • Team does not automatically know that enemy's weapon.
  • Added first-seen and confirmed-dead knowledge events.
  • Added debug information to see what a unit actually knows.

Tactical AI

This is not perfect, they are still rather dumb. Not reacting to getting shot.

  • Added autonomous tactical goal selection.
  • Units consider:
    • opening strategy
    • their weapon
    • known enemy weapons
    • enemy distance
    • danger
    • travel cost
    • ally positions
    • ally goals
  • Added search waypoints when units don't know where enemies are.
  • Added weapon matchup scoring. I am planning to make this a learning step to, balance themselves.
  • Unknown enemy weapons are treated neutrally.
  • Known weapon matchups influence engagement choices.
  • Added target retention so AI doesn't constantly switch targets.
  • Added tactical position selection.
  • Confirmed units could choose a side route when the direct route was exposed/blocked.
  • Units can later reconsider when circumstances change.

Combat behaviour

  • Added approach behaviour when outside weapon range.
  • Added retreat behaviour when too close.
  • Added strafing inside combat range.
  • Units turn/aim toward targets instead of instantly shooting.
  • Investigated whether units were turning toward whoever damaged them.
  • Confirmed damage itself wasn't secretly giving away an attacker's location.

Squad / search behaviour

  • Added squad contact investigation.
  • Units can react to reports from allies.
  • Added SEARCH behaviour/waypoints.
  • Worked on stopping units from repeatedly restarting the exact same investigation.
  • One remaining problem became obvious: teams can sometimes pass each other and continue toward opposite sides of the map instead of properly searching for each other.
  • Smarter search behaviour is one of the natural next AI improvements.

Round system

  • Added actual round lifecycle:
    • PRE_ROUND
    • ROUND_ACTIVE
    • ROUND_OVER
  • Added round numbers.
  • Added winner tracking.
  • Added clean next-round reset.
  • Projectiles are cleared between rounds.
  • Units respawn between rounds.
  • Previous round state gets reset correctly.

Buy/loadout prototype

  • Added pre-round weapon selection.
  • Prototype budget: 10,000.
    • Pistol: free.
    • Rifle: 2,000.
    • Sniper: 5,000.
  • Weapons are applied when the round starts.
  • Loadout resets for the next prototype round.
  • Future version can connect this to persistent money/weapons.

Opening strategies

  • Added team strategy selection before the round.
  • Current strategies:
    • HOLD
    • PUSH LEFT
    • PUSH RIGHT
    • SPLIT
  • Strategy is a preference, not a hard script.
  • AI can abandon the strategy once actual combat information becomes more important.

Debugging tools

  • Added a selected-unit debug inspector.
  • Can inspect what a boid actually knows instead of guessing why it behaved strangely.
  • Tracks things such as:
    • current goal
    • opening strategy
    • visible enemies
    • last-seen enemies
    • known enemy weapons
    • recent sounds
    • allies
    • current target
    • target changes
    • movement decisions
    • goal changes
  • This is deliberately a developer tool rather than polished player UI.

Stuff that didn't make the prototype

  • Full economy.
  • Persistent weapons between rounds.
  • Proper shop UI.
  • Bomb/objective mode.
  • Half-cover.
  • Breakable walls.
  • Polished intent/AI explanation UI.
  • Neural-network-based AI.

Probably the biggest theme of the prototype

  • A lot of the work wasn't adding "smarter AI".
  • It was removing information the AI shouldn't have.
  • Then giving it enough perception, memory, communication and tactical rules to still make believable decisions.
  • And building debugging tools so I can understand why a unit made a bad decision instead of just adding another special-case rule.

Files

Web.zip Play in browser
19 days ago

Leave a comment

Log in with itch.io to leave a comment.