Skip to content

feat(merge): merge command and Sequence lists per run - #9

Merged
Zorkats merged 1 commit into
mainfrom
merge-engine
Dec 2, 2026
Merged

Zorkats merged 1 commit into
mainfrom
merge-engine

Conversation

@Zorkats

@Zorkats Zorkats commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Slice 2b of the merge engine: event command lists and Sequence lists that several mods edit are merged with vanilla's list, instead of clashing as one value.

What it does

  • Command tree. CommandTree parses a command list by indent, as the engine walks it, and refuses anything else (GR-T2), so a list it cannot read stays one value.
  • Matching. Per body, each mod's list is matched against vanilla by whole nodes, then by heads that name one node on each side. Two nodes of one head (two Show Text with one face) are never paired by a guess. Property order is not a change.
  • Moves. A mod that removes a node and puts an equal one elsewhere moved it, also into, out of or between bodies at any depth. The move is one run of the body that holds both places, so it clashes with anything another mod did in between and never half applies. A node moved from one branch of a block into another changed the whole block.
  • Merge inside a node. Edits in different bodies, markers or lines of one block merge; a mod that adds or drops a body changed the whole node.
  • Collisions. One LogicClash or SequenceClash per list; PickMod and PickVanilla act per clashing run, and clean edits elsewhere stay. Inserts of several mods at one gap are OrderAmbiguous, profile order by default; when one mod's inserts hold another's in order ([a] and [a, b]), the longer run is taken once. Fingerprints do not change with profile order.
  • Map resize (GR-K4). A resized map's data is one value even when the tile count stays the same, and width and height join its cluster.

Review first

  1. RPGModder.Core/Merge/ListMerge.cs: matching, moves, units, merge inside a node, fingerprints.
  2. RPGModder.Core/Merge/CommandTree.cs: the parser and GR-T8.
  3. RPGModder.Core/Merge/Composer.Lists.cs: collisions and choices per list.

Known limits

  • Two branches of one block swapped are paired by position.
  • A Show Text right before a Show Choices is two nodes, so a mod may change one and another mod the other.
  • A node a mod both moves and edits is a remove and an insert.

Out of scope

The allocator, gates and plugin writer (slice 2c) are the next PRs. Showing these collisions to the player is lane A's A10.

Checks

  • Full suite on Windows: 1204 passed, 1 skipped
  • dotnet format --verify-no-changes clean, LF only
  • Property tests with fixed seeds: merge laws, validity under every choice, and no invented copy with repeated heads and moves, nested moves included
  • Mutations over every new branch fail tests, but the GR-T8 guard, which no merge reaches

Three-way merge of the event command lists and Sequence lists that several
mods edit. A command tree parser, a per-body match of whole nodes and then of
unique heads, moves kept as one run at any depth, and a merge inside one node.
A clashing run is one LogicClash or SequenceClash per list, which PickMod and
PickVanilla resolve per run. Inserts of several mods at one gap are
OrderAmbiguous, unless one mod's inserts hold another's in order, which are
taken once.

A map's width and height join its whole data op, and a resize keeps data one
value even when the tile count stays the same.
@Zorkats
Zorkats merged commit 0b0fe62 into main Dec 2, 2026
4 checks passed
@Zorkats
Zorkats deleted the merge-engine branch December 2, 2026 02:05
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