1. Home
  2. Unity RTS Engine
  3. Game Manager

Game Manager

The Game Manager is the component that handles the faction creation, and some other general settings for the game. This is the main script that connects all the other components with each others.

When you’re creating a new map using the RTS Engine menu editor, this component is attached to an object called “GameManager”.

Selecting this object will display the inspector of the “GameManager.cs” script. It is composed of two parts: Factions and General Game Settings.


Factions:

  1. Faction Definition: With faction types, you can easily assign unique buildings and units for each faction. The “Faction Def” list includes all the faction types that are able to play in this map. Each faction must have:
    1. A unique “Code” which defines a faction from another.
    2. A unique “Name” for the faction that will be displayed in the UI.
    3. A list of “Extra Buildings” that only this faction can place.
    4. Capital Building: if the faction uses a special building capital (the building that is spawned at the beginning of the map). If not, leave this empty.
    5. Building Center: if the faction uses a special building center then assign it here. If not, leave this empty.
    6. Population Building: if the faction uses a special population building then assign it here. If not, leave this empty.
    7. Drop Off Building: if the faction uses a special resource drop off building then assign it here. If not, leave this empty.
  2. “Add Faction” 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.
  3. 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.
  4. Defining factions:
    1. Faction Name: The name of the faction that will be displayed in the UI.
    2. Faction Code: Assign a code for the faction (only for testing purposes, because when coming from a single player or a multiplayer menu, the faction code will be set depending on the choices on those menus).
    3. Faction Color: The color that this faction uses (will be displayed in the buildings and units).
    4. Player Controlled: Only one faction can be player controlled. This means when the player starts this map, he will be playing with this faction.
    5. Initial Maximal Population: This is the maximal amount of population that the faction starts with. (Which can be extended in game).
    6. Capital Building: Drag and drop the Capital building of the faction in this field (Creating the capital is covered in this part, you can either jump to that part or simply keep following the tutorial because it will get to it anyway).
    7. Faction Manager: Drag and drop of the faction manager object in this field (Creating the faction manager object is covered in this part, you can either jump to that part or simply keep following the tutorial because it will get to it anyway).
  5.  “Remove Faction” button: This button will remove the currently selected faction.

General Game Settings:

  1. 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.
  2. 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.
  3. Map Size: Pick a number to identify the size of this map. This is useful when you later decide to make NPC factions extend their territory by assigning a percentage that this faction need to take over of the map.
  4. Peace Time (in seconds): A countdown that starts at the beginning of the game. During this time, no faction can attack another.
  5. General Audio Source: Some audio clips are played from a local audio source such as resource collection sound effects which are played from the resource area itself. Other audio clips like an error sound for example, are played using another audio source which this one.

How can we help?