Skip to content
DrInfy edited this page Sep 12, 2021 · 3 revisions

UnitRoleManager handles roles for units. Units are assigned roles to remember what they were doing in previous frames. Role manager has specified number of prebuilt role types, but can be extended to as many roles as you need. UnitRoleManager is required manager in most acts and functions that manages unit roles within sharpy. All friendly workers and combat units have a single role in Sharpy at all times. In order to see role contribution during game, set debug for UnitRoleManager to True.

Roles

Roles are defined in UnitTask.

  • Idle = 0
    • Unit doesn't have an assigned task
  • Building = 1
    • Worker is either building (terran), trying to build, or moving to build a new building
  • Gathering = 2
    • Worker is gathering minerals or vespene gas. Workers that are worker drilling don't count here.
  • Scouting = 3
    • Unit has been assigned for scouting enemy units / buildings. Will never be reassigned.
  • Moving = 4
    • Unit is moving to a position, i.e. gather point. Can be assigned to defend instead.
  • Fighting = 5
    • Unit is fighting against enemy somewhere. Can be assigned to defend instead.
  • Defending = 6
    • Unit is defending a zone / something
  • Attacking = 7
    • Unit is attacking enemy base. Can be assigned to defend instead.
  • Reserved = 8
    • Reserved for some unknown purpose, i.e. gate keeper for Protoss. Will never be reassigned.
  • Hallucination = 9
    • Not a real unit.

Adding more roles

Because UnitTask is IntEnum and the roles operatate on int basis, it is possible to add more roles to sharpy as required. In KnowledgeBot.configure_managers set self.knowledge.roles.role_count to the amount of roles desired. By default additional roles are handled in similar way to Reserved and will never be re-assigned in any normal sharpy acts.

Clone this wiki locally