Skip to content

Own backend: the game's conditions and actions (step 5, parts 1 and 2) - #44

Merged
jeany55 merged 2 commits into
trigscript-4from
game-actions
Oct 20, 2026
Merged

jeany55 merged 2 commits into
trigscript-4from
game-actions

Conversation

@jeany55

@jeany55 jeany55 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Step 5 of the way off eudplib, parts 1 and 2 (docs/v4-plan.md: "The game's conditions and actions on our own backend", "Fields from values on our own backend").

Part 1. Every game condition and action whose fields are known when the map is built is laid out as the game's own record; its text and sound file go among the map's strings, the script's clips into the archive. memory() / setMemory() at a known address come with it. ! of a condition is one condition where one says the opposite. Two general wins: an && whose parts fit in one trigger is one trigger, and an if of game actions and self-only writes is one trigger with no branch (numbers probes 2–8% faster too). A ?: of two booleans is taken (the last step-0 refusal).

Part 2. A field from a value is a place of its variable, kept by its writes: the action costs nothing more when it runs (eudplib copies the value in every time). Unit counts past 255, made texts (Transmission, objectives, leaderboard labels) through templates.

Better than eudplib, found on the way (played in the lifted game):

  • command() after Create Unit read the old count in both builds (the game's count table; Python's forget_counts covers Bring only). Ours throws the table away with Kill Unit of P12's type 228 in the same trigger.
  • A Transmission in a loop showed every other time in both builds (the game's started mark). Ours puts the mark back, so each one shows.
  • 258 units from a count: ours ~253 placed, eudplib's 50–100 (it does Create Unit of one, 258 times).

Ledger

Step Before After
0 157 / 158 158 / 158
5 0 / 193 154 / 195 (two of step 6's moved in)

Only step-5 rows changed, besides the step-0 row.

Lifted game, ms (ours / eudplib)

Probe Ours eudplib
own-game: start + every check 0.003 1.074
own-game: 200 turns, if of 3 conditions → n++, 2 actions 0.020 0.028
own-game: 200 turns of !exactly 0.021 0.038
own-fields: 200 Set Deaths of a counter 0.014 0.021
a frame with nothing to do 0 0.004

Every line of probes/own-game.ts and probes/own-fields.ts is ok in ours; every earlier probes/own-*.ts rebuilt and played again, all ok. Suite 1254 pass.

Left in step 5 (41): the game read as a value (19), centerLocation (6), texts to other players / at the centre (6), the players' facts and supply (7), Wait, rose, once.

Open (in the plan): const both = command(…) && bring(…) is a false compile error; a second Transmission during the first one's time is still held (needs the players' wait timers); command() right after a kill still counts the units until the next frame.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BwPs2Ya2X9rB9TYHijfoom

jeany55 and others added 2 commits October 20, 2026 07:02
Every condition and action whose fields are known when the map is built
is laid out as the game's own record (Cond.game, Act.record); its text
and sound file go among the map's strings, the script's clips into the
archive. memory() and setMemory() at a known address come with it.

- `!` of a condition is one condition where one says the opposite
  (at least n / at most n - 1, set / cleared); else a skip past.
- `&&` whose parts fit in one trigger is one trigger, not a branch each.
- An `if` of game actions and self-only writes under such conditions is
  one trigger: no branch, no put-back.
- Bring counted again after an action that makes or moves units.
- A `?:` of two booleans is taken (the last step-0 refusal).

Ledger: step 0 158/158, step 5 118/195. probes/own-game.ts: every line
ok both ways; 200 turns of conditions and actions 0.020 ms vs eudplib's
0.028, 200 of `!exactly` 0.021 vs 0.038.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwPs2Ya2X9rB9TYHijfoom
An action's field from a value is a place of its variable, kept by its
writes, so the action reads it where it is (eudplib copies it in before
every run). Type, kind and count share a dword: the place's constant is
what is not the value.

- A unit count: 255 at a time while more are left, then the rest, each
  half only where the range reaches it; 0 or below none.
- A made text fills a template of its own; the action's text names it.
- The game's count table thrown away after making or moving units, by
  Kill Unit of P12's type 228, in a program that asks Command or Bring:
  `command()` after Create Unit read the old count in both builds.
- A Transmission is first in a trigger of its own; the next trigger puts
  its started mark and the trigger's current action back, so each one
  in a loop shows (eudplib's: every other).
- max(n, 0) around an amount dropped where the ranges know it.

Ledger: step 5 154/195. probes/own-fields.ts: every line ok ours;
200 Set Deaths of a counter 0.014 ms vs eudplib's 0.021.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BwPs2Ya2X9rB9TYHijfoom
@jeany55
jeany55 merged commit a1d3e7c into trigscript-4 Oct 20, 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