> For the complete documentation index, see [llms.txt](https://travljen.gitbook.io/unit-system/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://travljen.gitbook.io/unit-system/how-it-works/overview.md).

# Overview

This page gives an overview of the Unit System

### Introduction

This package provides a **modular and extensible foundation** for strategy-based unit interactions, resource management, and combat systems. It is designed for flexibility, making it suitable for various game genres, including **real-time strategy (RTS), turn-based strategy (TBS), and RPGs**. Below is a structured overview of its core systems and how they work together.

***

### Core Components

#### **Producibles**

* Defines **data-only objects** such as names, descriptions, costs, requirements, and attributes.
* Can represent both units and entities **without requiring a physical object** in the scene.
* Useful for games where objects are purely data-driven rather than instantiated.

#### **Entities & Units**

* **Entities**: Basic objects in the scene, such as resources, walls, or obstacles, with limited functionality.
* **Units**: Extend entities by adding movement, production, garrison, combat and more.

#### **Entity & Unit Capabilities**

* **Capabilities** define an entity's **static attributes** (e.g., health, armour, and attack power).
* **Components** store **real-time data**, allowing dynamic updates during gameplay.

**Interactions**

Interactions between entities (or units) are geared around tasks, which can be scheduled and executed in specified order.

* **ITaskProvider** interface implemented on components which act as an interactor (e.g. Collector, Builder) that define tasks that may be executed per give context.
* **ITaskHandler** handles execution lifecycle of a task (start, update, finish).
* **Task System** manages the lifecycle of tasks for various objects, including queuing, execution, and cleanup.

***

### Data Management

* **Configurable Assets**: Uses **ScriptableObjects** to define game data for easy customisation.
* **Creating Resources & Nodes**: Define resource types and set up nodes for gathering mechanics.
* **Creating Researches**: Establish technology trees for unlocking new units or features.
* **Creating Units**: Set unit types, roles, and behaviours for different gameplay styles.
* **Creating Entities or Custom Producible**: You can create custom types that derive from Producible, Entity or Unity and keep it all working within the confined systems.
* **Creating Factions**: Define **starting resources, population limits, and available units** for each faction.

***

### Player Module Structure

* **Player Module**: Base script for player specific managing or behaviour. These are used as central system managing for **combat, production, population, building mechanics, etc** for Player itself.
* **Faction**: Determines **player-specific** limits, available resources, starting unit options and more.
* **Entity & Unit Structure**:
  * **Entity**: Adds basic in-game functionality to objects.
  * **Unit**: An advanced entity with movement, AI, and combat mechanics.

***

### Capabilities & Behaviours

* **Entity Capabilities**: Static attributes defining an entity's behaviour (e.g., health, combat stats).
* **Entity Components**: Real-time data for dynamic gameplay adjustments.
* **Unit Capabilities**: Defines unit-specific behaviours, such as attack range or movement speed.
* **Unit Components**: Manages real-time unit status, including AI state and combat interactions.
* **Tasks**: Independent behaviour scripts that can be **queued, scheduled, paused, or canceled** without affecting the main unit or entity structure. Examples:
  * **Building a structure** → Task input: Builder unit, Context: Target structure.
  * **Gathering resources** → Task input: Worker unit, Context: Resource node.

***

### Modules & Behaviours

#### Modules

* **Resource Management**: Manages resource types, collection, and storage limits.
* **Production**: Handles production of any producible in an, supporting **real-time and turn-based mechanics**.
* **Combat**: Supports different **attack types, AI behaviours, and damage systems**.
* **Collection**: Implements **worker-unit resource gathering**.
* **Building**: Defines construction mechanics and unit-structure interactions.
* **Garrisoning**: Allows units to **enter and exit** other units for protection or transport.
* **Population Control**: Manages **population limits and expansion mechanics**.

***

### User Interface

* **No UI Provided**: This package does **not** include a complete UI system yet.
* **Basic Demo UI**: A minimal UI is provided for demonstration purposes.
* **Camera Controller**: A **top-down camera system** with basic movement controls.
