Files
Bubberstation/code/datums/ai
SmArtKar 44c968f75e Adds a unit test for techweb design presence, puts some missing designs into protolathes (#90219)
## About The Pull Request

Adds a unit test that checks that all designs are accessible through
some source, be it techweb, disks, or innate designs. Certain designs,
like pocket extinguishers, entertainment screens, etc, that have been
present in autolathes but not in the techweb despite having PROTOLATHE
flag assigned have been put into protolathes (where it made sense,
otherwise the flag was removed).
An important change is that restaurant portals are now printable, and
thus can be constructed and deconstructed. Indestructible portals have
been a major gripe of mine for a while, and I don't see a solid reason
for keeping them indestructible if they can easily be printed from the
service protolathe.

Closes #90212

## Why It's Good For The Game

Initial argument for keeping portals unbreakable was to prevent people
from griefing the chef/bartender, but by that logic we can make most
machinery unbreakable too. I don't think that having an unbreakable
portal is good if its locking us out from allowing chefs/bartenders to
reorder or even outright reposition their lunchroom/bar.

## Changelog

🆑
balance: Restaurant portals can now be printed, constructed and
deconstructed. They're also no longer completely invulnerable.
/🆑
2025-04-03 08:05:08 +02:00
..
2025-01-05 20:56:47 -05:00
2025-01-10 13:03:36 +01:00

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.