Skip to content
Menu
Mob City
  • Home
  • Contact
  • About
Mob City

Lit up mode in night time

Posted on May 13, 2025

I didn’t go with the standard approach to scene lighting for an isometric game. Instead, I took a route that’s a bit easier and a little more creative.

It starts with adding two sprites: a street lamp and a separate light source, which stays hidden during the daytime. The lamp, its light glow, and things like selection markers are excluded from tinting, while everything else in the scene gets the night mode treatment.

The task is figuring out how to light up the pawn when it walks under a streetlamp. The idea is simple: when the pawn enters the green X circle (representing the light’s radius), we light it up. When it’s in one of the red X circled areas (outside the light), the pawn should remain dark.

First, we need to mark which tiles are lit. We do this by checking the footprint of the light source on the grid when it’s created, and then marking the surrounding tiles as lit areas.

Next, during the pawn’s animation update, we check if it has entered any of the lit cells. If it has, we explicitly set it to lit-up mode.

In the shader, I added three illumination modes (“lit-up” states):

  1. Low brightness – reduces brightness by 50%
  2. Firing – boosts contrast by 50% and brightness by 80%
  3. Slight brightness boost – increases brightness by 30% (currently unused)

These modes can be toggled based on the pawn’s state or context in the scene.

So, before checking which lit-up mode is active, we first disable the general tint if lit_up_mode is set at all.

This worked quite nicely, but the pawn ended up looking like it was standing in broad daylight under the lamp.

To improve the effect, we apply the first mode (LM_LOW_BRIGHT) to reduce brightness by 50%, making the pawn appear illuminated but still grounded in the night setting.

This way, the pawn remains untinted, but the brightness is reduced so it doesn’t look as bright as it would during daytime.

Next, we use the second mode (LM_FIRING) when the pawn starts firing a gun. To support that, we also add a muzzle flash sprite, which appears at the correct coordinates whenever a shot is fired.

So, when the pawn fires a gun, we get something like this: the pawn becomes untinted as soon as lit_up_mode is set to LM_FIRING. This mode increases both contrast and brightness, making the pawn stand out briefly. At the same time, a muzzle flash is shown for one frame at the correct position to complete the effect.

Now we put it all together.

The idea is that under a streetlamp, the firing effect appears less dramatic — which fits the current look, though that might change later. You might also notice a small bug: the selection marker decal currently dims when it’s under the lamp light. That’s not intended and will need to be fixed.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Modular building graphics
  • Lit up mode in night time
  • Night mode (tinting with shaders)
  • Traffic system and cars
  • Animation
©2025 Mob City