zx-kit 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **Build browser games that look and sound like a ZX Spectrum — without any of its limitations.**
4
4
 
5
- Three-channel chiptune audio. Pixel-perfect canvas rendering. Authentic 15-color palette. ROM bitmap font. Tile maps with seasonal swapping. Physics-based sprites. Collision detection. A complete retro game engine in a single zero-dependency npm package.
5
+ Three-channel chiptune audio. Pixel-perfect canvas rendering. Authentic 15-color palette. ROM bitmap font. Tile maps with seasonal swapping. Free-roaming sprites with velocity and gravity helpers. Collision detection. A complete retro game toolkit in a single zero-dependency npm package.
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/zx-kit)](https://www.npmjs.com/package/zx-kit)
8
8
  [![license](https://img.shields.io/npm/l/zx-kit)](LICENSE)
@@ -13,7 +13,7 @@ Three-channel chiptune audio. Pixel-perfect canvas rendering. Authentic 15-color
13
13
 
14
14
  The ZX Spectrum was a marvel of constraint. Its 8×8 pixel grid, 15-color palette, and 1-bit beeper defined an entire visual and sonic language. Thousands of games were made with nearly nothing — and they were unforgettable.
15
15
 
16
- zx-kit lets you build in that same visual tradition, but with everything the original hardware was too limited to provide: three-channel AY-3-8912 chiptune audio with hardware-accurate envelopes and LFSR noise, smooth canvas rendering, physics-based sprites, and collision detection — all in TypeScript, all in the browser, all with zero dependencies.
16
+ zx-kit lets you build in that same visual tradition, but with everything the original hardware was too limited to provide: three-channel AY-3-8912 chiptune audio with hardware-accurate envelopes and LFSR noise, smooth canvas rendering, free-roaming sprites with velocity and gravity helpers, and collision detection — all in TypeScript, all in the browser, all with zero dependencies.
17
17
 
18
18
  The goal is simple: **it should look and sound like a Spectrum, but run like a modern game.**
19
19
 
@@ -28,11 +28,11 @@ The goal is simple: **it should look and sound like a Spectrum, but run like a m
28
28
  - **Tile map engine** — scrollable maps, O(1) id-index, smart seasonal background swapping, solid-tile collision queries
29
29
  - **Free-roaming sprites** — position, velocity, gravity, `flipX` caching, transparent or opaque background
30
30
  - **Three-tier collision** — AABB overlap tests, generic rect-vs-tile wall resolution (any sprite size), and pixel-precise mask overlap with O(pixels) sorted-merge intersection — no allocations per frame
31
- - **Keyboard input** — configurable key-repeat, single-consume action flags, instant state reset on phase transitions
31
+ - **Keyboard and gamepad input** — configurable key-repeat, transparent gamepad polling, single-consume action flags, instant state reset on phase transitions
32
32
  - **ZX-style UI widgets** — progress bars with managed lifetime, boxes, frames, panel titles
33
33
  - **Typed save / load** — persistent saves via `localStorage` with schema versioning, migrations, slot enumeration, in-memory throttling, and discriminated Result types for every failure mode
34
34
  - **Runtime locale switching** — type-safe string-pack selection via `pickLocale()`, so a game can switch language while running — unimaginable on the original Spectrum, natural in the browser
35
- - **Zero dependencies** — only Web platform APIs: `Canvas`, `Web Audio`, `KeyboardEvent`
35
+ - **Zero dependencies** — only Web platform APIs: `Canvas`, `Web Audio`, `KeyboardEvent`, `Gamepad`
36
36
  - **Tree-shakeable** — `sideEffects: false`, so unused modules are dropped from your production bundle
37
37
  - **TypeScript-first** — strict mode, full `.d.ts` declarations, no `any`
38
38
 
@@ -44,6 +44,25 @@ The goal is simple: **it should look and sound like a Spectrum, but run like a m
44
44
 
45
45
  ---
46
46
 
47
+ ## Examples
48
+
49
+ The repository includes small static examples that import `../../dist/index.js`
50
+ directly, so each one doubles as a browser-checkable API recipe:
51
+
52
+ | Example | Shows |
53
+ |---------|-------|
54
+ | `examples/ay-music/` | AY channels A/B/C plus beeper SFX as a four-voice Spectrum-style setup |
55
+ | `examples/pixel-collision/` | AABB false positives vs `bitmapPixelMask()` / `masksOverlap()` |
56
+ | `examples/particles/` | Allocation-free particle pools for sparks, smoke, and explosions |
57
+ | `examples/i18n-runtime/` | Runtime language switching with `pickLocale()` and persisted preference |
58
+ | `examples/bitmap-attrs/` | `Bitmap`, `AttrMap`, mirroring, colour clash, and `inkOnly` rendering |
59
+ | `examples/save-slots/` | Save profiles, auto/manual slots, latest-slot restore, throttling, and delete |
60
+
61
+ Build first with `npm run build`, then serve the repository root and open any
62
+ example path in the browser.
63
+
64
+ ---
65
+
47
66
  ## Installation
48
67
 
49
68
  ### From npm (recommended)
@@ -142,7 +161,7 @@ No prior game development experience needed. You need basic JavaScript/TypeScrip
142
161
 
143
162
  | Tool | Where to get it | Why |
144
163
  |------|----------------|-----|
145
- | **Node.js 18+** | [nodejs.org](https://nodejs.org) | Runs npm — the package manager we use to install zx-kit |
164
+ | **Node.js 22+** | [nodejs.org](https://nodejs.org) | Runs npm — the package manager we use to install zx-kit |
146
165
  | **A code editor** | [code.visualstudio.com](https://code.visualstudio.com) (free) | Edits your source files |
147
166
  | **A terminal** | Built into macOS/Linux; use PowerShell on Windows | Runs commands |
148
167
 
@@ -188,7 +207,7 @@ Open `package.json` and replace it with the following. The two key additions are
188
207
  "build": "vite build"
189
208
  },
190
209
  "dependencies": {
191
- "zx-kit": "^0.15.0"
210
+ "zx-kit": "^0.25.0"
192
211
  },
193
212
  "devDependencies": {
194
213
  "vite": "^6.0.0"
@@ -535,10 +554,10 @@ requestAnimationFrame(loop)
535
554
  | Module | What it provides |
536
555
  |--------|-----------------|
537
556
  | [`ay.ts`](#ayts--ay-3-8912-melodik-audio) | AY chip emulator: 3-channel tone, LFSR noise, 16 envelope shapes |
538
- | [`renderer.ts`](#rendererts--canvas-renderer) | Canvas setup, sprites, text, scanlines, border flash |
557
+ | [`renderer.ts`](#rendererts--canvas-renderer) | Canvas setup, 8x8 sprites, arbitrary-size bitmaps, attribute maps, text, scanlines, border flash |
539
558
  | [`audio.ts`](#audiots--beeper-audio) | 1-bit beeper: square-wave notes, patterns, volume control |
540
559
  | [`ui.ts`](#uits--ui-widgets) | Boxes, frames, panel titles, progress bars + instrumentation widgets (dotted grids, segmented bars, fluid tanks, dials, text compass) |
541
- | [`input.ts`](#inputts--keyboard-input) | Movement with key-repeat, action flags, state reset |
560
+ | [`input.ts`](#inputts--keyboard--gamepad-input) | Keyboard/gamepad movement, key-repeat, action flags, state reset |
542
561
  | [`sprite.ts`](#spritets--free-roaming-sprites) | Sprites: position, velocity, gravity, flip, render |
543
562
  | [`collision.ts`](#collisionts--collision-detection) | AABB overlap + rect-based tile resolution, pixel-precise mask overlap and tile checks |
544
563
  | [`animation.ts`](#animationts--frame-timer--tween) | Frame-timer for sprite strips, position tween between two points |
@@ -552,6 +571,7 @@ requestAnimationFrame(loop)
552
571
  | [`palette.ts`](#palettets--color-constants) | 15 Spectrum colors, `SpectrumColor` type, `CELL`, `SCALE` |
553
572
  | [`font.ts`](#fontts--rom-bitmap-font) | 96-character ROM font, raw bitmap access |
554
573
  | [`i18n.ts`](#i18nts--runtime-locale-selection) | Type-safe runtime locale selection for translated string packs |
574
+ | [`lighting.ts`](#lightingts--dithered-cave-darkness) | Dithered cave darkness: pre-baked level tiles + dirty-cell buffer, one blit/frame (no per-frame putImageData) |
555
575
 
556
576
  ---
557
577
 
@@ -907,6 +927,37 @@ curveDisplay(ctx) // default strength
907
927
  curveDisplay(ctx, 256, 208, 6) // stronger warp
908
928
  ```
909
929
 
930
+ ### `Bitmap` interface
931
+
932
+ An arbitrary-size monochrome bitmap. Width must be a positive multiple of 8 so
933
+ each row is byte-aligned. `data` is row-major; bit 7 is the leftmost pixel in
934
+ each byte.
935
+
936
+ ```ts
937
+ interface Bitmap {
938
+ data: Uint8Array
939
+ width: number
940
+ height: number
941
+ }
942
+ ```
943
+
944
+ Use `Bitmap` for 16x16 enemies, 16x24 heroes, 32x32 bosses, tall objects, and
945
+ anything that outgrows the classic 8x8 `drawSprite()` format.
946
+
947
+ ### `createBitmap(data, width, height): Bitmap`
948
+
949
+ Builds a `Bitmap` from packed bytes and validates the dimensions and byte
950
+ count immediately. Throws if width is not byte-aligned, height is invalid, or
951
+ the data length does not match `(width / 8) * height`.
952
+
953
+ ```ts
954
+ const HERO = createBitmap(new Uint8Array([
955
+ 0x03, 0xC0,
956
+ 0x07, 0xE0,
957
+ // ...22 more 16px-wide rows
958
+ ]), 16, 24)
959
+ ```
960
+
910
961
  ### `createBitmapFromRows(rows): Bitmap`
911
962
 
912
963
  Builds an arbitrary-size `Bitmap` from readable pixel-art rows instead of
@@ -949,6 +1000,49 @@ Draws an arbitrary-size `Bitmap`. The colour model has three modes, ordered by h
949
1000
 
950
1001
  `inkOnly` (last parameter, default `false`) **suppresses the paper rectangle even when a `paper` colour is supplied.** For `drawBitmap` this is functionally identical to omitting `paper` — its value is ergonomic: keep a sprite's configured `paper` and toggle the opaque box on or off with a boolean, instead of conditionally choosing whether to pass the argument at the call site.
951
1002
 
1003
+ ### `mirrorBitmap(src): Bitmap`
1004
+
1005
+ Returns a horizontally flipped copy of a `Bitmap`. The original is not
1006
+ modified. Use it at module load time to derive left-facing sprites from one
1007
+ right-facing definition.
1008
+
1009
+ ```ts
1010
+ const HERO_RIGHT = createBitmapFromRows([...])
1011
+ const HERO_LEFT = mirrorBitmap(HERO_RIGHT)
1012
+ ```
1013
+
1014
+ ### `AttrMap` interface
1015
+
1016
+ Per-8x8-cell ink and paper colours for a `Bitmap`, mirroring the ZX Spectrum
1017
+ attribute buffer. `cols` must match `bitmap.width / 8`; `rows` must match
1018
+ `bitmap.height / 8`.
1019
+
1020
+ ```ts
1021
+ interface AttrMap {
1022
+ readonly cols: number
1023
+ readonly rows: number
1024
+ readonly inks: readonly SpectrumColor[]
1025
+ readonly papers?: readonly SpectrumColor[]
1026
+ }
1027
+ ```
1028
+
1029
+ Omit `papers` for transparent per-cell ink rendering, or provide papers for
1030
+ the authentic colour-clash look.
1031
+
1032
+ ### `createAttrMap(cols, rows, inks, papers?): AttrMap`
1033
+
1034
+ Builds an `AttrMap` with validation. `inks` must contain `cols * rows` colours.
1035
+ `papers` can be omitted, supplied as a matching per-cell array, or supplied as
1036
+ one colour to fill every cell.
1037
+
1038
+ ```ts
1039
+ const HERO_ATTRS = createAttrMap(2, 3, [
1040
+ C.B_YELLOW, C.B_YELLOW,
1041
+ C.B_RED, C.B_MAGENTA,
1042
+ C.B_CYAN, C.B_GREEN,
1043
+ ], C.BLACK)
1044
+ ```
1045
+
952
1046
  ### `drawBitmapAttrs(ctx, bitmap, attrs, x, y, inkOnly?): void`
953
1047
 
954
1048
  Renders a `Bitmap` with a per-cell `AttrMap` — each 8×8 cell carries its own `(ink, paper)`, the authentic Spectrum attribute model. Here `inkOnly` is **not** redundant: it keeps every per-cell *ink* colour but skips all per-cell *paper* fills. One fully-coloured `AttrMap` (with `papers` for the boxed look on a plain background) then renders two ways — flip `inkOnly` per frame, with no second paper-less map to build and keep in sync. Dimension validation still throws under `inkOnly`: the flag changes what is painted, never the contract.
@@ -960,6 +1054,17 @@ drawBitmapAttrs(ctx, BUNNY, BUNNY_ATTRS, x, y, true)
960
1054
  // the cave behind it. The rabbit reads by its own silhouette.
961
1055
  ```
962
1056
 
1057
+ ### `mirrorAttrMap(attrs): AttrMap`
1058
+
1059
+ Returns a horizontally flipped copy of an `AttrMap`, reversing each attribute
1060
+ row. Pair it with `mirrorBitmap()` so a mirrored sprite keeps its colours on
1061
+ the matching 8x8 cells.
1062
+
1063
+ ```ts
1064
+ const HERO_LEFT = mirrorBitmap(HERO_RIGHT)
1065
+ const HERO_LEFT_ATTRS = mirrorAttrMap(HERO_RIGHT_ATTRS)
1066
+ ```
1067
+
963
1068
  ### Why does `inkOnly` exist? (and why is it, honestly, a little bit of debt?)
964
1069
 
965
1070
  This is the kind of decision worth writing down, because the "obvious" answer is the wrong one.
@@ -1148,6 +1253,8 @@ Five stateless primitives for HUDs, dashboards and tactical displays — gauges,
1148
1253
 
1149
1254
  #### `drawDottedGrid(ctx, options): void`
1150
1255
 
1256
+ Options type: `DrawDottedGridOptions`.
1257
+
1151
1258
  Regularly-spaced dot pattern. Useful for radar / sonar screens, tactical scanner overlays, debug grids, stippled backgrounds, alien-invasion detection grids.
1152
1259
 
1153
1260
  ```ts
@@ -1174,6 +1281,8 @@ drawDottedGrid(ctx, {
1174
1281
 
1175
1282
  #### `drawSegmentedBar(ctx, options): void`
1176
1283
 
1284
+ Options type: `DrawSegmentedBarOptions`.
1285
+
1177
1286
  Discrete segmented bar — health, ammo, shield, fuel, stamina, mana, battery, damage. Computes `round(value/max * segments)` filled segments.
1178
1287
 
1179
1288
  Two colouring strategies, mutually exclusive:
@@ -1217,6 +1326,8 @@ drawSegmentedBar(ctx, {
1217
1326
 
1218
1327
  #### `drawTank(ctx, options): void`
1219
1328
 
1329
+ Options type: `DrawTankOptions`.
1330
+
1220
1331
  Fluid container — ballast tanks, fuel gauges, water reservoirs, lava levels, oil drums, chemical canisters. Liquid fills from the bottom up.
1221
1332
 
1222
1333
  ```ts
@@ -1250,6 +1361,8 @@ drawTank(ctx, {
1250
1361
 
1251
1362
  #### `drawDial(ctx, options): void`
1252
1363
 
1364
+ Options type: `DrawDialOptions`.
1365
+
1253
1366
  Circular analog gauge with movable needle — RPM, speedometer, fuel, temperature, volume knob. Decorations (face fill, rim outline, tick marks) are optional; the needle alone is the minimum visible output.
1254
1367
 
1255
1368
  ```ts
@@ -1288,6 +1401,8 @@ Angles use canvas convention: `0` = right, `π/2` = down, `π` = left, `3π/2` =
1288
1401
 
1289
1402
  #### `drawCompassText(ctx, options): void`
1290
1403
 
1404
+ Options type: `DrawCompassTextOptions`.
1405
+
1291
1406
  Text-based heading indicator in the classic 80s tactical-display style `[W [NW] N [NE] E]` — current direction in the centre, highlighted, with two neighbouring directions on each side. Heading rounds to the nearest 45° step.
1292
1407
 
1293
1408
  ```ts
@@ -1365,9 +1480,11 @@ appPhase = 'intro'
1365
1480
 
1366
1481
  ---
1367
1482
 
1368
- ## `input.ts` — Keyboard Input
1483
+ ## `input.ts` — Keyboard & Gamepad Input
1369
1484
 
1370
- Handles directional movement with configurable key-repeat (immediate on first press, configurable auto-repeat delay on hold) plus single-consume flags for action keys. Call `initInput()` once at startup, then `tickMovement(dt)` every frame.
1485
+ Handles directional movement with configurable keyboard repeat, transparent
1486
+ gamepad polling, and single-consume flags for action buttons. Call
1487
+ `initInput()` once at startup, then `tickMovement(dt)` every frame.
1371
1488
 
1372
1489
  ### `Direction` type
1373
1490
 
@@ -1381,6 +1498,11 @@ Attaches `keydown`/`keyup` listeners. Idempotent — safe to call multiple times
1381
1498
 
1382
1499
  Default key bindings: arrows = movement, `W A S D` = also movement, `F` = flag action, `P` = pause, `Ctrl+Shift+B` = debug toggle.
1383
1500
 
1501
+ Gamepad support is automatic. `tickMovement()` polls the first connected
1502
+ gamepad via the browser Gamepad API: D-pad / left stick move, button 0 maps to
1503
+ `consumeFlag()`, button 9 maps to `consumePause()`, button 3 maps to
1504
+ `consumeDebug()`, and any button triggers `consumeAnyKey()`.
1505
+
1384
1506
  ```ts
1385
1507
  initInput() // default: 150ms initial delay, 80ms repeat
1386
1508
  initInput(200, 60) // custom timing
@@ -1388,7 +1510,9 @@ initInput(200, 60) // custom timing
1388
1510
 
1389
1511
  ### `tickMovement(dtMs): Direction | null`
1390
1512
 
1391
- Returns the active movement direction for this frame, or `null`. Handles the delay/repeat state machine internally. Call exactly once per frame.
1513
+ Returns the active movement direction for this frame, or `null`. Handles the
1514
+ keyboard delay/repeat state machine and gamepad polling internally. Call
1515
+ exactly once per frame.
1392
1516
 
1393
1517
  ```ts
1394
1518
  const dir = tickMovement(dt)
@@ -1404,10 +1528,10 @@ Each function returns `true` exactly once per key press, then resets to `false`.
1404
1528
 
1405
1529
  | Function | Default key | Typical use |
1406
1530
  |----------|-------------|-------------|
1407
- | `consumeFlag()` | `F` | Flag / unflag a tile |
1408
- | `consumePause()` | `P` | Pause / unpause |
1409
- | `consumeDebug()` | `Ctrl+Shift+B` | Toggle debug overlay |
1410
- | `consumeAnyKey()` | Any key | Dismiss overlays, start game |
1531
+ | `consumeFlag()` | `F` / gamepad button 0 | Flag / unflag a tile |
1532
+ | `consumePause()` | `P` / gamepad button 9 | Pause / unpause |
1533
+ | `consumeDebug()` | `Ctrl+Shift+B` / gamepad button 3 | Toggle debug overlay |
1534
+ | `consumeAnyKey()` | Any key / any gamepad button | Dismiss overlays, start game |
1411
1535
 
1412
1536
  ```ts
1413
1537
  if (consumeFlag()) toggleFlag(playerX, playerY)
@@ -1921,6 +2045,23 @@ for (const e of enemies) {
1921
2045
  | `deadzoneW`, `deadzoneH` | Deadzone size — target may move ±`deadzoneW/2` from centre before scrolling |
1922
2046
  | `targetX`, `targetY` | Current follow target (set via `setCameraTarget`) |
1923
2047
 
2048
+ ### `CameraOptions` interface
2049
+
2050
+ Options passed to `createCamera()`. `viewW`, `viewH`, `worldW`, and `worldH`
2051
+ are required; `lerp`, `deadzoneW`, and `deadzoneH` are optional.
2052
+
2053
+ ```ts
2054
+ interface CameraOptions {
2055
+ viewW: number
2056
+ viewH: number
2057
+ worldW: number
2058
+ worldH: number
2059
+ lerp?: number
2060
+ deadzoneW?: number
2061
+ deadzoneH?: number
2062
+ }
2063
+ ```
2064
+
1924
2065
  ### `createCamera(opts): Camera`
1925
2066
 
1926
2067
  Creates a camera at world origin `(0, 0)`. `lerp` defaults to `1` (snap), deadzones default to `0`.
@@ -2377,13 +2518,23 @@ interface ParticleSystem {
2377
2518
  }
2378
2519
  ```
2379
2520
 
2521
+ ### `Ranged` type
2522
+
2523
+ Several emitter options accept either a fixed value or a `[min, max]` range.
2524
+
2525
+ ```ts
2526
+ type Ranged = number | readonly [number, number]
2527
+ ```
2528
+
2380
2529
  ### `createParticleSystem(capacity): ParticleSystem`
2381
2530
 
2382
2531
  Creates a pool of `capacity` particles, all inactive. Throws when `capacity` is not a positive integer.
2383
2532
 
2384
2533
  ### `emitParticles(ps, opts): number`
2385
2534
 
2386
- Emits up to `opts.count` particles and returns the number actually emitted (fewer when the pool is full). Throws when `count` is negative or non-integer.
2535
+ Emits up to `opts.count` particles and returns the number actually emitted
2536
+ (fewer when the pool is full). Throws when `count` is negative or non-integer.
2537
+ The options object is exported as `EmitOptions`.
2387
2538
 
2388
2539
  | Option | Type | Default | Meaning |
2389
2540
  |--------|------|---------|---------|
@@ -2469,6 +2620,55 @@ Hashes a string to an unsigned 32-bit integer (FNV-1a). Deterministic; exported
2469
2620
 
2470
2621
  ---
2471
2622
 
2623
+ ## `lighting.ts` — Dithered Cave Darkness
2624
+
2625
+ The ZX way to fake light: hard 8×8 light pools with an ordered (Bayer) **dither** edge — no alpha gradients. The look of *Knight Lore* / *Head over Heels*, not modern soft shadows.
2626
+
2627
+ Done the naive way (recompute a full-screen `ImageData` and `putImageData` it every frame) this is a real CPU/upload hog — it measured ~27% of a frame in an actual game. This module instead **pre-renders the dither for each darkness level to a tiny tile, darkens the view cell-by-cell into a persistent buffer (repainting only cells whose level changed), and blits the buffer with one `drawImage`** — no per-frame `putImageData`.
2628
+
2629
+ You own the *policy* (where it's dark) via a per-cell callback; the module owns the fast *rendering*.
2630
+
2631
+ ### `Light` interface
2632
+
2633
+ ```ts
2634
+ interface Light { x: number; y: number; radius: number; intensity: number } // intensity 0..1
2635
+ ```
2636
+
2637
+ ### `brightnessAt(px, py, lights): number`
2638
+
2639
+ Brightest attenuated light at a point — `max((1 - dist/radius) * intensity)` over all lights, clamped to `0..1`. Turn it into darkness with `1 - brightnessAt(...)`. Pure.
2640
+
2641
+ ### `ditherBlack(px, py, amount): boolean`
2642
+
2643
+ The ordered-dither rule used to bake the tiles: is pixel `(px, py)` black at darkness `amount` (0..1)? Pure and deterministic — handy for tests or custom effects.
2644
+
2645
+ ### `createDarknessLayer(width, height, levels?): DarknessLayer`
2646
+
2647
+ Builds a view-sized overlay: pre-bakes `levels` dither tiles (default **8** — more = smoother), a persistent buffer, and a per-cell level cache. Call **once**; reuse across frames. Throws if `levels < 2`.
2648
+
2649
+ ### `renderDarkness(layer, ctx, darknessAt): void`
2650
+
2651
+ Darkens `ctx` for this frame. `darknessAt(col, row)` returns the darkness of each 8×8 cell — **0 = lit, 1 = pitch black** (clamped, then quantised to the layer's levels). Only cells whose level changed since the last call are repainted; then the buffer is blitted once.
2652
+
2653
+ ```ts
2654
+ import { createDarknessLayer, renderDarkness, brightnessAt, CELL } from 'zx-kit'
2655
+
2656
+ const dark = createDarknessLayer(256, 192) // once
2657
+
2658
+ // each frame, after drawing the scene, before the HUD:
2659
+ const lights = [{ x: playerX, y: playerY, radius: 72, intensity: 1 }]
2660
+ renderDarkness(dark, ctx, (col, row) => {
2661
+ const b = brightnessAt(col * CELL + 4, row * CELL + 4, lights)
2662
+ return 1 - b // 0 = lit … 1 = dark
2663
+ })
2664
+ ```
2665
+
2666
+ The `darknessAt` callback is where you add **depth gradients** (darker the deeper you are), fog, flashing — anything; the renderer stays fast because it only repaints cells whose quantised level actually changed.
2667
+
2668
+ > Lights are in **screen** pixels (apply the camera yourself). Rendering needs a real canvas; in a headless test environment the layer degrades to a no-op blit while the level math still runs.
2669
+
2670
+ ---
2671
+
2472
2672
  ## Architecture
2473
2673
 
2474
2674
  ### Module structure
package/dist/index.d.ts CHANGED
@@ -16,4 +16,5 @@ export * from './camera.js';
16
16
  export * from './scene.js';
17
17
  export * from './save.js';
18
18
  export * from './i18n.js';
19
+ export * from './lighting.js';
19
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA"}
package/dist/index.js CHANGED
@@ -16,4 +16,5 @@ export * from './camera.js';
16
16
  export * from './scene.js';
17
17
  export * from './save.js';
18
18
  export * from './i18n.js';
19
+ export * from './lighting.js';
19
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA"}
@@ -0,0 +1,45 @@
1
+ /** A point light: position (screen px), reach `radius` (px) and `intensity` 0..1. */
2
+ export interface Light {
3
+ x: number;
4
+ y: number;
5
+ radius: number;
6
+ intensity: number;
7
+ }
8
+ /**
9
+ * The ordered-dither rule: is pixel `(px, py)` black at darkness `amount` (0..1)?
10
+ * Pure and deterministic — used to bake the level tiles, and handy to test.
11
+ */
12
+ export declare function ditherBlack(px: number, py: number, amount: number): boolean;
13
+ /**
14
+ * Brightest attenuated light at a point: `max((1 - dist/radius) * intensity)`
15
+ * over all lights, clamped to 0..1. Turn it into darkness with `1 - brightnessAt(...)`.
16
+ */
17
+ export declare function brightnessAt(px: number, py: number, lights: readonly Light[]): number;
18
+ /** A view-sized darkness overlay with pre-baked dither tiles + a cached buffer. */
19
+ export interface DarknessLayer {
20
+ readonly width: number;
21
+ readonly height: number;
22
+ readonly levels: number;
23
+ readonly cols: number;
24
+ readonly rows: number;
25
+ /** Pre-rendered 8×8 dither tiles, index 0 (lit, `null`) … levels-1 (darkest). */
26
+ readonly tiles: ReadonlyArray<HTMLCanvasElement | null>;
27
+ /** Persistent darkness buffer (view-sized), blitted each frame. */
28
+ readonly buffer: HTMLCanvasElement | null;
29
+ /** Last level drawn per cell, row-major; -1 = never drawn (forces a repaint). */
30
+ readonly cellLevel: Int16Array;
31
+ }
32
+ /**
33
+ * Creates a darkness layer sized to the view. `levels` is the number of darkness
34
+ * steps (default 8) — more is a smoother dither for a little more memory. Call
35
+ * once; reuse across frames.
36
+ */
37
+ export declare function createDarknessLayer(width: number, height: number, levels?: number): DarknessLayer;
38
+ /**
39
+ * Renders dithered darkness onto `ctx`. `darknessAt(col, row)` returns the
40
+ * darkness of each 8×8 cell: **0 = lit**, **1 = pitch black** (values are clamped
41
+ * and quantised to the layer's `levels`). Only cells whose level changed since the
42
+ * last call are repainted on the cached buffer; the buffer is then blitted once.
43
+ */
44
+ export declare function renderDarkness(layer: DarknessLayer, ctx: CanvasRenderingContext2D, darknessAt: (col: number, row: number) => number): void;
45
+ //# sourceMappingURL=lighting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lighting.d.ts","sourceRoot":"","sources":["../src/lighting.ts"],"names":[],"mappings":"AAkCA,qFAAqF;AACrF,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB;AAMD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAE3E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,MAAM,CAarF;AAED,mFAAmF;AACnF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,iFAAiF;IACjF,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IACvD,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAA;IACzC,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAA;CAC/B;AAmBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,aAAa,CAkB5F;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,wBAAwB,EAC7B,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,GAC/C,IAAI,CAwBN"}
@@ -0,0 +1,138 @@
1
+ /**
2
+ * @module lighting
3
+ *
4
+ * **Dithered cave darkness** — the ZX way to fake light: hard 8×8 light pools
5
+ * with an ordered (Bayer) dither edge, no alpha gradients. Think *Knight Lore*,
6
+ * not modern soft shadows.
7
+ *
8
+ * Built for speed. The naive way (recompute a full-screen `ImageData` and
9
+ * `putImageData` it every frame) is a CPU/upload hog — it was ~27% of a frame in
10
+ * a real game. Instead:
11
+ *
12
+ * 1. The dither for each darkness **level** is pre-rendered once to a tiny 8×8
13
+ * tile ({@link createDarknessLayer}).
14
+ * 2. The view is darkened **cell by cell** into a persistent buffer, and only
15
+ * cells whose level **changed** since the last frame are repainted.
16
+ * 3. The whole buffer is blitted with **one `drawImage`** — no per-frame
17
+ * `putImageData`.
18
+ *
19
+ * The game supplies a per-cell darkness via a callback, so it owns the *policy*
20
+ * (lights, depth gradients, fog…) while this module owns the fast *rendering*.
21
+ * {@link brightnessAt} is a ready helper for the common "pools of light" case.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const dark = createDarknessLayer(256, 192) // once, view-sized
26
+ * // each frame, after drawing the scene:
27
+ * renderDarkness(dark, ctx, (col, row) => {
28
+ * const b = brightnessAt(col * CELL + 4, row * CELL + 4, lights)
29
+ * return 1 - b // 0 = lit, 1 = pitch black
30
+ * })
31
+ * ```
32
+ */
33
+ import { CELL } from './palette.js';
34
+ // Dispersed 4×4 Bayer matrix (values 0..15), row-major — drives the stipple.
35
+ // 8×8 cells are a multiple of 4, so tiles dither seamlessly across cell borders.
36
+ const BAYER4 = [0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5];
37
+ /**
38
+ * The ordered-dither rule: is pixel `(px, py)` black at darkness `amount` (0..1)?
39
+ * Pure and deterministic — used to bake the level tiles, and handy to test.
40
+ */
41
+ export function ditherBlack(px, py, amount) {
42
+ return (BAYER4[((py & 3) << 2) | (px & 3)] + 0.5) / 16 < amount;
43
+ }
44
+ /**
45
+ * Brightest attenuated light at a point: `max((1 - dist/radius) * intensity)`
46
+ * over all lights, clamped to 0..1. Turn it into darkness with `1 - brightnessAt(...)`.
47
+ */
48
+ export function brightnessAt(px, py, lights) {
49
+ let b = 0;
50
+ for (const l of lights) {
51
+ if (l.radius <= 0)
52
+ continue;
53
+ const dx = px - l.x;
54
+ const dy = py - l.y;
55
+ const d = Math.sqrt(dx * dx + dy * dy);
56
+ if (d < l.radius) {
57
+ const c = (1 - d / l.radius) * l.intensity;
58
+ if (c > b)
59
+ b = c;
60
+ }
61
+ }
62
+ return b > 1 ? 1 : b < 0 ? 0 : b;
63
+ }
64
+ /** Bakes one 8×8 dither tile for darkness `amount`, or `null` when fully lit. */
65
+ function makeTile(amount) {
66
+ if (amount <= 0 || typeof document === 'undefined')
67
+ return null;
68
+ const c = document.createElement('canvas');
69
+ c.width = CELL;
70
+ c.height = CELL;
71
+ const ctx = c.getContext('2d');
72
+ if (!ctx)
73
+ return null;
74
+ ctx.fillStyle = '#000';
75
+ for (let y = 0; y < CELL; y++) {
76
+ for (let x = 0; x < CELL; x++) {
77
+ if (ditherBlack(x, y, amount))
78
+ ctx.fillRect(x, y, 1, 1);
79
+ }
80
+ }
81
+ return c;
82
+ }
83
+ /**
84
+ * Creates a darkness layer sized to the view. `levels` is the number of darkness
85
+ * steps (default 8) — more is a smoother dither for a little more memory. Call
86
+ * once; reuse across frames.
87
+ */
88
+ export function createDarknessLayer(width, height, levels = 8) {
89
+ if (!Number.isInteger(levels) || levels < 2) {
90
+ throw new Error(`createDarknessLayer: levels must be an integer >= 2, got ${levels}`);
91
+ }
92
+ const cols = Math.ceil(width / CELL);
93
+ const rows = Math.ceil(height / CELL);
94
+ const tiles = [];
95
+ for (let i = 0; i < levels; i++)
96
+ tiles.push(makeTile(i / (levels - 1)));
97
+ let buffer = null;
98
+ if (typeof document !== 'undefined') {
99
+ buffer = document.createElement('canvas');
100
+ buffer.width = width;
101
+ buffer.height = height;
102
+ }
103
+ const cellLevel = new Int16Array(cols * rows).fill(-1);
104
+ return { width, height, levels, cols, rows, tiles, buffer, cellLevel };
105
+ }
106
+ /**
107
+ * Renders dithered darkness onto `ctx`. `darknessAt(col, row)` returns the
108
+ * darkness of each 8×8 cell: **0 = lit**, **1 = pitch black** (values are clamped
109
+ * and quantised to the layer's `levels`). Only cells whose level changed since the
110
+ * last call are repainted on the cached buffer; the buffer is then blitted once.
111
+ */
112
+ export function renderDarkness(layer, ctx, darknessAt) {
113
+ const { buffer, tiles, levels, cols, rows, cellLevel } = layer;
114
+ const bctx = buffer ? buffer.getContext('2d') : null;
115
+ const maxLevel = levels - 1;
116
+ for (let row = 0; row < rows; row++) {
117
+ for (let col = 0; col < cols; col++) {
118
+ let a = darknessAt(col, row);
119
+ a = a < 0 ? 0 : a > 1 ? 1 : a;
120
+ const level = Math.round(a * maxLevel);
121
+ const idx = row * cols + col;
122
+ if (cellLevel[idx] === level)
123
+ continue; // unchanged → skip the repaint
124
+ cellLevel[idx] = level;
125
+ if (bctx) {
126
+ const x = col * CELL;
127
+ const y = row * CELL;
128
+ bctx.clearRect(x, y, CELL, CELL);
129
+ const tile = tiles[level];
130
+ if (tile)
131
+ bctx.drawImage(tile, x, y);
132
+ }
133
+ }
134
+ }
135
+ if (buffer)
136
+ ctx.drawImage(buffer, 0, 0);
137
+ }
138
+ //# sourceMappingURL=lighting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lighting.js","sourceRoot":"","sources":["../src/lighting.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAUnC,6EAA6E;AAC7E,iFAAiF;AACjF,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAU,CAAA;AAE9E;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU,EAAE,EAAU,EAAE,MAAc;IAChE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAE,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,MAAM,CAAA;AAClE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,EAAU,EAAE,EAAU,EAAE,MAAwB;IAC3E,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC;YAAE,SAAQ;QAC3B,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;QACnB,MAAM,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AC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;gBAChC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAA;gBACzB,IAAI,IAAI;oBAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;YACtC,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,MAAM;QAAE,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;AACzC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zx-kit",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/zrebec/zx-kit.git"