The Game Manager is the component that handles the faction initialization in the map and some other general settings for the game. This is the main script that connects each component with each other.
When creating a new map using the RTS Engine menu, this component is attached to an object called ‘GameManager’.
The Game Manager component is divided into two parts: General Settings and Faction Slots settings.
- Defeat Condition: This presents the condition that determines whether a faction is considered defeated or not. There are currently two possible conditions at which a faction loses the game:
- Destroy Capital: When the capital that has been assigned in the faction slot is destroyed, the faction is defeated.
- Eliminate All: When the faction loses all its units and buildings, the faction is defeated.
- Speed Modifier: This modifier value controls how fast the game runs. The higher this value, the faster game actions are. This affects unit movement, resource collection time, building construction time, task reload time, attack reload time and more.
- Random Player Faction: When turned on, this will shuffle the factions at the beginning of the game will pick a random capital position (from all the defined ones) for the player.
- Peace Time (in seconds): A countdown that starts at the beginning of the game. During this time, no faction can attack another.
- Main Menu Scene: This is the name of the main menu scene that the player gets transferred to when he leaves a single player game.
- Win Game Audio: An audio clip played when the player wins a game.
- Lose Game Audio: An audio clip played when the player loses a game.
- “Add” button: This button allows you to add a new faction slot to the map. The amount of faction slots represents the maximal amount of factions that this map is capable of having. When playing this map with less than the maximal amount of factions allowed, the unused faction slots will simply be discarded. The button also displays the amount of faction slots (Faction Count).
- Faction navigation buttons: The two buttons (“>>” and “<<”) allows you to navigate between factions. Right below these buttons, you will see the currently selected faction settings.
- Faction Slots Settings:
- Name: The name of the faction that will be displayed in the UI.
- Type: Assign a Faction Type Info from the project tab in this field. This is only for testing purposes only (when you want to test-play the map directly without going through the menus). If you’re entering the map from the single player or the multiplayer menu then the chosen faction type in those menus will overwrite the defined ones in this field.
- Color: The color that this faction uses (will be displayed in the buildings and units).
- Player Controlled (Single Player only): Only one faction can be player controlled. This means when the player starts this map, he will be playing with this faction. Please note that this only matters when you launch the game directly in the map scene in the editor or when coming from the single player menu when you have the “Random Player Faction” field above deactivated. In a multiplayer game for example, each local player’s faction slot will be marked as player controlled.
- Initial Maximal Population: This is the maximal amount of population that the faction starts with. (Which can be extended in game). Gets overwritten with the value set in the multiplayer and single player menus if you’re entering the map from there.
- Capital Building: Drag and drop the capital building of the faction in this field. For each faction, simply place a building in the scene, set its Faction ID in the main Building component and set it as enable its Placed By Default Building Placer field in its component. For more on how to create a building prefab, check out this documentation page. You’re allowed to leave this field empty (the faction slot does not have to start with a capital building), if the defeat condition is not set to “Destroy Capital” and if there a transform assigned to the next Camera Look At Position field that represents the initial camera position when the game starts.
- Camera Look At Position: If assigned, it represents the initial camera position when the game starts.
- NPC Manager: The NPC Manager prefab that will be used to control the behavior of the faction in case it’s not player controlled. Only valid to test-play the map as NPC Managers chosen in the menus will override this when starting a game from the menus.
- Default Faction Entities: This list allows you to add pre-placed units and buildings for each faction slot and have them activated depending on the faction type. For each element of this list:
- Instances: Drag and drop the unit/building instances that is pre-placed in the map and are intended to be used as faction entities for the faction slot when the game starts.
- Faction Types: A list of Faction Type Info asset elements. When it’s empty, the unit/building instances will be used for any faction type, if not, then the objects assigned in the Instances list field will be destroyed unless the type assigned to the faction slot exists in this list.
- “Remove” button: This button will remove the currently selected faction.