plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


1164924 — Peter John 2026-10-26T10:52:35+05:30
docs(plans): fix wasm i32 wording in game plan
docs/plans/2026-10-26-game-engine.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Plum for games: browser-first macroquad host, port of a simplified KaM
2
2
 
3
3
  **Status:** draft. Planned only and not run; the user has more ideas to fold in first.
4
- **Depends on:** `2026-10-26-zig-generics-and-numbers.md`, which supplies duck-typed per-type-copy generics, no traits (enums plus duck-typed operator methods), native typed arrays, and `Int`/`Float` kept as i64/f64 with `Int` narrowed to Int at `extern fun` boundaries (no JS BigInt in the browser bridge). That plan runs first.
4
+ **Depends on:** `2026-10-26-zig-generics-and-numbers.md`, which supplies duck-typed per-type-copy generics, no traits (enums plus duck-typed operator methods), native typed arrays, and `Int`/`Float` kept as i64/f64 with `Int` narrowed to wasm i32 at `extern fun` boundaries (no JS BigInt in the browser bridge). That plan runs first.
5
5
  **Goal:** Port `../kam_macroquad`, a 98k-line Rust/macroquad remake of Knights and Merchants that already runs in the browser via wasm, to Plum as a **simplified** game. There is no mission scripting (rhai) and the rules are simpler, but animations and sounds stay identical. It runs in the browser first.
6
6
  **Architecture:** the Rust/macroquad host keeps asset decoding, audio and the window, compiled to wasm32 for the web or native. The Plum wasm-gc module owns game state, rules, pathfinding, AI, animation timing and per-frame draw calls. On the web the two modules talk through JS (miniquad plugin), and natively through wasmtime.
7
7
  **Detail:** tests
@@ -71,7 +71,7 @@ Success criteria:
71
71
  - Both suites (`cargo test --workspace`, `plum test plum-std plum-examples`) are green after every task.
72
72
  - The `plum-game` crate builds for `wasm32-unknown-unknown` (web) and native. CI runs the native headless tests.
73
73
  - The asset files are read from `../kam_macroquad/assets` through the host. They are never copied into this repo, because of licensing.
74
- - Plum code uses `Int` (i64) and `Float` (f64). The extern API declares `Int`/`Float`, the compiler narrows `Int` to Int at the boundary, and the host converts `Float` to macroquad's Float.
74
+ - Plum code uses `Int` (i64) and `Float` (f64). The extern API declares `Int`/`Float`, the compiler narrows `Int` to wasm i32 at the boundary, and the host converts `Float` to macroquad's f32.
75
75
 
76
76
  ## Tasks
77
77
 
@@ -109,7 +109,7 @@ flowchart LR
109
109
  - `Random(seed)`.
110
110
 
111
111
  Tests:
112
- - `array_i32_native` (the wasm declares `array (mut i64)`);
112
+ - `array_int_native` (the wasm declares `array (mut i64)`);
113
113
  - `heap_pop_order` on 1000 random keys;
114
114
  - `deque_wraparound`;
115
115
  - `set_dedup`;