Skip to content

fix: random twist chance down to 15% from 100% - #55

Open
jpitm3 wants to merge 2 commits into
Hokken:masterfrom
jpitm3:master
Open

fix: random twist chance down to 15% from 100%#55
jpitm3 wants to merge 2 commits into
Hokken:masterfrom
jpitm3:master

Conversation

@jpitm3

@jpitm3 jpitm3 commented Aug 26, 2026

Copy link
Copy Markdown

fix: reduce random twist chance so bots engage with player questions

Summary

Bots were applying a "creative twist" to 100% of replies, which frequently caused them to ignore or talk past direct player questions (e.g. responding to an imaginary message, changing the subject abruptly, agreeing with something nobody said). This drops the twist chance to 15% and excludes conversation-derailing twists specifically from player-directed replies, so bots now actually engage with what the player asked.

Changes

  • chatter_constants.py: Added PLAYER_REPLY_EXCLUDED_TWISTS — a list of twists (e.g. "Respond to an imaginary previous message", "Change topic abruptly", "Agree with something nobody said") that are unsuitable for direct player replies.
  • chatter_prompts.py: maybe_get_creative_twist() now accepts an optional exclude list to filter out twists from the pool before selecting one.
  • chatter_general.py / chatter_group_prompts.py: Lowered the twist chance from 1.0 to 0.15 for player-response prompts and pass PLAYER_REPLY_EXCLUDED_TWISTS as the exclusion list.
  • chatter_general.py: Simplified the length-hint prompt text, removing the duplicated hard-limit blocks in favor of a shorter "follow this closely" instruction; also removed a stray "Keep it brief" line that conflicted with the new length-hint wording.
  • chatter_general.py: Fixed a compile error — an unterminated docstring on _pick_length_hint() (missing closing """) left over from the twist-chance refactor.

Why

With twists always active, bots would go off-topic instead of answering players, making General/group chat interactions feel unresponsive and scripted. Reducing the frequency and excluding derailing twist types keeps replies flavorful without sacrificing basic conversational relevance.

Testing

  • Verified chatter_general.py compiles/imports cleanly after the docstring fix.
  • No automated tests included in this diff; behavior change is probabilistic (twist chance) and best verified in-game or via manual prompt inspection.

Bots will now actively engage with player questions
@jpitm3
jpitm3 marked this pull request as draft August 26, 2026 22:38
@jpitm3
jpitm3 marked this pull request as ready for review August 26, 2026 22:41

@Hokken Hokken left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jpitm3 , thanks for working on this. The underlying issue is valid, and reducing disruptive creative twists should make player interactions considerably more responsive. I found a few areas that need addressing before the fix is complete:

  1. build_player_msg_conversation_prompt() still calls maybe_get_creative_twist(chance=1.0) without the player-reply exclusions. Group-directed messages can force this multi-bot path, so player questions may still receive the same derailing twists. Please apply the new player-reply twist policy to this builder as well.

  2. The new 0.15 probability is hardcoded in multiple prompt builders. Repository policy requires RNG chances to be configurable. Please add a documented .conf.dist setting, clamp it to a valid range, and pass it consistently to all single- and multi-bot player-reply builders.

  3. PLAYER_REPLY_EXCLUDED_TWISTS still permits several instructions that can derail direct answers, including:

    • Mention something completely unrelated briefly
    • React to something nobody else mentioned
    • Get distracted mid-message
    • Respond as if you misheard something

    Please feel free to replace all twists that conflict with answering the player and replace them with some twists known to be safe for player-directed replies.

  4. The _pick_length_hint() changes are unrelated to the twist fix and weaken a shared contract. Guild chatter imports this helper and explicitly relies on its 150-character hard limit without post-generation truncation. Please revert the length-hint and related brevity changes from this PR.

  5. Please add deterministic regression tests by mocking RNG. Coverage should verify:

    • the configured twist probability;
    • exclusions in both normal and roleplay modes;
    • single-bot General replies;
    • single-bot party replies;
    • multi-bot party replies;
    • preservation of the shared 150-character prompt contract.

Thanks again for tackling this. The single-reply changes are heading in the right direction; covering the remaining player-reply path and keeping the unrelated length behavior intact should make the PR ready for another review.

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.

2 participants