> For the complete documentation index, see [llms.txt](https://lush-engine.gitbook.io/lush-engine/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lush-engine.gitbook.io/lush-engine/how-to-use/scenes-and-ecs.md).

# Scenes and ECS

Set up and manipulate the data of your entities

### Scene and Entities format

Scenes are written in XML format, and read by the engine to create your game's environment.

The XML file should follow the following format:&#x20;

<figure><img src="https://1842077348-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2FS95SsD7IxHgGyt9MU5%2Fuploads%2FORkeTv23WRTYt9rtSZt0%2Fimage.png?alt=media&amp;token=717be0e9-e5ca-4bdd-9c04-71716c2b8078" alt=""><figcaption><p>V1 Example scene format</p></figcaption></figure>

Each entity have two optional fields, `id` and `name`.

* `id` is the index of the entity, and will override any other entity at this index
* `name` is a string, and help navigate your scene panel, as well as provide a way to select a specific entity by name in your scripts

If the `id` field is not defined, its value will be `last + 1`, and if the `name` field is not defined, its value will be an empty string.

### Components format&#x20;

You can then define every components an entity should have, and their values. You can find the list of native components and their fields down below.

To add your own script to an entity, the process is the same as a native component. Create a tag of the same name as your script, and you can specify any public field you want to override.

{% hint style="info" %}
Only fields of type `float`, `ulong`, `string` and `Entity` can be applied.
{% endhint %}

### Global information

A few test scenes are included in the engine to test basic features, all the source code is available on GitHub.

If a scene is named `main`, it will serve as the default scene when launching the game's executable. Otherwise, the selection will follow the file opening order, which depends on the filesystem iterator.

Scenes are hot-reloaded, which means that saving the XML file will reload the scene.

{% hint style="warning" %}
When the scene is reloaded, the current modifications inside the editor will be lost.
{% endhint %}
