As you already know, a Godot game is composed of multiple scenes, but of course some global state needs to be maintained to link them.
In Escoria this state is very simple to avoid debugging problems and keep the game as lightweight and fluid as possible.
The global state consists of a few pieces of information about your game that are saved, stored on savegames, and kept in memory between scene changes. When you launch the game, theses informations don’t exist, and are gradually stored by the engine each time an item, a scene or an action creates them. So there is no specific file in your game for that type of data.
The main data that are saved are the global flags, the item states, and item active property.
Global flags are
false values (booleans) that can be used by the game script to drive the game logic. You can store them using the
set_global function in esc scripts. For example in our sample file we used globals to keep track of the item the user as picked with :
set_global picked_item true
The state of an item is a string attached to the item, that describes its state, as explained in "The Items" chapter. States in the item can also be implemented as animations so an animation is played at the state change. For example, we used animations in our sample game on the panda god to save him neutral, happy and unhappy. Those animation names considered as states could be set like:
set_state bamboo_god angry
The active property defines the item's visibility. An inactive item is invisible and receives no input. You can also set this property in the Godot editor by changing theActiveproperty of the inspector. This way, you define the initial value for the item. If you want modify it during the script, you can use the
set_active instruction. For example, when the player picks up an object, it is added to the inventory and made invisible on the seen with:
set_active bad_bamboo false
Other information stored in the savegame at the moment of saving the game includes:
As you can see, we don't have a global registry with all the objects and their position, or where the player is, etc. Each scene is in charge of instancing its own player character, its own UI, etc. Of course, some trickery is used to avoid loading the player and UI resources every time at engine-level, but the game is unaware of those objects (see the "Optimization" chapter for more on this).
You can play your game and then use the F4 shortcut to ask Godot to save the game as soon as possible. The informations will be stored in the quick_save.esc file which is either in the device folder of Escoria, or in your personal data folder with the name of the game if the game has a name, for example /home/user/.godot/app_userdata/Escoria in Daïza under Linux, if your game has a name.
Refreshing the contents of the autosave file on a text editor while playing will allow you to debug the game’s global state data.
The global state should not be confused with the engine configuration you access with the Scene > Project Settings menu or by editing the engine.cfg file in the device folder of escoria. In this menu or file you will define parameters of the Godot engine so it will launch the game acordingly, but you will not define game data. We will speak about the engine’s configuration in the last section of this book, "Export Your Game".
Il y a une erreur de communication avec le serveur Booktype. Nous ne savons pas actuellement où est le problème.
Vous devriez rafraîchir la page.