Solo developer Rasim Alam shared the rendering system behind RuneCipher, a tactics RPG built in Godot 4 that achieves directional lighting and dynamic weather in 2D.
Solo developer
Rasim Alam gave us a breakdown of the rendering system behind
RuneCipher, a
tactics RPG built in Godot 4, inspired by classic JRPGs like
Fire Emblem and
Breath of Fire.
To achieve the game's lighting and depth effects in 2D, RuneCipher renders the scene multiple times using different viewports. Each viewport makes a part of the final result:
- DiffuseViewport: base sprites
- DepthViewport: extra depth information used for parallax and height effects
- NormalViewport: normal maps used for directional lighting
- LightViewport: directional and point lights
- ShadowViewport: character shadow sprites
- OutputViewport: combines all previous layers into the final image
Rasim explained that the system was in part inspired by deferred rendering (a method often used in 3D games that processes lighting separately from the geometry), but adapted for Godot's 2D renderer.
Since every viewport needs its own version of the same characters and objects, the system has to keep all those versions synchronized.
To solve this, Rasim built custom classes that create the viewport copies automatically when a scene loads. Those copies stay linked to the original sprite, mirroring its position, animation, and flipping every frame.
For lighting, the game does not use Godot's built-in Light2D nodes. Lights are just PNG textures rendered into the LightViewport, making custom light shapes much easier to create and edit.
The flickering effect in the lighting is created using a shader parameter. Each character also gets its own shadow sprite, distorted to simulate a shadow on the ground.
A second shadow layer removes the shadow beneath the character so units do not cast the shadows onto themselves. Then, a single GlobalLightManager controls all the shadow settings, making it possible to update every shadow at once.
The final compositor then applies the overall color grading of the scene.
According to Rasim, this same system helps with the game's dynamic weather. Lighting, shadows, and scene colors all update together when the weather or time of day changes.
If you want to see more of RuneCipher, the links will be right below.
Interested in learning more?
If you want to learn more about shaders in Godot,
The Godot Shaders Bible covers topics like stylized shading, screen-space VFX, lighting, and vertex manipulation through step-by-step examples.