Maps, again

During these holidays I played a little bit with a couple of ideas, including a “civilization-like” game. I used JRuby.

I started using a dataset of elevation (the SRTM 90m). In practice you get a big matrix with the elevation in meters of a point each 90 meters.

If you draw altitude 0 as pure black and altitude 4000 as pure white you get something like that.

If you represent different elevations with different color (for example you choose green for 0-400 m, brown for 400-2000, and white for 2000 m) you get something like that:

The code to do that is this:

But if you add some simple code to represent shadows (supposing sun come from north-west) the result improves a lot:

The code to get this effect is here: