---
description: Basic description what functions called first and how game is works.
---

# HOW GAME STARTS

## Game Start

When game started many functions are called from <mark style="color:red;">\_ready()</mark>_._ Something that need to run before starts in _<mark style="color:red;">\_</mark>_<mark style="color:red;">init()</mark>. But I prefer mostly the first variant. And so, when game is launched, firstly game check if main menu will be shown and splash screen too (Splash can't be showed without main menu enabled)

{% hint style="info" %}
This is two variables in <mark style="color:blue;">GameManager (Singleton):</mark>

<mark style="color:red;">var</mark> main\_menu : bool

<mark style="color:red;">var</mark> show\_splash : bool
{% endhint %}

Of course you can change every variable before game actually starts in <mark style="color:green;">assets/scripts/p\_app.gd</mark>

If you've decided to turn off these variables, game will start with level loading from <mark style="color:green;">player.json</mark>

When the project is opened, you'll see a game scene opened. There will be these nodes structure:

<figure><img src="https://1144464912-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuY4zPCOUEs4gxYEj4NqK%2Fuploads%2FprFZnLE8tDTrLrUk2W81%2Fimage.png?alt=media&#x26;token=539663ea-3276-4fba-9c72-8197b3a394ee" alt=""><figcaption><p>Nodes structure of game scene</p></figcaption></figure>

{% hint style="warning" %}
Please, do not edit or move any of these nodes in the game scene, this scene manipulates nodes through gameplay. So if u don't want to break the game - do not touch.
{% endhint %}

1. **Game** is root node
2. **CanvasLayer** is container for **GUI** elements
3. **Sv** is SubViewport node that add some on-screen shader with effects
4. **EffectDither** is node SubViewport with dithering effect
5. **World** is node that hold all in-game world nodes, player, sun, outsky etc.
6. **SceneLight** is light node that light scene
7. **Player** node is controllable node with mouse
8. **Outsky** is color sphere behind skyboxes and levels
9. **PixelatedEffect** - cut-off feature, forget to delete
10. **Waypoints** is node that holds levels waypoints paths and moves player
11. **AIDemo** node is cut-off feature, was used in first AI tests
12. **AmbientSystem** node is holder for ambient sounds and music
