While digging through SWB’s internals, I was surprised to find this in the `PlayerBase` class:
[Sync] public bool IsBot { get; set; }
This meant bots weren’t separate entities—they were just flagged with a `bool`. The entire system relied on `if` statements to determine behavior. That’s when I first suspected things would be more complicated than I expected. And indeed, SWB wasn’t designed for bots. In the weapon class, for example, reloading was handled like this:
else if (Input.Down(InputButtonHelper.Reload))
This meant weapon actions were directly tied to human input. The same applied to shooting. The funniest part? If you gave a bot a gun and held down the left mouse button, both you and the bot would start firing—because the weapon component responded to your keyboard inputs.
While I solved the issue with the property instead of the class by creating my own controller that implemented a common interface, this time I had to dive into the project’s code, refactor it, and extend that common interface.
Fixing the bot logic took me almost a week. The sheer amount of new information slowed me down significantly. Even something as simple as rotating the bot’s camera towards a target was daunting, since I’m not perfect with linear algebra. When I first encountered quaternions, I probably gained a few gray hairs.
Nonetheless, after about four attempts, I managed to write a new bot class, and things started moving forward. Just for fun, I decided to use a human avatar as the enemy and let the player control Terry. This turned the game into a battle where the old avatar takes down the new one.