Skip to content

Own backend, JSX, names and arrays of texts: step 8, part 3 - #51

Merged
jeany55 merged 2 commits into
trigscript-4from
texts-part3
Oct 22, 2026
Merged

jeany55 merged 2 commits into
trigscript-4from
texts-part3

Conversation

@jeany55

@jeany55 jeany55 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

On top of #50 (triggers stacked), which is on top of #49. Step 8 is done: 46 of 46.

Part 3 (compiler/backend/texts.ts, on part 2's run time)

  • JSX: a buffer (buildText / built) is a made text of its own. It's put together from its start or continued from its end. A buffer printed alone is shown as it is.
  • A player's name and colour in a print:
    • The name comes from the game's table of players, where eudplib's PName reads it. For a player known when built, its length is one condition a byte, and the rest is copied a dword at a time.
    • The colour is the first shade of the player's colour, mapped through eudplib's palette-to-code table.
  • Arrays of texts and text fields of records: the front end's three number arrays are kept, and each cell's text gets a block of its own. A store past the end does nothing.

Made texts through the current player (to beat eudplib on every frame):

  • How: a player field of 13 is the dword the current player points at. So one write points every read and write after it there, as eudplib's cp functions do. This needs no emitter change: a read at EPD 13 and a Set Deaths for player 13 already work this way.
  • Copy: reads and writes go through the current player. Before, each read put the address into the player fields of its 32 conditions, one routing each.
  • Known texts up to 256 bytes are written, not copied: one trigger for each byte offset the cursor may be at.
  • The cursor is read in few places. A variable read in an action's field is copied into every such place at each write. A write of the cursor now costs 11 routings, not 19.
  • Only the run-time variables a program reads are declared. A program with no made text pays nothing at its start (own-leaver 0.005 → 0.003 ms).
Lifted game, Remastered's weights Part 2 Now eudplib
own-made-texts frame 2 0.275 ms 0.151 ms 1.391 ms
own-made-texts frame 3 1.291 ms 0.714 ms 1.694 ms
own-made-texts frame 4 0.540 ms 0.418 ms 0.840 ms
own-jsx-texts frame 2 (JSX, colour, meter) — 0.069 ms 1.388 ms
own-jsx-texts frame 3 (names and colours) — 0.031 ms 0.130 ms
own-jsx-texts frame 4 (text arrays, join, records) — 0.190 ms 0.310 ms

Size trade-off: the known texts' functions take room. The own-made-texts payload is 1.45 MB (1.33 MB with #50 alone). Copying every known text instead would be 1.16 MB, with frames 0.204 / 0.811 / 0.430 ms, still faster than eudplib everywhere.

Checked

  • Ledger: --write flipped exactly the 13 refused step 8 rows.
  • Simulator: 8 of the 13 rows match exactly. The other 5 match except for colour codes, which the simulator's log leaves out. Every other taking row gives the same verdict as before (430 the same).
  • Both builds: probes/own-jsx-texts.tsx prints the same lines and colour codes both ways. eudplib only adds \r padding, which draws nothing.
  • Lifted game: all 20 probes/own-*.ts print the same lines with the free dwords filled with ones.
  • Tests: new tests in tests/emitter.test.ts: JSX, a name and colour from game memory, text arrays and records. The walker now takes player field 13 as the current player. Full suite: 1278 pass.

Remastered: own-step8-known.scx, own-step8-made.scx, own-step8-jsx.scx and own-step8-made-filled.scx (the stacking check) are in Maps/TrigScript, with own-step8-answers.txt.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BwPs2Ya2X9rB9TYHijfoom

jeany55 and others added 2 commits October 20, 2026 17:32
JSX buffers are made texts of their own; a player's name and colour are read from where the game keeps them;
arrays of texts and texts in records keep a block a cell. Made texts are read and written through the current
player, and known texts up to 256 bytes are written, not copied. Step 8 takes 46 of 46; the made-texts probe
is now 0.151/0.714/0.418 ms a frame against eudplib's 1.391/1.694/0.840.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwPs2Ya2X9rB9TYHijfoom
Played in Remastered on 2026-10-22: the game deals the players' colours afresh each
game on the probe map, and both builds print each name in the colour dealt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwPs2Ya2X9rB9TYHijfoom
@jeany55
jeany55 changed the base branch from text-size to trigscript-4 October 22, 2026 18:04
@jeany55
jeany55 merged commit af627a7 into trigscript-4 Oct 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant