# Light and shadows like Diablo

I wanted to have shadows in my game and thought the way they were implemented in Diablo was good enough. Any hints on how to produce a similar outcome?

• Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. – Kromster Aug 9 '18 at 16:31
• I'm pretty sure those are just sprites – Bálint Aug 9 '18 at 16:31
• What have you tried so far, and what specific aspects of Diablo's look is it currently lacking? – DMGregory Aug 14 '18 at 17:13
• Haven't tried anything yet, I was looking for ideas. I saw some articles describing 2d real time shadow rendering, but I thought it would be too costly and hard to implement for a top down game. When I say shadows, I'm actually referring to dark spaces, not the shadows under the sprites. – GuestPosterStrikesAgain Aug 17 '18 at 18:01

The environment lighting demonstrated in your screenshots is largely tile-based. The effect is particularly notable along the diagonal just to the right of the enemies in the screenshot.

In such a system, the map is divided into tiles (which may or may not be the same tiles used to actually build the visuals of the map) and each tile has a base light level. Players and other objects have "light" values that are then added to this base light level to determine how bright or dim to shade any given tile. These light values generally decay in some fashion, per tile, in a radius around the object. For example, if the player has a light value of "3" and is standing at the center of a room, the player might impart light value bonuses as follows to the surrounding tiles:

+1 +1 +1 +1 +1
+1 +2 +2 +2 +1
+1 +2 +3 +2 +1
+1 +2 +2 +2 +1
+1 +1 +1 +1 +1


For additional realism, objects like walls can be marked as such to block or occlude the proliferation of the light pattern above.

As for the object shadows (those "cast" by the creatures), those can just be built in to the character's sprite. You can see this in the one demon at the bottom right of the fire column. It's shadow is clipping over the fire, and the fire itself does not impact its shadow at all. It does impact the environmental light as above, but not the creature's own shadow.