I've been away in Sevilla for a couple of weeks or so, for work but also took some time out for vacation while I was there, but back now.

I found some time to work on adding layered patterns to buildings and terrain, combining patterns to add detail to buildings and terrain.

Everything procedurally generated at runtime, but some are created statically then baked in to composited and others are overlaid at draw time, leveraging alpha transparency.

https://microstate.neocities.org

#indiegame #indiedev

Adding detail is a slow process, and is a bit odd when there is asymmetry between the level of detail between things like trees and gardens and between different buildings, but I'm getting a sense of it coming together.

I like that buildings have persisted RNG floor plans generated for them now and are not all just rectangular shapes, and that they rotate correctly as you rotate the map (with a bit of an exception for stores for now, will re-visit that when I get back to placement logic).

That patterns are composited dynamically allows dynamic lighting.

Some re-computation of baked patterns is required, but is fairly fast (sub second) and so allows for support for a full day/night light cycle with night time, dawn/dusk - and other effects like lighting and textures for weather conditions (rain, snow, etc).

The tinting is done by having _every_ color passed through a function when assigned to fillStyle or strokeStyle.

e.g. `ctx.fillStyle = setColor('#ff00ff')`

This function then blends that color with a target color (e.g. a blue like '#1100ff' for night time), while preserving transparency, and so the entire scene ends up being graded.

[ It could use a lookup table for better performance, but with batch drawing of tiles it's not really necessary. ]

The setColor function also supports a second option that can be used to indicate a color should be behave like an emissive and so just nothing should happen to it (it should not be graded).

I do that for the window lights and the street lights, with the drawing of the cones of light from streetlights being toggled by a boolean, and I think it works pretty well, even without any additional work to simulate glowing.

All in all really simple, but happy with the output and the flexibility.

None of this has much to do with gameplay though...

<whomp whomp>

I really need to force myself to stop tinkering with buildings and adding a basic UI and a save/load system and then start making it feel 'playble', refining behavior and working on the simulation as I go - and implementing decisions for players to make that impact it.

In the mean time maybe my wife can rustle up some nice vector sprites for things like trees and shrubs, maybe even some wildlife and some vehicles (cars, boats).

Before bed, I've quickly added a toolbar option to allow day/night to be toggled on https://microstate.neocities.org

It's a hard swap out, that fully flushes all cached sprites and textures and doesn't do a graceful transition, but at least allows anyone to try it out the different lighting conditions.