Skip to content

Latest commit

 

History

History
79 lines (40 loc) · 4.56 KB

architecture.md

File metadata and controls

79 lines (40 loc) · 4.56 KB

Escoria architecture

The plugin script, autoload and classes

According to the concept of Godot plugins, Escoriainitializes itself in the plugin script addons/escoria-core/plugin.gd. This script is mostly used to initialize the Escoria configuration items and initialize (and later remove) the autoload scene escoria.

This scene binds together all required objects and interfaces in a central place.

In addition to this, various classes are defined in the respective class files and build up the various resources used in Escoria. See the API-docs folder for details.

Nodes and objects of the Escoria autoload scene

The Escoria autoload scene holds various nodes that provide vital parts of the engine.

Logger

The ESC logging framework is responsible to log various game events throughout the engine.

Utils

Some smaller utilities used on various places in the engine.

Inventory manager

The inventory manager is responsible for storing inventory items the player carries around.

Action Manager

The action manager is used when the player triggers a verb or uses items.

ESC Compiler

The ESC compiler compiles files in the ESC language into a list of events that can be run by the ESC event manager.

Event manager

The ESC event manager is used for queuing and scheduling events and handles the event execution.

Globals manager

The globals manager stores and handles global flags as described in the ESC reference.

Object manager

The object manager handles the state of the objects used in the game (active/interactive/states). All objects, that should be handled by the engine and especially by ESC scripts are required to register to the object manager and have a unique global id.

Command registry

The command registry stores references to available ESC commands. By adding additional command directories via the settings, developers can enrich the ESC language just for their games.

Resource cache

To optimize performance on platforms that support a larger memory footprint, resource can be cached in the resource cache using the queue_resource ESC command.

Dialog player

The dialog player is used for handling dialogs and the say command.

Main

escoria.main is the main scene manager used in Escoria that allows for switching scenes with transitions

Inputs Manager

The inputs manager is the central component in Escoria to receive, handle and deliver input events.

Save data

The save data node is responsible for storing and loading savegames and the game settings.

The Godot main scene of Escoria

The scene, that Godot loads when starting a game (the main scene) is set to addons/escoria-core/game/main_scene.tscn and basically instantiates the configured main menu scene and starts it.

The interactivity workflow of Escoria

When the player clicks on an ESCItem, the input manager is used to check and distribute the click to the currently running game interface. The game interface is then responsible for taking the respective action based on its workflow. This way, different user interfaces can be implemented. For a coin interface, for example, a right click would open the coin and let the player select the respective verb.

The game interface will ultimatively call escoria.do, which is a plumbing method, that handles core functions like walking, clicking on items or visiting areas. This method will then take care of the different actions, for example moving the player to the object (or its interact_position) and then running the appropriate event. The event is based on the current_action set in the actions manager (the verb) and the current_tool (the selected item). If the current verb is use and the event has an event :use, the event manager will run that specific event.