GOAP
Alien Jobs & King Commands Concepts
Alien Job System
The Alien Job system integrates with GOAP to provide a flexible framework for assigning and managing tasks for aliens in the game. This system allows aliens to dynamically switch between different job types and execute appropriate actions based on their current role and priorities.
An Alien's job holds a preset of GOAP capabilities
Core Components
JobType and JobAction Enums
JobType
: Defines the different professions an alien can have (E.g. Farmer, Lumberjack, Miner, Builder, etc.)JobAction
: Defines King/System actions that alien can performed, mapped to specific job types (E.g. Chop Tree, Build House, etc...)
AlienJob Component
The AlienJob
component connects aliens to the GOAP system by:
- Register their jobs with the JobController
- Communicating with the GOAP agent to set appropriate goals and actions
- Dynamically changing behavior based on the assigned job
Job Controller (King Commands Controller)
The JobController acts as a coordinator, assigning King Commands to aliens:
- Worker Registration
- Maintains a dictionary of all available workers organized by job type
- Handles registration/unregistration of workers as they change jobs
- King Command Management
- Commands include action type, target, priority, and job type requirements
- Instant priority commands (0) are processed immediately
- Lower priority commands (1-5) are processed every 1s intervals
- Assigns commands to appropriate workers
- Give King Command
- Command on pair with a target
- E.g. KingCommand: Chop a tree + Target: A specific tree entity