Intro

Abstract

Build a Finite State Machine (FSM) to control a team of minions in Prison Dodgeball.
Your goal is to create agents that can consistently beat opponent AI using movement, throwing, evasion, and teamwork.

This assignment combines:

  • Decision-making (FSM)
  • Physics (ballistic throwing from A5- Projectiles)
  • Coordination (team-level behavior)

Goals

  • Beat Glass Joe AI ≥ 2/3 of matches
  • Beat hidden opponents ≥ 2/3 of matches
  • Handle:
    • Team sizes: 1–5
    • Balls: 1–4

Tasks

TODO

  • Implement FSM states (core behaviors)
  • Integrate throwing logic from HW5
  • Implement shot selection
  • Add evasion behavior
  • Handle prisoner + rescue logic
  • Add fallback behaviors (avoid idle/stuck states)
  • Remove debug logs before submission
  • Test against multiple configs

Setup

  • Open Unity project → PrisonBall scene
  • Main file:
    • Assets/Scripts/GameAIStudentWork/MinionStateMachine.cs

Submit:

  • MinionStateMachine.cs
  • ThrowMethods.cs
  • ShotSelection.cs

FSM Design

Each state implements:

  • Enter()
  • Update() → returns transition or null
  • Exit()

Suggested States

  • CollectBall

    • Move to nearest available ball
  • Attack

    • Aim + throw using HW5 logic
  • Evade

    • Dodge incoming threats
  • Support / Rescue

    • Pass ball to prisoners
  • Idle / Reposition

    • Move strategically when no clear action
  • Global State

    • Emergency transitions (e.g. danger, ball nearby)

Implementation

  • Use provided FSM framework (don’t rewrite the core engine)
  • Add states in Start() via AddState()
  • ThrowMethods.cs
  • ShotSelection.cs

Finite State Machine


Strategy Notes

Throwing (from HW5)

  • Use trajectory prediction
  • Prefer:
    • Closest valid target
    • Non-occluded shots
    • High hit probability

Positioning

  • Stay mobile (don’t idle)
  • Avoid clustering with teammates
  • Control ball spawns

Team Coordination

  • Use TeamShare
    • Track:
      • Ball assignments
      • Target assignments
  • Avoid redundant behavior (e.g. 3 agents chasing 1 ball)

Testing

  • Use:
    • MinionTestThrowScenario
    • AdvancedTestThrowScenario
  • Run AI vs AI simulations (PlayMode tests)

Test cases:

  • Different team sizes
  • Different ball counts
  • Edge cases (1v1, low balls)

Constraints / Rules

  • ❌ No INTERNAL_ methods
  • ❌ No GetComponent() or scene hacks
  • ❌ No UnityEditor usage (must run in build)

If unsure → ask on Ed


Common Pitfalls

  • Agents stuck doing nothing
  • Constant state flipping (thrashing)
  • Bad aim (not using HW5 properly)
  • Ignoring prisoners
  • Multiple agents chasing same ball

Completed

Success

FSM implemented with:

  • Basic state transitions
  • Movement + throwing
  • Evasion tuning
  • Team coordination improvements
  • Performance vs hidden AI

FAQs