Skip to content

Co-op: every player has the town's creatures as its own, and the story flags are the group's - #940

Merged
featureJosh merged 6 commits into
mainfrom
feat/coop-party-everyone
Nov 25, 2026
Merged

featureJosh merged 6 commits into
mainfrom
feat/coop-party-everyone

Conversation

@featureJosh

Copy link
Copy Markdown
Collaborator

What it changes

  • A teammate has the town's creatures as its own, as the host does. The game's own-creature test (0x284ef4, 47 call sites) is a row of the party table: on a member, a creature whose record has parents is the group's. Five callers keep the game's answer. This restores for every player what only the host had: the talk option to move a creature into a house, the talk rows for creatures one befriended, their friendship values and the "has something to say" balloon.
  • The talk option to move a creature into a house is offered while the creature follows any player of the session, not only the talking player.
  • The 20 story flags (contents condition 0x32) are the group's: a flag set by any player's record is set for everyone, a clear counts only from the authority, and every member's save takes the authority's flags. New module pkp_coop_story_flags.cpp.
  • The shared-state digest also watches the story flags and the homes (logging only).
  • Co-op rules 10 -> 11.

PROJECT.md 6.7: these are bends, not rebuilds. The game's own test and its one flag writer are answered at one place each; no game system is switched off.

This is slice 5 of the party checks (#933, #934, #935, #937, #939).

For players

  • CHANGELOG.md ## Unreleased has an entry
  • Needs Set up again: yes, once (new hook sites); saves and shaders are kept. Every player of a session needs this version (co-op rules 11).
  • Rebuilds shaders: no

Pros

  • Every player can move creatures into houses, sees the same talks and friendship values as the host, and gets the same story hint scenes.
  • One mechanism per kind of check: two new row kinds in the existing party table, one small module for the flags.
  • No change outside a session.

Cons

  • A creature can be offered a house by a player it does not follow; the house is the talking player's.
  • A player who joins late plays a few frames on its own save's story flags before the group's arrive; a record that fires in that window can run once more afterwards.
  • A flag set for the group closes the same record on the other players, so its other actions do not run there.
  • pkp_coop.cpp is at 787 lines and is due a split.
  • Relics and skin patterns are still per player.

Three more domains of the shared-state digest (logging only): the 20 story flag bits contents condition 0x32 reads, the home record of each character as this process reads it (the mirror on a member), and the use count of each move. A member whose values stay apart from the authority's is logged with the entries that differ, as for every other domain. A build without them ignores the new domain ids.
The game's own-creature test 0x284ef4 compares the parents of a creature's friend record with this process's user id. On a member that is false for every creature of the group's town, so a member had no talk option to move a creature into a house, none of the talk rows for one's own creatures, friendship values of 0 and no balloon over a creature that has something to say.

It is a row of the party table now: a new row kind for a predicate function answered whole (PKP_PARTY_PRED, fact Owns in pkp_coop_party.cpp). On a member in a session, outside Cloud Island, a creature whose record has parents is the group's own. Members only: the authority's own answer already is the group's. Five callers keep the game's answer by their return address (the friendship stores, two talk-end steps the authority applies itself, the per-frame scan that queues events). The talk handler's own test (0x4c0574) uses the same fact.

With the test answered, script callback 0x4ab268 goes past it on a member for the first time, and the friendship module's midhook 0x4ab358 behind it starts to run: a member's talk that marks a creature's 'has something to say' flag as seen sends that flag to the authority (FriendAsk kind 2), which sets it in the group's record and sends the record to every member. Until now only the host's talks cleared that balloon.
…very player

The talk option to move a creature into a house (0x4db9f4) asks that the creature's leader is this process's own player (cmp at 0x4dbcbc). In a session a creature that follows any player of the session passes: a new row kind of the party table for a compare of a creature's leader with this player (PKP_PARTY_LEADER). The house is still the one the talking player stands in or next to, and the home is written as for that player.
The 20 story flags (contents condition 0x32) have one writer, contents action 0xbbd (0x12c46c), which runs on the process whose own content record runs. A flag set by a record that waits for one player's scene end or talk existed in that player's save alone, so the other players' records that test it went another way.

New module pkp_coop_story_flags.cpp, one entry hook on the action: a member's set runs and is asked of the authority, which sets its own flag; a member's clear does not run (the clears are stage-entry and content-start records, and a member that joins late must not clear what the group has); the authority sends its four bytes when they change, when a member joins and every 30 s, and a member writes them into its save, keeping the sets it still waits for.

A member that joins late reads its own save's flags until the authority's first message (the frames between its world load and the join's send); what its records write in that window is replaced on arrival and is not sent.
A build without the own-creature and leader rows and without the story flags module would play one session by other rules: it would offer other talks for the town's creatures, and neither send its flag sets nor take the group's flags.
Nothing shares those counts, so the domain differed for every player at
every look and made each look a full exchange. The story flags and the homes
stay.
@featureJosh
featureJosh merged commit afd353c into main Nov 25, 2026
1 check passed
@featureJosh
featureJosh deleted the feat/coop-party-everyone branch November 25, 2026 08:06
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