fix: random twist chance down to 15% from 100% - #55
Conversation
Bots will now actively engage with player questions
Hokken
left a comment
There was a problem hiding this comment.
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:
-
build_player_msg_conversation_prompt()still callsmaybe_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. -
The new
0.15probability is hardcoded in multiple prompt builders. Repository policy requires RNG chances to be configurable. Please add a documented.conf.distsetting, clamp it to a valid range, and pass it consistently to all single- and multi-bot player-reply builders. -
PLAYER_REPLY_EXCLUDED_TWISTSstill permits several instructions that can derail direct answers, including:Mention something completely unrelated brieflyReact to something nobody else mentionedGet distracted mid-messageRespond 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.
-
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. -
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.
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: AddedPLAYER_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 optionalexcludelist to filter out twists from the pool before selecting one.chatter_general.py/chatter_group_prompts.py: Lowered the twistchancefrom1.0to0.15for player-response prompts and passPLAYER_REPLY_EXCLUDED_TWISTSas 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
chatter_general.pycompiles/imports cleanly after the docstring fix.