fun-bots icon indicating copy to clipboard operation
fun-bots copied to clipboard

feat: add dynamic BotChatter system with regional packs (AU/NZ/UK/CA/US)

Open JenkinsTR opened this issue 5 months ago • 9 comments

Base: squad-mates-use-full-vehicle-seats-and-more by @MatiasPastori (not master) Scope: Add BotChatter system + regional packs

Summary

Adds a modular BotChatter system with multiple regional packs (AU, NZ, UK, CA, US as Default), personality biasing, light text distortion, and per-event triggers (kill, headshot, longshot, vehicle, multi, streak, spawn, revenge, round start/end). All lines are ASCII-only and scoreboard-safe.

Key changes

  • New server modules: ext/Server/BotChatter/{BotChatter.lua, PackLoader.lua, Personalities.lua, Distort.lua, Util.lua}
  • New chatter packs: ext/Server/BotChatter/Packs/{AU.lua, NZ.lua, UK.lua, CA.lua} + US style Default.lua
  • Name system integration: regional name packs + runtime regional tagger (dynamic and random; not baked into names)
  • Spam control: per-bot rate-limit + per-category cooldowns
  • Lifecycle guards: skip emissions during teardown (Level:Destroy)

Config

ext/Shared/BotChatterConfig.lua

  • defaultPack = "Default"
  • allowPerBotPackByTag = true (maps [AU], [NZ], [UK], [CA] etc to their packs)
  • Personality mode: seeded (deterministic per-bot with seed = 1337)
  • Rate limit: 2 messages / 8s per bot by default (can tighten if preferred)

Rendering rationale (no WebUI changes)

The chat feed is drawn via DebugRenderer:DrawText2D to avoid conflicts with Fun-Bots’ existing WebUI (used for admin tooling and path/waypoint editing). Hooking that UI requires its own integration pipeline and admin context, so BotChatter renders a lightweight, non-interactive overlay that does not modify or depend on WebUI. Casting via the ingame chat system results in limitations I wasn't happy with, such as every message coming from "ADMIN". There is no way that I know of to emulate bots sending messages as if they're unique players. This was the driving factor for using DebugRenderer:DrawText2D, as I first tried to hook into the Fun-bot WebUI but found that it conflicted too heavily with the existing implementation. This is still doable, but will require a new vuic be compiled to support it, and ultimately, still won't be cast via the ingame chat system.

'Mention' feature

Bots can dynamically mention other bots or the human player in their lines. When a bot mentions the local player, the entry is rendered with a highlighted style in the BotChatter UI so it stands out. Mentions use sanitized display names and are rate-limited like other lines. I have also coloured teams' global chat messages to make the difference between team and enemy team chat's stand out using BF3-like colours.

Compatibility / why this PR targets a feature branch

This PR depends on squad-mates-use-full-vehicle-seats-and-more only because of the modified __init__ files that bootstrap BotChatter (client/server/shared).
If someone wants to add BotChatter to a different branch/build:

  1. Copy ext/Server/BotChatter/**, ext/Client/BotChatterClient.lua, ext/Shared/Names/** and ext/Shared/BotChatterConfig.lua.
  2. Ensure the target branch’s __init__ files include the BotChatter bootstrap (Client/Server/Shared require lines).
  3. Make sure that ext/Shared/Constants/BotNames.lua is overwritten with my shimmed version

No other Fun-Bots features are required.

Testing

  • VU Build 20079, multiple full Conquest matches with Fun-Bots
  • Flags: -debuglog -trace -vexttrace -tracedc
  • Result: stable; chatter frequency within targets

Known limitations

  1. Occasional double-send from the same bot when two categories trigger in the same tick (e.g., Streak + Kill).
  2. High bot counts increase volume. With very large bot lobbies (and especially when hosting client + server on one machine) this can stress the overlay and server. This might require some kind of exponential cooldown so that the more bots = less frequent the messages.
  3. Player-mention spacing glitch in the overlay when the local player is highlighted (layout bug; still investigating).
  4. Timing polish: lines are intentionally conservative but can feel a touch “clinical”; happy to adjust jitter and category priorities based on feedback.

Notes

  • All lines ASCII; no hard-coded clan tags in packs (regional tags are applied dynamically and randomly at runtime).
  • Minimal touch to existing code paths:
    • client/server/shared __init__ files bootstrap BotChatter
    • ext/Shared/Names/NameProvider.lua + a small shim in Shared/Constants/BotNames.lua to enable modular name assignment
  • Safe to merge independently of other features.

Reviewer checklist

  • Build & run on squad-mates-use-full-vehicle-seats-and-more by @MatiasPastori
  • Sanity-check rate limiting during a round
  • Verify no chatter during round teardown

Follow-ups (separate PRs if desired)

  • Additional packs (BR/JP/EU etc), variant tone packs (PG-13/banter levels), stricter moderation presets
  • Could add back the names that were originally stored in Shared/Constants/BotNames.lua as it's own pack (or split packs) in ext/Shared/Names/packs. Most of the "regular" names from it are already included in global_default.lua pack

Screenshots

vu_lIIsT4OJx4 Screenshot (5) Screenshot (4) Screenshot (3)

JenkinsTR avatar Aug 10 '25 20:08 JenkinsTR