## About The Pull Request This PR removes the `basic_mob_attack_telegraph` component from all mobs which were using it and instead implements an attack delay directly into the basic melee AI behaviour. This delay simulates "moving your mouse into position", human reaction times, and the fact that the previous implentation of simple mobs would only try to melee attack on a predictable timer you could "juke" around. The way that this delay works is that it starts as soon as the mob enters melee range and resets if you are ever out of the mob's reach, so there will be no delay if you are foolish enough (or unfortunately preventing from doing otherwise) to continue standing next to a mob but there is enough of a one to duck in and out of melee range with a goliath while using a crusher without getting hit, although trying to run past one usually won't work. This delay defaults to 0.3 seconds which in my testing experience was roughly enough to dip in and out of range without getting hit but not enough to run all the way past a mob without getting hit. It can be overriden via the blackboard, although currently no mob does this. I _was_ testing this locally with no latency though so I guess we'll listen out to see if miners start yelling. ## Why It's Good For The Game The visible attack broadcast is very cool but its visibility made melee combat with any mob that had it significantly easier to such a degree that any mob with it on could not really be expected to do melee damage to any character that wasn't suffering some kind of immobilisation effect which was never really the intention. Removing it also removes any additional handicap that was applied to sapient versions of these mobs, which was never really necessary or intended in the first place. I did not remove the component entirely from the game for two reasons: - Out of the hope that there is some use for it somewhere, because I think it's cool, but more importantly: - Because it's still being used by simple mob megafauna as a workaround for a bug we couldn't figure out. ## Changelog 🆑 balance: Most mobs will now hesitate for a moment before attacking rather than instantly hitting anything that enters melee range, to better simulate human behaviour. Please report if this delay seems too short, or too long. balance: Most mobs which telegraphed their basic attacks on you now will not do that /🆑
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.