Population
Key Features
Manages Player Population: Tracks and updates unit population and limits it with population capacity. This is done through Player events to ensure any changes to its units or other producible (like research) will be applied to the population module as well.
Population Consumption & Capacity: Uses attributes on units to determine how much population they consume or provide. Unlike most other modules that use capabilities.
Dynamic Population Limits: Supports increasing max population via buildings, upgrades (research), or faction settings.
Hard Cap for Population: Ensures population cannot exceed a predefined limit regardless of capacity provided by units in game.
Event-Driven Updates: Triggers population change events for UI or gameplay reactions.
Seamless Integration: Works alongside production module to enforce unit limits.
Structure
Population Module β Core module handling population tracking, limits, and consumption.
PopulationConsumptionAttribute β Determines how much population a unit consumes.
PopulationCapacityAttribute β Determines how much population a unit provides.
OnPopulationUpdate β Unity event that triggers whenever population changes.
Usage Examples
Checking Current Population
Adding a Unit (Population Consumption)
This is manually managed by the module when listening to player's entity, unit and producible events. However, you can still manually modify population.
Increasing Max Population (e.g., Building Construction)
Applying a Hard Cap
Last updated