mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 08:08:49 +01:00
some more ai optimizations (#86975)
## About The Pull Request ai controllers that have exhausted all their current behaviors now stop processing until the next cycle, so we no longer need to do these checks on every process fire. idle behaviors are now instead handled by a new low priority subsystem. these are the costs before/after roughly 25 minutes into the round  ## Why It's Good For The Game improves ai performance ## Changelog 🆑 /🆑
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
/// Handles making mobs perform lightweight "idle" behaviors such as wandering around when they have nothing planned
|
||||
SUBSYSTEM_DEF(unplanned_controllers)
|
||||
name = "Unplanned AI Controllers"
|
||||
flags = SS_POST_FIRE_TIMING|SS_BACKGROUND|SS_NO_INIT
|
||||
priority = FIRE_PRIORITY_UNPLANNED_NPC
|
||||
init_order = INIT_ORDER_AI_CONTROLLERS
|
||||
wait = 0.25 SECONDS
|
||||
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
|
||||
///what ai status are we interested in
|
||||
var/target_status = AI_STATUS_ON
|
||||
|
||||
/datum/controller/subsystem/unplanned_controllers/stat_entry(msg)
|
||||
msg = "Planning AIs:[length(GLOB.unplanned_controllers[target_status])]"
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/unplanned_controllers/fire(resumed)
|
||||
for(var/datum/ai_controller/ai_controller as anything in GLOB.unplanned_controllers[target_status])
|
||||
ai_controller.idle_behavior.perform_idle_behavior(wait * 0.1, ai_controller)
|
||||
Reference in New Issue
Block a user