Is complex FSMs possible with roblox’s servers?

hello fellow developers,

I’ve been working on a REALLY complex finite state machine for the creature in my horror game.

My reference point is something like alien: isolation’s AI. the creature runs multiple layers of logic , all at once:

  • hearing , vision , noise investigation , memory of last known player positions , contextual pathfinding (using ladders , alternate routes).

I’m not sure if the server can handle this much , in a multiplayer setting. If anyone here worked with simple or complex FSMs , what was your approach ? Did it work out?

in a multiplayer setting the server doesn’t use significantly more resources
its still the same number of creatures

roblox servers have decent computing power so if it can’t run well on a roblox server it probably cant run performantly at all

edit: also look into native or tagging functions with @native, which also require accurate type annotations

can you tell me why I should look into native? will I need it?

when you tag a function with native or put --!native at the beginning of a script, that code is compiled into machine code which is much faster than normal lua
but it also needs more strict typing than lua

example:

--!strict
-- position has to be typed as a Vector3 to use the speed advantage
-- because the code is trying to read position.X and position.Z, so it would be much slower if it doesn't know if position is a table or vector, but it wouldn't be slower in normal lua
@native local function groundPosition(position : Vector3)
  return Vector3.new(position.X, 0, position.Z)
end

OR

--!strict
--!native
-- ^^^ automatically makes everything native when possible
local function groundPosition(position : Vector3)
  return Vector3.new(position.X, 0, position.Z)
end