Skip to content

Seed quest name generation so retries cost one synced RNG draw - #980

Open
romangr wants to merge 1 commit into
rwmt:devfrom
RimWorld-mods-patches:pr/quest-name-language-determinism
Open

Seed quest name generation so retries cost one synced RNG draw#980
romangr wants to merge 1 commit into
rwmt:devfrom
RimWorld-mods-patches:pr/quest-name-language-determinism

Conversation

@romangr

@romangr romangr commented Aug 12, 2026

Copy link
Copy Markdown

Problem

Quest naming retries while the generated name collides with an existing quest's name, and NameGenerator's GrammarRequest overload retries while its validator rejects the text. Both retry counts depend on the generated strings, and therefore on the client's language — the Russian rule packs collide constantly where English rarely does.

Every retry consumes synced Rand draws, so with mixed-language players in the same game the RNG streams diverge and quest sites land on different tiles.

Fix

Two methods added to SeedGrammar's TargetMethods in Source/Client/Patches/Seeds.cs:

  • NameGenerator.GenerateName(GrammarRequest, Predicate<string>, bool, string, string) — this overload holds the validator retry loop and is called directly by quest naming, bypassing the RulePackDef overload that is already seeded.
  • QuestNode_ResolveQuestName.Resolve — the outer loop that retries whole NameGenerator calls while the name collides with an existing quest's.

Seeding both means the entire retry loop costs exactly one synced draw, regardless of language or how many collisions occur.

Verification

dotnet build Source/Multiplayer.sln -c Release succeeds with 0 errors against dev alone; the change touches only vanilla RimWorld symbols

Quest naming retries while the generated name collides with an existing
quest's name, and NameGenerator's GrammarRequest overload retries while
the validator rejects the text. Both retry counts depend on the generated
strings and therefore on the client's language — the Russian rule packs
collide constantly where English rarely does. With mixed-language players
the synced Rand streams diverge and quest sites land on different tiles.

Wrap QuestNode_ResolveQuestName.Resolve and the GrammarRequest overload of
NameGenerator.GenerateName in SeedGrammar so the whole retry loop costs
exactly one synced draw regardless of language.
@notfood notfood added fix Fixes for a bug or desync. desync Bug that specifically causes a desynced state. 1.6 Fixes or bugs relating to 1.6 (Not Odyssey). labels Aug 12, 2026
@notfood notfood moved this to In review in 1.6 and Odyssey Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.6 Fixes or bugs relating to 1.6 (Not Odyssey). desync Bug that specifically causes a desynced state. fix Fixes for a bug or desync.

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

2 participants