## About The Pull Request Another atomisation of #71421 but I had a fun idea while I was testing it. This adds a component based on the existing system for giving instructions to tamed carp or dogs, but hopefully more modular. It also gives it to the rat minions of a regal rat. The basic function allows the mob to listen and react to spoken commands, which passes things to its AI blackboard. Additionally if you alt-click a commandable mob it will show a radial menu which both allows you to select a command, and also contains tooltips explaining what they do and what audible words trigger it. <details> <summary>Video</summary> https://user-images.githubusercontent.com/7483112/204308693-0eccebec-75c9-411c-81c5-5aa0d682d1a5.mp4 </details> Now if you riot some rats, you can alt click on them individually to give them specific orders (more useful for other creatures than rats), or you can speak out loud to command your legion. Rats aren't very smart so you can't give them many instructions, but this is expandable for other creatures. Additional change: Mice don't squeak if stepped on by other mice because this made an absolutely unholy noise and I am not sure there's a way to get non-dense mobs to spread out. ## Why It's Good For The Game Allows for giving more mobs the ability to be tamed and instructable by their owner, without copy/pasting code which lives inside a specific mob. Yelling at your rats to give them commands is funny. It also adds the possibility of telling your rats to stop biting someone if they have agreed to your demands, allowing for more courtly roleplay. When Regal Rat is converted to a basic mob its AI can also give other AIs instructions by yelling at them which I think is a good feature. ## Changelog 🆑 add: The followers of Regal Rats will now respond to simple instructions, if given by their rightful lord. Except frogs. They're too busy licking themselves and watching the colours. /🆑
AI controllers
Introduction
Our AI controller system is an attempt at making it possible to create modularized AI that stores its behavior in datums, while keeping state and decision making in a controller. This allows a more versatile way of creating AI that doesn't rely on OOP as much, and doesn't clutter up the Life() code in Mobs.
AI Controllers
A datum that can be added to any atom in the game. Similarly to components, they might only support a given subtype (e.g. /mob/living), but the idea is that theoretically, you could apply a specific AI controller to a big a group of different types as possible and it would still work.
These datums handle both the normal movement of mobs, but also their decision making, deciding which actions they will take based on the checks you put into their SelectBehaviors proc.
If behaviors are selected, and the AI is in range, it will try to perform them. It runs all the behaviors it currently has in parallel; allowing for it to for example screech at someone while trying to attack them. As long as it has behaviors running, it will not try to generate new plans, making it not waste CPU when it already has an active goal.
They also hold data for any of the actions they might need to use, such as cooldowns, whether or not they're currently fighting, etcetera this is stored in the blackboard, more information on that below.
Blackboard
The blackboard is an associated list keyed with strings and with values of whatever you want. These store information the mob has such as "Am I attacking someone", "Do I have a weapon". By using an associated list like this, no data needs to be stored on the actions themselves, and you could make actions that work on multiple ai controllers if you so pleased by making the key to use a variable.
AI Behavior
AI behaviors are the actions an AI can take. These can range from "Do an emote" to "Attack this target until he is dead". They are singletons and should contain nothing but static data. Any dynamic data should be stored in the blackboard, to allow different controllers to use the same behaviors.
Guides:
Making Your AI: Quickly runs through how to make an ai controller for anything with a step by step development of one.