Skip to content

feat(fp): chat answers in context, named mayors reply in person - #14

Merged
KunalSiyag merged 1 commit into
mainfrom
fp/chat-context
Oct 20, 2026
Merged

KunalSiyag merged 1 commit into
mainfrom
fp/chat-context

Conversation

@KunalSiyag

Copy link
Copy Markdown
Owner

What

Fixes "the chat doesn't reply in context" from the engagement feedback. Replies in the global chat and in face-to-face talks now answer what the player asked, using what is really going on in the city.

  • City facts (scripts/fp/chat/chat_facts.gd, no nodes):
    • For a district: what its mayor did on their last turn, in words ("zoned 6 homes near Elm Street and ordered a fire station"), their latest post, the Gazette headline, the council's last ruling ("passed the Youth Curfew"), incidents, sites going up, the district's numbers and its top complaints. Names only, never coordinates.
    • The player-reply prompt (the player's district) and the talk prompt (the resident's district) carry these as city_facts, and both prompts now ask the model to answer what the visitor asked from them.
    • Offline, the answers quote the same facts. "What's going on?" gets an incident, the mayor's turn, a site going up, the headline, the ruling or a complaint.
  • Named mayors answer in person:
    • "Mayor Han, what did you do today?", "ask Quintero" or a bare "mayor" (the player's district) brings that mayor in. Their card leads the live prompt with their last turn, and they answer first.
    • If the live reply leaves them out, or offline, they answer from their facts, for example: "Yesterday I zoned 2 homes near 382 Copper Street and zoned 1 home near 374 Yardley Avenue. Come by City Hall and tell me more."
    • "Rosa" on its own does not mean Mayor Quintero, because residents can be called Rosa too.
    • /mayor decrees keep the "To the mayors:" prefix in the reply call, so the district's mayor answers them.
  • Replies never vanish:
    • A reply to the player is dropped only when it copies another reply that is still waiting, never because an earlier row said the same thing.
    • Each reply call gets its own seed, so a question asked twice gets two answers.
    • While the player is being answered, the drip holds everyday lines. Alerts still come through.
  • Typing row: animated dots above the chat input. It shows "Someone is typing…" while the call is out, then the next speakers by full name ("Bruno Yilmaz and Pablo Tanaka are typing…", "Mayor Han is typing…"). It uses full names because first names repeat a lot in a big city. The photo tour caught two Amaras answering in a row.
  • Live status card: after 2 failed live calls in a row, a "Chat" card says "Live replies are slow right now. Neighbours answer from what they know." The next good call posts "Live replies are back." An offline client never counts as a failure.
  • Photo tour: a new chat_reply shot asks the district's mayor about their day and catches the answer while the next neighbour is typing.
  • No new flag: this refines the existing chat feature.

Checks

  • GATE_RETRIES=1 tools/gate.sh full on d251a13: PASS, 33 of 33 steps on the first attempt (about 5 minutes, no retries).
  • pre-commit run --all-files and python tools/checks/run_all.py: PASS. API docs regenerated. ChatFeed.fast_count leaves the dead-code baseline, because the typing row uses it now.
  • fp_chat_test adds the live and offline answers in context, the typing row, the drip hold, the status card and the tour hook. The new fp_chat_context_test covers orders and rulings in words, mayor names, forced replies, the hold and the typing line.
  • Windowed 1600x900 photo tour, 6 days offline: 23 shots, no script errors. In chat_reply, Mayor Kimura answers with her real last turn, a plumber follows, and the typing row names the next neighbour.

Replies in the global chat and face to face now answer what the player
asked with what is really going on. scripts/fp/chat/chat_facts.gd puts
the district mayor's last turn in words ("zoned 6 homes near Elm Street
and ordered a fire station"), their post, the Gazette headline, the
council's last ruling, incidents, sites going up, the district's numbers
and its top complaints into the player-reply and talk prompts as
city_facts, and the offline answers quote the same facts.

A mayor the player names, or the district's mayor for a bare "mayor",
answers first and in person: their card leads the live prompt with their
last turn, and when the live reply leaves them out (or offline) they
answer from their facts.

Replies to the player are no longer dropped as repeats of earlier rows,
each reply call gets its own seed, and the drip holds everyday lines
while the player is being answered. A typing row above the input names
who answers next, and a Chat status card says when live replies fail
twice in a row and when they come back. A new chat_reply photo-tour shot
shows a question to a mayor being answered.

fp_chat_test covers the live and offline answers, the typing row and the
status card; the new fp_chat_context_test covers the facts in words,
mayor names, forced replies, the drip hold and the typing line.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Automated review

No new findings on the 18 changed files (gdlint, complexity, TODO policy, dead code).

Run python3 tools/checks/run_all.py locally for the full set of checks.

@KunalSiyag
KunalSiyag merged commit 136b890 into main Oct 20, 2026
8 checks passed
@KunalSiyag
KunalSiyag deleted the fp/chat-context branch October 20, 2026 18:55
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