The Geochron, Dance Party, Graveyards
This week, more work on the Crowd Supply promotional video for the Dazzler. These are all small demos and snippets that will probably feature in the final cut.
The Geochron is a wall-mounted clock that shows a map of the world. It uses backlights and a spline mechanism to show the lit part of the globe at any given day and date. Can the Dazzler do something similar? of course!
The demo starts with two images from NASA's Blue Marble image collection, first the night image, sized for the 1280-wide Dazzler screen:

The first step is to compute the location of the Sun. This is the subsolar point, the place on the Earth where the Sun is directly overhead. Python package PyEphem does this nicely, and it's straightforward to plot the Sun as a large dot over the bitmap.

Despite the sun hanging over the mid-Atlantic, it's still night everywhere on Earth. Fixing that is the next step. The NASA archive has suitable images of the fully illuminated Earth, so it's only a matter of blending between night and day in the appropriate pattern.
Making the light map isn't complicated. Any particular point has a latitude and longitude. You turn this into a unit vector that is the sphere's surface normal, and compute how much sunlight it gets using the dot product with the sun vector. This yields a rectangular light map, which this demo computes at 256x128 pixels:

The code uses alpha blending to paint the "day" bitmap in the places where the lightmap is brighter. The result is a realistically illuminated view of the world. (There's a whole section on fancy alpha blending in the Gameduino 2 book).
I've been leaving it running as a background thing in my room... quite satisfying wallpaper.
Next up is a sort of retro effect - better to show it instead of trying to describe it (click for video)

The background is an ancient caustics animated bitmap, rendered in full-saturation colors. I think I've nailed a grungy-analog-70s-video-effect look.

The foreground is just an array of about 1500 black circles, sized according to the source video's pixel brightness. The demo samples the pixels in each frame of the source video, and sizes each circle appropriately.

It's not a game, nor is it in any way useful, but it is a lot of fun.
Last up is an actual game, or at least a demo of one. I picked this free graveyard platformer set to make a small 2D platformer demo. The asset set includes the original graphics as an SVG, which is great for extracting the layer elements. I used Inkscape for this, Gimp to clean up the bitmaps, and Tiled to create the level map. These are all open-source and run on Windows, Mac, and Linux.
First is the sky layer, with a large moon. The sky is a gradient, and the moon is a single bitmap with alpha transparency:

Next are the hills. These use one narrow bitmap, set to repeat horizontally, offset and colored for the three hill layers:

Last is the actual map. Importing the tileset into Tiled, then painting up a map is straightforward. Tiled saves maps in a standard format that a Python module can read.

Each tile is a bitmap, so about 200 bitmap draws to make up the foreground layers:

Here's the parallax scrolling video.
Thanks for following Dazzler's story. More next week.