Handling backgrounds

Backgrounds are the building block art assets for each room in an adventure game: They give depth and set the mood.

Escoria supports multiple features for backgrounds.

The main node type for backgrounds is ESCBackground. Additionally, certain features of ESCTerrain add more features to the background.

Backgrounds can come in all sizes. They may be the exact size as the screen, or they may be bigger or smaller. Escoria uses its Camera features to handle backgrounds of various sizes.

Camera limits define how the camera follows the player and pans over the background. The developer can enable and disable camera limits in the game to temporarily hide or show different parts of the scene.

Parallax backgrounds

Parallax layering is a technique used to add depth to a two-dimensional graphic by moving different layers at diffferent speeds as the camera pans over them.

Godot has that functionality built-in with the Parallax2D node type (formerly ParallaxBackground and ParallaxLayer prior to Godot 4.3).

This video introduces the functionality, and you can also check out this excellent tutorial in the Godot documentation.

Scaling

In addition to the Parallax method, another technique to add depth to a two-dimensional scene is to change the size of the player character as it walks from the front to the back of the scene (or vice versa).

In Escoria, this is achieved by using the different parameters of the ESCTerrain node in the scene: The scales parameter uses a texture. Darker areas of the texture result in a smaller sprite, while lighter areas scale the sprite up. scale_min and scale_max limit the scaling.

Lighting

Another feature to make rooms more lively is to give them dynamic lighting, so that certain parts of the screen tint the character sprite as though it was walking through different light sources in the background.

The parameter lightmap expects a texture that will be laid overtop of the scene, allowing the character to be tinted/shaded according to the position of the character in the scene.

The parameter lightmap_modulate can be used to additionally tint the lightmap texture.