Category Archives: Coffee break games

Pre-calculated light maps

Overlapping light sources

Times of Sand, a little dive into writing a small somewhat non traditional roguelike game. It will be reasonably easy to pick up and play the game.

A few days ago I added support for precalculated lightmaps. Upon generating the map I use a simple algorithm to calculate the ambient light and hereby minding the distance and radiosity of the light source. In order to calculate overlapping light sources we store this value inside a small two-dimensional table and add the calculated value to this. We are able to store colordata with it as well so it’s possible to have yellow and purple light sources.

lightMap[(y - (distanceToLightSource / 2)) + tY][(x - (distanceToLightSource / 2)) + tX] =
lightMap[(y - (distanceToLightSource / 2)) + tY][(x - (distanceToLightSource / 2)) + tX] +
math.clamp(0, radiosity * ((distanceToLightSource / 2) - math.dist((distanceToLightSource / 2),(distanceToLightSource / 2), tX, tY)), 100)

As visible in the screenshot, the player ofcourse has to be colored as well. We just subtract the light map value for the matching tile and that’s taken care of as well. I can start on dungeon generation now.

Introducing Shirobon

The first game I started writing with Löve 2D, yet it’s not as far along as Times of Sand. Basically the idea is to combine a bit of the classic board game Stratego with Bomberman and checkers. A two player grid- and turn-based game where your goal is to get the most of your crew to the other side. Since access ways are limited you have to choose between an offensive or defensive approach. Your crew will consist of 5 characters with different abilities, such as placing mines, disarming mines, a spy and fighters. The game ends if either all your characters are dead or the last of your character reaches the other player his camp.

I have been pondering trying this as a classic board game, and think its quite suited for that. Still figuring out character classes, obstacles (perhaps user placable sandbags) and balancing things. The beauty of being a programmer here is that I can simulate full gameplay so far and see it’s outcome, sort of digital playtesting without all the physical testing (I can simulate hundreds of games in a few seconds).

Where I usually rely on mates for graphics, this one is all me. I might have to learn how to paint for a physical boardgame, since just printing doesn’t bring that nice feeling to the board.