DEV Community

Cover image for I am writing a stateless control language for smart game agents, and you are going to love it
Tea
Tea

Posted on

I am writing a stateless control language for smart game agents, and you are going to love it

Ask game developers how they control their game agents, and they'll probably tell you either of two things:

  • If-elses and case logic with control flags/book-keeping; also, event handling, frame updates, co-routines.
  • Blueprints or state machines

Before going with C# behavior trees, I used to write my game agents this way. Nested case logic in the form of if-elses is not very readable, and it's annoying to debug.

Control flags add moving parts, and their actual meaning can be obscure because they're often ad-hoc - not to mention that is state which tends to get out of date.

Events... good in deskop/smartphone applications, or to decouple the UI from the actual game. Not ideal in really dynamic game environments.

With blueprints and state machines, technical designers are used to these. But this comes with the danger of writing very large control graphs, which quickly get too big for technical designers to even grasp - and regular developers losing hair over entangling the resulting visual spaghetti.

After using Active Logic for almost three years, I started wanting something that could work as a middle ground for both developers and technical designers. Experience with stateless BTs also provided clear insight into what scripted control should offer:

  • Full transparency (execution tree, w. time machine)
  • Dynamically debug AND modify the control graph
  • Restricted access to the rest of your agent model (use a facade/blackboard) - but with painless, transparent bindings.
  • Reusable modules, weakly tied to no particular game/codebase

With all that, Active Logic can't be implemented gracefully in languages other than C#, because of the (shorting) ternary logic supporting stateless BT implementations. So I thought, what if we had an easy to implement and port language, which would 100% focus on the control layer, and prevent the progressive corruption caused by mingling control with other implementation details.

Moving quickly towards an alpha!

I am a BT evangelist, Game AI specialist and tool builder; currently available for work

Top comments (0)