LSCS: Scene Setup

Now that the Formation as well as its data is setup the Combat scene can be Setup. For this firstly create a plane and set it to be static. This is where the formations will run on.

Next add the Scene Prefab which can be found under TopsonGames -> Large Scale Combat System -> Prefabs -> Scene Prefab. This prefab includes everything the Large Scale Combat System needs to function properly.


1. Baking NavMesh

On the Scene Prefab on the child object NavMesh is a component called NavMeshSurface. Click Bake to create the Navigation NavMesh


2. World Corners

The Child objects WorldCorner1 and World Corner 2 define the actual size of your world and clamp the camera Ccontroller ans well as the Minimap Icons to its Bounds. Place them to your real world corners. Be aware that the y hight should be at your ground level. The cyan BoxGizmos shows you the size of your worldbounds.


3. Formation Controller

On the Manager Gameobject the first script is the FormationController. It is the central brain of the system. It’s a singleton component responsible for processing all player input, managing selections, and issuing commands to the Player Formations in the scene.

Input Actions

  • The Formation Controller utilizes Unity’s modern Input System. It is recommended to use the default input bindings provided with the package to ensure optimal functionality. The following controls are available:Left Mouse Click (Select Action): Selects a single formation.
    • Shift + Left Mouse Click (Multi Select Action): Adds formations to the current selection or removes them with each click.
    • Left Mouse Drag (Select Action): Draws a selection box to select multiple formations.
    • Right Mouse Click (Move Action): Sets the movement waypoint for the selected formation(s).
    • Right Mouse Drag (Move Action): Adjusts the width of a single formation or scales multiple formations simultaneously.
    • Spacebar (Show Waypoint Action): Reveals all movement paths to their destination positions.
    • Mouse Hover (Mouse Position Action): Highlights formations under the cursor.
  • Input can be customized at the InputSystem actions which can be found at TopsonGames\Large Scale Combat System/Input System/Input System Actions Here you can assign new Inputs.

Ground and Unit Mask

Ground Mask is the physics layer your walkable ground is on. This is crucial for the controller to know where to place movement waypoints. Can be left as Default. The Unit Mask is the Units Layer, this has to be different than the Ground Mask, otherwise no selecton is possible. It is recommended to set it to Unit

TeamID

Determines which formations the player can select and command. Set this to 0 to control all formations with the TeamID set to 0.

Highlighting

These settings control the visual aids that help the player

  • Show Indicator on Highlight: If checked, selection indicators will appear on a formation when you mouse over it. This provides immediate feedback on what you are about to select.
  • Show Enemy Inidcator: If checked, hover indicators will also appear on enemy formations (those with a different Team ID). If Show Visualizers On Highlight and Show Enemy Inidcator Enemy Visualizers will be shown if there are any attached to the Enemy Formation.
  • Hover Hide Delay: A short delay in seconds before a hover indicator fades out after the mouse leaves. This prevents flickering.
  • Show Path to Waypoint: If checked, holding the Show Waypoints Action key will also draw Visualizers for each formation.
  • Show Visualizers On Highlight: If checked a Formations Visualizers will be shown once it is highlighted. When also Show Enemy Inidcator is true than enemy Visualizer will be shown if there are any.
  • Show Visualizers On Select: If checked a Formations Visualizers will be shown on select.

Selection Texture

The texture used to draw the selection box when you left click and drag. If left empty, a default semi-transparent box will be used.

Formation Settings

  • Min Formation Width: The minimum number of units in a row the formation can have.
  • Allow Single Row Formations: If checked, you can drag a formation out into one long line of units. If unchecked, the maximum width will be one less than the total number of units, forcing at least two rows for larger groups.
  • Max Single Formation World Width: The maximum length in world units that you can drag a single formation’s new shape. Please note that this gets also used to calculate the maximum width for multi formations
  • Spacing Between Formations: The gap in world units that is placed between different formations when you are dragging a group of them together.
  • MinGroupScale: defines the minimum visual size of the entire formation so that it remains visible and selectable even if only a few units remain.

Waypoint Container

Parent where all Formations / Units Waypoints will be set to as a child.


GameManager

The GameManager is responsible for Spawning the Player and Enemy army aswell as setting the Win / Lose condition and is used as a bridge to the DamageModifier.

  • DamageModifier: Previously created DamageModifier
  • PlayerArmy: Previously created Army
  • Player Army Spawner: Spawner of the Player Army, look down below for informations
  • EnemyArmy: Previously created Army
  • Enemy Army Spawner: Spawner of the Enemy Army, look down below for informations

OnFinnishSetup gets called once the Formations are spawned. OnPlayerWin and OnEnemyWin Events are for customizing the Player/Enemy win.


UIManager

Handles all UI in Game. It is reccomended to use the provided Canvas and just swap the Image sprites.

  • Strength Slider: Represents the Player vs the Enemy strength
  • FormationUI: UI representation prefab that gets spawned for every player Formation. Makes it possible to select formations by UI clicking
  • FormationUIParent: Spawn parent of FormationUI
  • HoverUI: Displays formation stats on hover

If a ui display of the Formations stats is not wished HoverUI can be left unassigned.


AiCommander

Used to command the AI. Further explanation can be found here.


AnimatorLODSettings, AnimatorLODmanager, AudioManager, FlagManager

Non essential scripts.Click here for more informations


ArmySpawner

Each Formation (Player, Enemy) needs to have its own ArmySpawner. The ArmySpawner holds information on where which UnitType can be spawned.

Creation of a SpawnPoint

  • Create a Empty Gameobject: Its Position is where the Formation will be spawed. Place It a little bit on top over your desired ground
  • Assign to Spawnpoints: Click plus on the Spawn Points list and assign your Spawnpoint to the Spawn Transform.
  • Add allowed Unit Types: Add all UnityTypes that are allowed to spawn there. Note that it is only possible to spawn one Formation per spawnpoint, make sure to have enough.
  • Click „Snap Spawn Points to NavMesh“: This will place all your Spawn Point to the closest NavMesh Point

For a better Visualization the Spawnpoint is drawn it the UnitTypes color and the UnitTypes name is shown next to the point.


Now your Scene Setup is complete and you can start the Game!