iso-sim-town

Installation
SKILL.md

Iso sim town

One engine (assets/engine.js, no libraries, no images) turns town generators into the whole game: renderer, buildings, props, traffic, pedestrians, Props window, bulldozer, day/night, save, music player and the Win98 chrome. You write gen() functions that lay out tiles and objects; you don't write drawing code. template/index.html is one brownstone city; examples/three-towns.html adds a snowy Christmas village and a Victorian park (preview assets/three-towns.png).

How the look is built

The late-90s pre-rendered feel is a pipeline, not a filter. Keep all five stages:

  1. Iso world at native tile size. P(a,b,z) = ((a−b)·32, (a+b)·16 − z): 64×32 tiles, a runs to screen lower-right, b to lower-left. Walls are painted in face space (onFace skews a 2D context onto the wall plane), so windows, brick pattern, awnings, ivy and fire escapes sit on the wall correctly.
  2. Baked lighting, like a render. Sun from the left: left faces 1.0, right faces 0.74, tops 1.12. Every wall gets a sky-bounce at the top and ambient occlusion at the base. Windows carry a sky reflection. Buildings cast a hard shadow toward +a whose length scales with height; props get offset contact shadows.
  3. Low-res textures. A 48×48 grain is stamped source-atop over every sprite and over the ground, plus a skewed brick pattern on masonry. Surfaces must never be a flat fill.
  4. Low resolution, hard pixels. The scene is drawn into a buffer at 1/PIX of the window (PIX=2 → ~640×360), at zoom ×2 so one 64×32 tile is exactly 64×32 art pixels, then blown up with imageSmoothingEnabled = false. Zoom is fixed steps (1, 2, 4), like the old games.
  5. Limited palette. Each frame is quantised to 8×9×7 levels with a 4×4 Bayer ordered dither. Gradients, glows and night turn into dither patterns; that's the 256-colour look.

Objects are cached as sprites per zoom and day/night (evicted when offscreen) and depth-sorted each frame with cars and pedestrians by a + b of their centre. Night recolours everything through C() (moonlit mix), bakes lit windows into sprites, then adds lamp/headlight/window glows with lighter.

Workflow

Installs
5
GitHub Stars
8
First Seen
Sep 21, 2026