Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,090 changes: 159 additions & 1,931 deletions CHANGELOG.md

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,28 @@ Box2D v3.1.0 (fetched by CMake)
The shim compiles into one shared library (`libbox2dxt.{so,dylib,dll}`) that **ships bundled
INSIDE the extension** under `src/code/<arch>-<platform>/box2dxt.{so,dll,dylib}` (bare token,
no `lib` prefix; platform-ids `x86_64-linux` / `x86-linux` / `x86_64-win32` / `x86-win32` /
`universal-mac`, architecture FIRST, Windows `-win32` for both bitnesses). `tools/package-extension.py`
lays the `prebuilt/` binaries into that tree; installing the packaged extension makes the engine
`universal-mac`, architecture FIRST, Windows `-win32` for both bitnesses). Those libraries are
**committed** (built and tested by CI, attached to each Release); `tools/package-extension.py`
refreshes that tree from a newer build. Installing the packaged extension makes the engine
resolve the `c:box2dxt>` bindings via `the revLibraryMapping` automatically — **no loose library,
no rename, no sudo/`/usr/lib`/`LD_LIBRARY_PATH`** (see `docs/building.md`).
- **LCB binding** (`src/box2dxt.lcb`, `library org.openxtalk.box2dxt`): declares `foreign handler`
bindings to the shared library and public `b2PascalCase` handlers callable from xTalk. This API
speaks **metres and radians**; body type codes are `0=static, 1=kinematic, 2=dynamic`.
- **The Kit** (`src/box2dxt-kit.livecodescript`): a pure-xTalk convenience layer (312 `b2k*`
- **The Kit** (`src/box2dxt-kit.livecodescript`): a pure-xTalk convenience layer (313 `b2k*`
handlers incl. the game modules: input, sprites, player controller, camera) that speaks
**screen pixels and degrees**, binds bodies to LiveCode controls, and runs the animation
loop. This is what the examples and most users actually call.

Docs live in `docs/` (`architecture.md`, `building.md`, `getting-started.md`, `api-reference.md`,
`kit-guide.md`, `kit-reference.md`, `asset-expansion-plan.md`, and `platformer-polish-plan.md` — the
forward-looking plan now that feature dev is frozen; the superseded pre-implementation
`game-engine-spec.md` + `expansion-prep.md` are under `docs/archive/`). Prebuilt per-platform
binaries are in `prebuilt/` — the SOURCE `tools/package-extension.py` lays into the extension's
`src/code/<arch>-<platform>/` tree; the install is the packaged extension, not a loose drop-in (a
loose `box2dxt.{so,dll,dylib}` beside a saved stack is only the dev/fallback path, mapped at runtime
by the Kit's `b2kEnsureNativeLib`). The **Game Kit** (input/sprites/player/camera/sound modules) is
`game-engine-spec.md` + `expansion-prep.md` are under `docs/archive/`). The per-platform native
binaries are **committed inside the extension** at `src/code/<arch>-<platform>/` (built and tested by
CI, attached to each Release); `tools/package-extension.py` refreshes that tree from a newer build.
The install is the packaged extension, not a loose drop-in (a loose `box2dxt.{so,dll,dylib}` beside a
saved stack — copied from `src/code/<arch>-<platform>/` — is only the dev/fallback path, mapped at
runtime by the Kit's `b2kEnsureNativeLib`). The **Game Kit** (input/sprites/player/camera/sound modules) is
implemented and user-verified; content **Waves 0-7 are built** (Wave 8, builder cross-pollination, is
the only remaining roadmap item); `plan.md`'s decision log is the as-built record. Six examples: demo,
contraption builder, **spike-gamekit** (the Phase-0 Game Kit harness), **platformer** (the flagship
Expand Down
8 changes: 5 additions & 3 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ How the pieces fit, why the shim exists, and how to extend the binding.
in `src/code/<arch>-<platform>/box2dxt.{so,dll,dylib}` (bare token, no `lib`
prefix; platform-ids `x86_64-linux`, `x86-linux`, `x86_64-win32`, `x86-win32`,
`universal-mac` — architecture first, Windows `-win32` for both bitnesses).
`tools/package-extension.py` populates that tree from `prebuilt/`.
Those libraries are committed (built and tested by CI, and attached to each
Release); `tools/package-extension.py` refreshes the tree from a newer build.
- **`src/box2dxt.lcb`** is the xTalk Builder (LCB) extension. It declares
`private foreign handler` bindings to the `b2lc_*` symbols
(`binds to "c:box2dxt>b2lc_…!cdecl"`) and wraps each in a friendly public
Expand Down Expand Up @@ -125,8 +126,9 @@ Exposing more of Box2D is mechanical. To add a handler:
handles like the rest).
3. **Bump `LC_ABI_VERSION`** in the shim if the exported ABI changed.
4. **Rebuild** the native library (see [building.md](building.md)), re-run
`tools/package-extension.py` to refresh the bundled `src/code/<arch>-<platform>/`
copy, then re-Package (or **Test**) the extension so the new library loads. (For
`tools/package-extension.py --linux64 build/libbox2dxt.so` (or the flag for your
platform) to refresh the bundled `src/code/<arch>-<platform>/` copy, then
re-Package (or **Test**) the extension so the new library loads. (For
quick iteration, dropping the rebuilt `box2dxt.{so,dll,dylib}` beside a saved
stack picks it up via `b2kEnsureNativeLib` without repackaging.)

Expand Down
2 changes: 1 addition & 1 deletion docs/archive/expansion-prep.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ that keep the expansion as reliable as the engine underneath it.
| Wave 7 | **COMPLETE — statically verified, merged** (the desert biome: **L5 SCORCHED DUNES** — the platformer's fifth level, sand/desert). |
| Wave 8 | **NOT STARTED** — builder cross-pollination (animated sprite parts + the player-as-a-part in the Contraption Builder); the only remaining roadmap item. |
| Next | Wave 8: the builder cross-pollination. |
| Companions | [plan.md](../plan.md) (history/decision log) · [game-engine-spec.md](game-engine-spec.md) (module design) |
| Companions | [plan.md](../../plan.md) (history/decision log) · [game-engine-spec.md](game-engine-spec.md) (module design) |

---

Expand Down
6 changes: 3 additions & 3 deletions docs/archive/game-engine-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

| | |
|---|---|
| Status | **Implemented and user-verified on Win32 (2026-06-11)** — all four modules + audio shipped; as-built deltas live in [plan.md](../plan.md)'s decision log; runtime behaviour is asserted by `examples/box2dxt-selftest.livecodescript` (harness v22, ~180 checks across 37 test handlers, having grown with the content waves). macOS/Linux passes still open (risk R1). |
| Status | **Implemented and user-verified on Win32 (2026-06-11)** — all four modules + audio shipped; as-built deltas live in [plan.md](../../plan.md)'s decision log; runtime behaviour is asserted by `examples/box2dxt-selftest.livecodescript` (harness v22, ~180 checks across 37 test handlers, having grown with the content waves). macOS/Linux passes still open (risk R1). |
| Scope | New `b2k…` modules in the Kit: **Input**, **Sprites**, **Player**, **Camera** |
| Native impact | **None.** No C-shim or LCB changes; ABI stays at 4 |
| Companion | [plan.md](../plan.md) — the phased implementation plan |
| Companion | [plan.md](../../plan.md) — the phased implementation plan |

The end goal: make Box2Dxt + xTalk a credible **2D game engine** — you should be
able to build a small platformer (an animated character running and jumping
Expand Down Expand Up @@ -505,7 +505,7 @@ not the card, when the camera is on).

## 11. Out of scope (for now)

Deliberately not in this spec, sketched as later phases in [plan.md](../plan.md):
Deliberately not in this spec, sketched as later phases in [plan.md](../../plan.md):

- **Tilemaps / level editor** — `b2kChain` terrain + IDE-placed controls +
`b2kCamAdopt` cover small levels; a tile pipeline is its own design.
Expand Down
69 changes: 22 additions & 47 deletions docs/asset-expansion-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

> **STATUS (frozen): Phases A–G shipped — the demo grew from 5 to SEVEN polished
> levels.** Forward feature development is now **stopped** for a polish pass (see
> [`platformer-polish-plan.md`](platformer-polish-plan.md)). The remaining phases
> below (**H** Clocktown — *attempted and rolled back*, **I** alien-swim, **J**
> stretch) are **not being pursued**; they're kept as an as-built record and a
> "if we ever resume" appendix. The canonical history is
> [`../CHANGELOG.md`](../CHANGELOG.md) + [`../plan.md`](../plan.md).
> [`platformer-polish-plan.md`](platformer-polish-plan.md)). The once-planned
> Phases **H** (Clocktown — *attempted and rolled back*), **I** (alien-swim) and
> **J** (stretch) are **not being pursued** and have been dropped from this plan;
> the assets they would have used are still catalogued in §1. The canonical
> history is [`../CHANGELOG.md`](../CHANGELOG.md) + [`../plan.md`](../plan.md).

The platformer demo now ships **seven polished levels** (it shipped five when this
roadmap was written). This document was the roadmap that grew it — an audit of
Expand Down Expand Up @@ -323,29 +323,14 @@ needs an OXT eye.
(the plain portraits read cleaner at HUD scale). *OXT to confirm:* each skin
animates cleanly across idle/walk/jump/duck/climb.

### Phase H — The Village biome → **Level 8 "CLOCKTOWN"** (L)
- **Assets:** the whole **`spritesheet.xml`** city set (house walls/roofs in 3
palettes, awnings, chimneys, `clock`, fences, doors, shop signs, windows).
- A **town** level — rooftops, awnings to bounce/clamber, a clocktower set-piece.
A distinct art style (needs its own atlas load + a `gCityOK` capability gate).
- *Heaviest art-integration phase; its own backdrop (`background_solid_sky`/clouds).*

### Phase I — The Alien world & a swim hero (M–L)
- **Assets:** `aliens.xml` / `alien*.xml` (alien heroes **with swim frames**),
`items_sheet` water props.
- The Kenney `character_*` hero has **no swim frames** (the Kit falls back to
idle/jump in water). An **alien hero** has `_swim1/2` — ideal for a **water-world**
level (extended swim, currents via Phase-B conveyors underwater, the new fish).
Pairs naturally with the Phase-G character select (pick an alien for the water world).

### Phase J — Stretch / quality (varies)
- **True multi-layer parallax:** needs *transparent* overlay art (cloud/fog bands).
Source or author a transparent layer; then layer it over the Phase-A biome scene
at a different drift rate. (`items_sheet` `cloud1/2/3` may serve.)
- **Hi-DPI pass:** the `-double` 2× sheets for crisp art on high-density displays.
- **Effects:** `items_sheet` `particle*` (brick debris), `springboardUp/Down`
(animated springboard), `weightChained` (alt thwomp art).
- **`enemies_sheet` blocker/poker** as a distinct foe set if a theme wants them.
### Phases H–J — not pursued

The Village/**Clocktown** biome (H, the `spritesheet.xml` city set — *attempted and
rolled back*), the **alien swim-world** (I, the `aliens.xml` heroes with swim
frames), and the **stretch/quality** items (J — true multi-layer parallax, the
`-double` hi-DPI sheets, `items_sheet` particles/springboards) were scoped but are
**not being pursued** now that feature development is frozen. The assets each would
have used remain catalogued in §1 if work ever resumes.

---

Expand All @@ -360,10 +345,9 @@ needs an OXT eye.
| 5 | Scorched Dunes | sand / desert | (built) + gem | dune, thorn pit, bestiary II |
| **6** | **Cavern Depths** | **dirt / dirt** | dirt biome, conveyor, torches, block slime | conveyor descent + dark shaft |
| **7** | **Stone Keep** | **stone / cave** | stone biome, multi-key/switch, spinners | lock-and-key puzzle wing |
| **8** | **Clocktown** | **city / sky** | the buildings set | rooftop run + clocktower |
| **9** | **Tidal Caves** | **stone+water** | alien swim hero, fish, currents | extended swim world |

(6–9 are the new content; ordering/naming is a starting point.)
(6–7 are the shipped new content; the once-planned 8 "Clocktown" / 9 "Tidal Caves"
were not pursued — see Phases H–J above.)

---

Expand Down Expand Up @@ -398,22 +382,13 @@ needs an OXT eye.

---

## 6. Asset-coverage checklist (definition of done)

Track usage per sheet; "done" = used or a one-line documented reason it isn't.

- [ ] `backgrounds` — biome scenes used (Phase A partial); solids/clouds for new biomes (B/H).
- [ ] `tiles` terrain — dirt (B) + stone (C) biomes; corner/edge/ramp/overhang pieces across biomes.
- [ ] `tiles` items — **coin tiers + star (F, SHIPPED)**; **heart (F, SHIPPED — `hud_heart*` HUD row)**; torches + conveyor + planks (B/C); multi-colour locks/switches (C); `flag_green`.
- [ ] `tiles` HUD strip — art HUD (F), **removing the LiveCode top/bottom fields**.
- [ ] `foes` — block slime, worm ring, rest poses (B/D).
- [ ] `spooks` — snakes (E), spinners (C), squash/dead states everywhere (D), alt fish.
- [ ] `characters` — **4 skins + portraits via character select (G, SHIPPED — 1-5 to pick; `hud_player_*` avatar)**.
- [ ] `spritesheet.xml` city — Clocktown (H).
- [ ] `aliens.xml` — swim hero / Tidal Caves (I).
- [ ] `items_sheet` — particles, springboardUp/Down, weightChained (J).
- [ ] `enemies_sheet` blocker/poker — themed foe set (J, optional).
- [ ] `-double` sheets — hi-DPI pass (J, optional).
## 6. Asset-coverage (as-built)

Phases A–G shipped; the per-phase notes above and [`../CHANGELOG.md`](../CHANGELOG.md)
are the as-built coverage record. The original aspirational per-sheet checklist has
been dropped now that feature development is frozen — much of it shipped (coin tiers,
star, the heart HUD, character select, the dirt/stone biomes, snakes, spinners,
switch puzzles), and the remainder was tied to the unpursued Phases H–J.

---

Expand Down
33 changes: 18 additions & 15 deletions docs/building.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Building Box2Dxt from source

You only need to build if you want a fresh native library (or are porting to a
new platform/architecture). Most users can skip this and grab a
[prebuilt library](../prebuilt/) instead.
new platform/architecture). Most users can skip this entirely — the per-platform
libraries are committed inside the extension (`src/code/<arch>-<platform>/`) and
attached to each [Release](../../releases).

- [Prerequisites](#prerequisites)
- [Build](#build)
Expand Down Expand Up @@ -72,12 +73,14 @@ The build produces a single shared library:

You don't deploy this file by hand. Box2Dxt ships as a LiveCode/OpenXTalk
**extension with the native library bundled inside it**, under
`src/code/<arch>-<platform>/`. `tools/package-extension.py` copies the built
library (or the committed `prebuilt/` one) to its bare name in that tree:
`src/code/<arch>-<platform>/`. Those libraries are **committed** (built and tested
by CI, and attached to each Release), so a fresh clone is already a ready-to-build
extension. `tools/package-extension.py` refreshes that tree when you have a newer
build — point each flag at the matching library:

```sh
python3 tools/package-extension.py # populate src/code/<id>/
python3 tools/package-extension.py --check # validate inputs only
python3 tools/package-extension.py --check # list/validate the committed tree
python3 tools/package-extension.py --linux64 build/libbox2dxt.so # refresh one target
```

| Platform-id (`<arch>-<platform>`) | Bundled file |
Expand All @@ -102,16 +105,16 @@ and OpenXTalk (incl. OXT Lite) — **no library download, no renaming, no sudo,

When you build a **standalone**, the Standalone Builder bundles the matching
`code/` library automatically. For quick dev without packaging, you can instead
drop a single `box2dxt.{so,dll,dylib}` (bare name) next to your **saved** stack;
the Kit's `b2kEnsureNativeLib` (called from `b2kSetup`) points the engine at it
via `the revLibraryMapping` — see [prebuilt/README.md](../prebuilt/README.md).
copy the matching `src/code/<arch>-<platform>/box2dxt.{so,dll,dylib}` (already the
bare name) next to your **saved** stack; the Kit's `b2kEnsureNativeLib` (called
from `b2kSetup`) points the engine at it via `the revLibraryMapping`, so even on
Linux no `/usr/lib`, `sudo`, or `LD_LIBRARY_PATH` is needed.

## Packaging a distribution zip

The supported install is the packaged extension: run
`python3 tools/package-extension.py` to populate `src/code/<arch>-<platform>/`
(above), then **Package** `src/box2dxt.lcb` into `box2dxt.lce` in OXT's Extension
Builder. Shipping the `.lce` (or the source tree with its `code/` folder) gives
The supported install is the packaged extension: the `src/code/<arch>-<platform>/`
libraries are already committed (above), so just **Package** `src/box2dxt.lcb` into
`box2dxt.lce` in OXT's Extension Builder. Shipping the `.lce` (or the source tree with its `code/` folder) gives
the recipient a one-step install with the right native library bundled in — no
loose libraries to place.

Expand All @@ -130,7 +133,7 @@ python3 tools/make-release.py --stack /path/to/NewPlateformerDemo.oxtstack
```

It copies `src/box2dxt.lcb` together with its whole `src/code/` tree into
`extension/` (run `tools/package-extension.py` first to populate it), copies
`extension/` (committed in the repo; `tools/package-extension.py --check` validates it), copies
`box2d_lc.c` / `box2dxt-kit.livecodescript` into `source/` for reference, copies
the platformer's `Spritesheets/` art into `spritesheets/`, adds `dist/INSTALL.md`,
and drops your saved stack at the root — producing:
Expand Down Expand Up @@ -158,7 +161,7 @@ first-run prompt at `spritesheets/`.

- **AVX2 / SIMD.** Box2D assumes **AVX2** on x64 by default. If your binary must
run on older CPUs, configure Box2D with `-DBOX2D_DISABLE_SIMD=ON` (slower) or
an SSE2 build. The committed `prebuilt/libbox2dxt-linux-x86_64.so` binary is
an SSE2 build. The committed `src/code/x86_64-linux/box2dxt.so` binary is
built with SIMD disabled so it runs anywhere.

```sh
Expand Down
7 changes: 4 additions & 3 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ Windows, macOS, and Linux:
The engine then loads the correct library for your platform automatically —
**no `/usr/lib`, no `sudo`, no `LD_LIBRARY_PATH`, no renaming.**

> The committed `prebuilt/` binaries are the *source* of those bundled libraries;
> `python3 tools/package-extension.py` lays them into `src/code/` (already done in
> the repo). Prefer building the library yourself? See [building.md](building.md).
> The per-platform libraries under `src/code/<arch>-<platform>/` are committed
> (built and tested by CI, and attached to each [Release](../../releases)), so
> this is already done in the repo. Prefer building the library yourself? See
> [building.md](building.md).

## 2. Load it while developing

Expand Down
7 changes: 4 additions & 3 deletions docs/kit-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ and degrees** the whole way.
18. [Dropping to the core `b2…` API](#18-dropping-to-the-core-b2-api)
19. [A complete worked example: a little car](#19-a-complete-worked-example-a-little-car)
20. [Building a whole game (the micro-game pattern)](#20-building-a-whole-game-the-micro-game-pattern)
21. [xTalk gotchas worth knowing](#21-xtalk-gotchas-worth-knowing)
22. [Complete API index](#22-complete-api-index)
21. [Player actions: duck, drop-through, ladders, knockback, swim](#21-player-actions-duck-drop-through-ladders-knockback-swim)
22. [xTalk gotchas worth knowing](#22-xtalk-gotchas-worth-knowing)
23. [Complete API index](#23-complete-api-index)

---

Expand Down Expand Up @@ -1328,7 +1329,7 @@ Optional arguments are in `[…]`.

### Player (the platformer controller)
`b2kPlayerMake x,y,w,h [,sheet]` · `b2kPlayerAttach ctrl` ·
`b2kPlayerAnims idle,run,jump [,fall] [,land] [,duck] [,climb] [,hurt] [,swim]` ·
`b2kPlayerAnims idle,run,jump [,fall] [,land] [,duck] [,climb] [,hurt] [,swim] [,wall] [,dash]` ·
`b2kPlayerSet key,value` ·
`b2kPlayerGet(key)` `[f]` · `b2kPlayerOnGround()` `[f]` · `b2kPlayerState()` `[f]` ·
`b2kPlayerFacing()` `[f]` · `b2kPlayerJump [speed]` · `b2kPlayerControl flag` ·
Expand Down
Loading
Loading