Files
yugioh-legacy-engine/CHANGELOG.md
T
donnyandClaude Opus 5.5 d31b7b62d8
Release / release (push) Successful in 9s
Release / windows (push) Successful in 33s
Release / linux (push) Successful in 1m19s
Release / android (push) Successful in 59s
Release / attach-windows (push) Successful in 1s
core: a Tag Field Spell takes the team's free Field slot (v1.7.2)
get_fzone_landing sent a Field Spell to the playing partner's slot and
replaced the card there even when the other partner's slot was free; only
a control change took the free slot. A partner who got both of the team's
Fields back with Giant Trunade and played them one after the other lost
the first. Now a Field Spell takes the free slot whenever the playing
partner's is taken; with both taken it replaces the playing partner's.

Probe: new room "tag, two in one turn" (seq 5 then 6 on turn 1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WoiqG2TqZQmJ8tTn8tYpgy
2026-11-12 14:54:23 -07:00

20 KiB

Changelog

Every change to the engine contract (contract/engine-contract.md) is one row here: the C API, the wire protocol, the engine message stream, the setup pairs and the Lua API. A row names the date the change first shipped in the Unity repo, the ticket, and the contract part it touched. Rows 0001-0024 are the fork patches replayed into this repo as commits (git log --oneline -- server/gframe core).

v1.7.2 — 2026-11-12

In Tag, a Field Spell takes the team's free Field slot when the playing partner's slot is taken. No new export, message or capability bit: exports 336 / 857 / 851, protocol 12, capabilities 0xF7FF.

Date Change Ticket Contract part
2026-11-12 Core: field::get_fzone_landing sent a Field Spell to the playing partner's slot and replaced the card there even when the other partner's slot was free; only a control change took the free slot. A partner who got both of the team's Fields back to the hand ("Giant Trunade") and played them one after the other lost the first. Now any Field Spell that lands (activated, Set, Duel.MoveToField to LOCATION_FZONE) while the playing partner's slot is taken and the other is free takes the free one; when both are taken it replaces the playing partner's, as before. A Set offers that landing slot's bit. Probe: room "tag, two in one turn". none (owner) (d) Lua API: behaviour

v1.7.1 — 2026-11-11

A card whose cdb alias names another card keeps its own setcodes. No new export, message or capability bit: exports 336 / 857 / 851, protocol 12, capabilities 0xF7FF.

Date Change Ticket Contract part
2026-11-11 Core: a card read with a rule_code (a cdb alias outside the artwork range, which the readers turn into rule_code) answered is_set_card from the NAMED card's setcodes only, so a custom card that adds an archetype its base card lacks lost it in the duel ("Vennominon" 810000878, setcode 0x50, named 72677437, setcode 0: "Venom Fangs" could not equip it; 21 cards of the custom pack). card::check_code_setcode: while the card's code is its own rule_code, its own data.setcode answers too, then the named card's. Used by is_set_card, is_pre_set_card and is_special_summon_set_card. A card renamed by EFFECT_CHANGE_CODE takes the new name's setcodes only, as before. Card.IsSetCard / IsPreviousSetCard / IsSummonSetCard. none (owner) (d) Lua API: behaviour

v1.7.0 — 2026-11-08

Prompt context (proposal 55): right before every prompt the answering seat learns which card and which effect asks. One export, one message, capability 0x8000, protocol 12: exports 336 / 857 / 851, capabilities 0xF7FF. Record 23 bytes, message 24 bytes.

Date Change Ticket Contract part
2026-11-08 Core: ygol_query_prompt_context(pduel, playerid, out) (23 bytes: version, has effect, code, controller, location, sequence, position, u64 description, u16 effect index, phase, chain link, announce kind: 1 Duel.AnnounceLevel, 2 a visible CATEGORY_DICE effect, on MSG_ANNOUNCE_NUMBER only). field::execute_cost / execute_target / execute_operation push the running effect (handler, description, index, phase 1 / 2 / 3, chain link) on core.ygol_running at step 0 and pop it when the function finishes; the innermost one answers. The core's own "use this effect?" asks (optional trigger, lone quick trigger desc 221, desc 94, replacements 218 / 219 / 220, Scrap Chimera) carry the asked effect in their PROCESSOR_SELECT_EFFECTYN / SELECT_YESNO unit and push it as phase 4 (ask) while the prompt is open. effect::ygol_script_index: card::add_effect stamps initial_effect.size() while the card loads (STATUS_INITIALIZING), 0xFFFF otherwise. A handler the asking player does not control and that is not face-up answers code 0, index 0xFFFF, description 0. TICKET-451 (a) new export
2026-11-08 Server: STOC_PROMPT_CONTEXT 0x44 = those 23 bytes + the prompt's MSG_* id (24 bytes), to the answering seat (Tag: cur_player) right before every relayed prompt but rock-paper-scissors, only when its capability has the bit; never observers, recorders or replays. FEATURE_PROMPT_CONTEXT 0x8000 advertised by Single and Tag rooms, protocol 11 -> 12; no room refuses a joiner without it. Export gates 335 / 856 / 850 -> 336 / 857 / 851. TICKET-451 Wire: message 0x44, capability bit 0x8000, protocol 12
2026-11-08 Binding: StocMessage.PromptContext, FeatureFlags.PromptContext (in All), the PromptContext record + StocCodecs.PromptContext, EngineApi.ygol_query_prompt_context, Capability.ProtocolVersion 12. Probe: the prompt context rooms (Single, a second Single duel whose opponent lacks the bit, Tag): a card asks in its cost, target and operation, a Fusion's material procedure asks inside that operation and the outer context comes back, the Fusion's optional End Phase trigger is asked with phase 4, announces say kind 0 / 1 / 2, then the card hides itself in the Deck and asks both players; a second duel with another deck order has the same indexes. TICKET-451 (e) C# binding

v1.6.0 — 2026-11-02

Tag shared Extra Deck (proposal 53): a setup pair gives a Tag team one Extra Deck, and each card keeps the partner who brought it. No new export or message; capability 0x4000, protocol 11: exports 335 / 856 / 850, capabilities 0x77FF.

Date Change Ticket Contract part
2026-11-02 Core: option DUEL_TAG_SHARED_EXTRA 0x200: start_duel moves tag_list_extra into list_extra and renumbers, for both teams; tag_swap skips its Extra block. card::tag_member (0 new_card, 1 new_tag_card), QUERY_TAG_MEMBER 0x1000000 written last in get_infos. Bit 0x100000 stays unused: old flags set it with no value. TICKET-433 (a) start_duel option; (c) Query records
2026-11-02 Server: ygol.tag.extra=shared is the fourth server-read pair. TagDuel sets the option in opt, sends the sum of both partners' Extra Decks in the opening MSG_START, runs the opening RefreshExtra after start_duel, and adds QUERY_TAG_MEMBER in RefreshExtra. FEATURE_TAG_SHARED_EXTRA 0x4000 advertised by Single and Tag rooms, protocol 10 -> 11; a Tag room refuses a joiner without the bit. TICKET-433 Wire: capability bit 0x4000, protocol 11; (d) setup pair ygol.tag.extra; 0x5F Extra count 0 in such a duel
2026-11-02 Binding: FeatureFlags.TagSharedExtra (in All), Capability.ProtocolVersion 11. Probe: the tag shared Extra Deck rooms (pair present, pair absent, a Summon of the waiting partner's monster, the replay played back through the library, the Tag refusal, the Single room that keeps an old client). TICKET-433 (e) C# binding

v1.5.0 — 2026-10-24

Tag two Field slots (proposal 45): a Tag team on Master Rule 4/5 holds one Field Spell per partner. No new export or message; capability 0x1000, protocol 10: exports 335 / 856 / 850, capabilities 0x37FF.

Date Change Ticket Contract part
2026-10-24 Core: field::has_two_fields() (DUEL_TAG_MODE on Master Rule 4 or 5) gives each team a Field slot per partner, Spell/Trap sequence 5 for the partner who plays the team's first turn and 6 for the other (player_info::tag_partner, flipped in tag_swap; get_szone_size is 7 there). A Field Spell lands in the playing partner's slot (get_fzone_landing) and replaces only that card; a control change takes the free slot when the playing partner's is taken. A Set offers only the landing slot's bit. LOCATION_FZONE covers both slots in card_state::is_location, filter_matching_card, filter_field_card, is_location_useable and Duel.IsEnvironment; get_field_card(p, LOCATION_FZONE, 0) is the playing partner's field, else the other, and 1 the remaining one. Singles, Match and Master Rule 3 unchanged. TICKET-384 (c) MSG_MOVE / MSG_RELOAD_FIELD carry Spell/Trap sequence 6 (rules only); (d) Lua API: a second answer for Duel.GetFieldCard / Duel.CheckLocation with LOCATION_FZONE
2026-10-24 Server: FEATURE_TAG_TWO_FIELDS 0x1000 advertised by Single and Tag rooms, protocol 9 -> 10; a Tag room answers a CTOS_CAPABILITY without the bit with STOC_ERROR_MSG ERRMSG_VERERROR and closes the connection (TagDuel::Capability). TICKET-384 Wire: capability bit 0x1000, protocol 10
2026-10-24 Binding: FeatureFlags.TagTwoFields (in All), Capability.ProtocolVersion 10. Probe: the tag two Field slots rooms (a Tag room's placement on turns 1, 3 and 5 with the core's own view reported by the Probe Field's script, the Tag refusal, the Single room that keeps an old client). TICKET-384 (e) C# binding

v1.4.2 — 2026-10-24

Tag partner cards follow every change. Same message, same payload, no new export or capability bit: exports 335 / 856 / 850, protocol 9, capabilities 0x27FF.

Date Change Ticket Contract part
2026-10-24 STOC_TAG_PARTNER_CARDS 0x5F has a fourth send point: after every engine batch (beside FlushDeckLists, not when the duel ended) TagDuel::FlushTagPartnerCards queries ygol_query_tag_cards per side and broadcasts it when the bytes differ from the last broadcast for that side (a Summon out of the waiting member's Extra Deck, Time Fusion), to the same receivers. Every broadcast (start, swap, change) records its bytes; a resync to one player does not. Server. TICKET-424 Wire 0x5F

v1.4.1 — 2026-10-16

Tag: a card the waiting partner holds can be moved. No new export or capability bit: exports 335 / 856 / 850, protocol 9, capabilities 0x27FF.

Date Change Ticket Contract part
2026-10-16 Fix in the core's tag lists (upstream code, reached through core patch 0015's swap order): an effect that keeps a card across the tag swap and moves it later (Time Fusion: the Fusion picked from the Extra Deck at activation, Summoned at the team's next Standby Phase, when the partner's Extra Deck is the active one) moved a card of tag_list_main / tag_list_hand / tag_list_extra; remove_card erased the ACTIVE list at the card's sequence, past the end of a shorter list (an empty Extra Deck: memcpy crash in field::remove_card) or the wrong card. Such a card now leaves the list that holds it (field::tag_list_holding) and goes where the move says; the next MSG_TAG_SWAP lists one card fewer. Core. TICKET-415 Engine message stream: MSG_TAG_SWAP (rules only)

v1.4.0 — 2026-10-16

Life points per side: the setup pair ygol.side.b.lp=<n> gives seat side B its own start LP. No new export or capability bit: exports 335 / 856 / 850, protocol 9, capabilities 0x27FF.

Date Change Ticket Contract part
2026-10-16 ygol.side.b.lp=<n>: seat side B (seat 1; Tag seats 2 and 3) starts at n LP, side A at slot 8; set_player_info per duel player, MSG_START (start and late-watcher snapshot) carries lp[0], lp[1] in duel player order through the first-turn swap, and the replay gets flag 0x20000000 + i32 lp[0], i32 lp[1] after opt when the two differ. Single, Match, Tag. Server. - Setup pair ygol.side.b.lp; engine message stream MSG_START; replay flag 0x20000000

v1.3.0 — 2026-10-16

Spectators with Show all get the Tag partner cards of both teams. Same message, same payload, no new export or capability bit: exports 335 / 856 / 850, protocol 9, capabilities 0x27FF.

Date Change Ticket Contract part
2026-10-16 STOC_TAG_PARTNER_CARDS 0x5F also goes to every observer, both sides, when spectators see all (no ygol.room.spectatorview=hidden): after start_duel, after every MSG_TAG_SWAP, and both sides in an observer's field resync and the late-watcher snapshot. Hidden rooms and seated duelists unchanged. Server. TICKET-412 Wire: STOC 0x5F recipients; join snapshot

v1.2.0 — 2026-10-15

Tag partner cards: the waiting teammate's hand, Extra Deck and deck reach that team's two seats. One new export (Windows 335, Linux 856, Android 850), one new message, capability 0x2000, protocol 9 (capabilities 0x27FF).

Date Change Ticket Contract part
2026-10-15 ygol_query_tag_cards(pduel, playerid, out): the waiting tag partner's hand, Extra Deck (bit 31 = face-up) and deck codes (sorted) of one side, read only; returns the byte length, 0 when not a tag duel. Core. TICKET-405 C API: 1 export
2026-10-15 STOC_TAG_PARTNER_CARDS 0x5F = u8 side + the export's bytes, no stamp, to that side's two seats only (never the other team, never an observer): after start_duel, after every MSG_TAG_SWAP, and in a seated duelist's field resync. FEATURE_TAG_PARTNER_CARDS 0x2000 (0x800 and 0x1000 stay reserved for proposals 44 and 45), protocol 8 -> 9. Server. TICKET-405 Wire: STOC 0x5F, capability bit 0x2000, protocol 9
2026-10-15 Binding: StocMessage.TagPartnerCards, FeatureFlags.TagPartnerCards, the TagPartnerCards record + StocCodecs.TagPartnerCards, EngineApi.ygol_query_tag_cards, Capability.ProtocolVersion 9. TICKET-405 (e) C# binding

v1.1.1 — 2026-10-15

A rules fix in the core only. No contract change: same exports, protocol 8, capabilities 0x7FF.

Date Change Ticket Contract part
2026-10-15 Tag duel opening turns: no Battle Phase on turns 1, 2 and 3 (duelists 1A, 2A, 1B); the fourth duelist (2B) is the first who can battle, as the official Tag Duel rules say. Single duels keep turn 1 only. DUEL_ATTACK_FIRST_TURN still lifts the block. Core (field::is_opening_turn_without_bp, used by the idle command and Duel.IsAbleToEnterBP). - Rules only; no contract change

v1.1.0 — 2026-10-15

The C# binding joins the release: ygol-engine-binding.zip (YGOLegacy.Engine.dll + .pdb) beside the five assets of v1.0.0, and engine.json names it in binding. The native libraries are unchanged in content (same exports, protocol 8, capabilities 0x7FF); only ygol_engine_version() answers the new tag.

Date Change Ticket Contract part
2026-10-15 binding/YGOLegacy.Engine (netstandard2.1) carries the wire protocol, namespaces YGOLegacy.Protocol.* unchanged, with its NUnit fixtures; the windows job builds and tests it and ships ygol-engine-binding.zip; engine.json gains binding. TICKET-397 (e) C# binding: new
2026-10-15 Namespace YGOLegacy.Engine: EngineApi (all 45 exports of contract/ocgapi.h, one typed extern each, header parity test), MessageScan (the message-layout scanner, moved from the Unity bot host), GameMessage (one enum from the 84 MSG_* defines, header parity test), EngineBinding (Version, CheckNative()); contract section (e) written. TICKET-398 (e) C# binding: the four types; engine.json: binding documented

v1.0.0 — 2026-10-15

The first release: one library per platform behind the written contract, built and gated in this repo's CI, fetched by version. Windows ygol-engine.dll (334 exports), Linux x64 libygol-engine.so (855) + the ygoserver executable, Android arm64 libygol-engine.so (849).

Date Change Ticket Contract part
2026-10-14 ygol_engine_version(): returns the version string the build was given (build/windows.ps1 -Version), local when none. Windows export gate 333 -> 334. TICKET-388 C API: 1 export
2026-10-15 Linux x64 and Android arm64 builds in Docker with the same gates; #include <algorithm> in netserver.cpp for GCC. TICKET-389 Builds only; no contract change
2026-10-15 Release workflow: a v* tag builds every platform, gates each, and publishes one release with engine.json. TICKET-390 Builds only; no contract change

Replayed fork patches (before the first tag)

Patch Date Change Ticket Contract part
0001 2026-08-24 Face-down Tokens opt in by setcode 0xFDF (SETCODE_FACEDOWN_TOKEN); a Token without it behaves as stock. Core. - Rules only; no contract change
0002 2026-08-24 Tag duel: teammates share one visible hand. Server. - Rules only; no contract change
0003 2026-08-26 YGOPRO_MAX_EXTRA 15 -> 99: the server no longer truncates the extra deck while receiving it. Server. TICKET-059 Deck limits (wire: CTOS_UPDATE_DECK accepts 99 extra)
0004 2026-08-31 core.attacker null guards in the battle command so a damage step resumed after its battle ended does not crash. Core. - Rules only; no contract change
0005 2026-09-23 The server keeps listening after the duel starts; a late observer gets STOC_DUEL_START and a field resync. Server. TICKET-152 Wire (join during a duel)
0006 2026-09-24 Capability / Appearance / Dialogue as real messages 0x40-0x42, sender stamped by the server, appearance replayed in the join snapshot. Server. TICKET-170 Wire: CTOS/STOC 0x40-0x42, capability bits 0x1, 0x2, protocol 1
0008 2026-09-26 Sandbox god mode: ygol_sb_add, ygol_sb_move, ygol_sb_remove, ygol_sb_set_position, ygol_sb_set_lp, ygol_sb_reask. Core. - C API: 6 exports
0009 2026-10-03 Setup pairs: ygol.<key>=<value> tokens after slot 11 of the host string go into the duel registry before special.lua, into the replay (flag 0x40000000) and to every joiner as STOC 0x43; argv sized from the token count. Server. TICKET-258 Wire: STOC 0x43, capability bit 0x4; setup pairs; replay
0011 2026-10-06 Host seats: the host plans every seat Open / Cpu (0x50), a bot claims its Cpu seat with a token before JoinGame (0x51), host swap 0x52 and move 0x53. Server. TICKET-285 Wire: CTOS 0x50-0x53, STOC 0x50, capability bit 0x8, protocol 2
0012 2026-10-06 Rules restart: Prepare / Ack / Commit barrier (0x54-0x56), seat resume 0x57, a replacement server opened by the bootstrap secret (0x58), Reserved seats with tokens and a deadline; ygol.room.watchers=0 refuses observers. Server. TICKET-286 Wire: CTOS/STOC 0x54-0x58, capability bit 0x10; setup pair ygol.room.watchers
0013 2026-10-06 Seat state 0x59 (4 bytes): what a seated duelist is doing; stored per seat, replayed in the join snapshot, cleared on leave / move / start. Server. - Wire: CTOS/STOC 0x59, capability bit 0x20, protocol 3
0014 2026-10-06 Lobby after match: a match end returns the server to the lobby on the same connections; STOC_MATCH_OVER 0x5A after the stock DUEL_END. Server. TICKET-299 Wire: STOC 0x5A, capability bit 0x40, protocol 4
0015 2026-10-08 Tag: no tag swap on a team's first turn, so the first seat holds the hand from turn 1. Core. - Engine message stream: the first MSG_TAG_SWAP comes later (rules only)
0016 2026-10-08 Tag: team B loads seat 2 as the main deck and seat 3 as the tag deck; the prompt owner starts at seat 2. Server. - Rules only; no contract change
0017 2026-10-09 Coin toss: no STOC_SELECT_HAND; on START the server rolls, sends STOC_COIN_TOSS 0x5B to everyone, SELECT_TP to the chooser, and answers FIRST for them after 10 s. Server. TICKET-328 Wire: STOC 0x5B, capability bit 0x80, protocol 5; STOC_SELECT_HAND never sent
0018 2026-10-10 Spectators see all: every observer gets the unmasked stream unless the setup pair ygol.room.spectatorview=hidden is present. Server. TICKET-326 Setup pair ygol.room.spectatorview; observer stream
0019 2026-10-10 Deck lists STOC_DECK_LIST 0x5C: kind 0 sorted to the owner, kinds 1 (real order) and 2 (submitted main deck) to observers when spectators see all. Server. TICKET-338 Wire: STOC 0x5C, capability bit 0x100, protocol 6
0020 2026-10-11 Profile 0x5D (98 bytes): a seated human's avatar id and frame id, stored per seat, in the join snapshot, swapped with the seat. Server. TICKET-360 Wire: CTOS/STOC 0x5D, capability bit 0x200, protocol 7
0021 2026-10-12 Fix for 0012: START stops the lobby clock so a reservation window still open after a rules restart no longer ends the duel at once. Server. - No contract change
0022 2026-10-13 ygol_preview_attack: a read-only dry run of the damage step for one attacker and one target, 24-byte answer. Core. TICKET-374 C API: 1 export
0023 2026-10-13 Attack preview over the wire: CTOS/STOC 0x5E, answered to the asker alone from the host's embedded core. Server. TICKET-378 Wire: CTOS/STOC 0x5E, capability bit 0x400, protocol 8
0024 2026-10-13 ygol_preview_attack asks field::get_attack_target first; a pair the battle menu would not offer answers flag bit 5 illegal alone. Core. TICKET-379 C API: same export, flag bit 5 defined