# 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="/files/k9BIlYIT01vWzR8xfOnG" 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://picnic-in-the-oblivion.gitbook.io/source-code-scripts/how-game-starts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
