Hmm… it might be a little much. For me, looking at your screenshot kinda hurts my brain for a second. It’s not that readable.
I’ve studied AI behaviour systems in games a tiny bit and have also created some of my own. Here’s what I think about creating extensible AI systems:
The AI Problem
Creating extensible AI systems requires an architecture that is adequately generic such that any type of behaviour can be implemented. A lot of thought must be put into such architecture as there is a variety of information that an individual agent may utilize to inform its custom behaviour:
- Player state (e.g. position, rotation, velocity, grounded etc.)
- Agent state (e.g. position, rotation, velocity, grounded etc.)
- Navigation data (e.g. path cost, traversable areas, navigation links etc.)
- Line-of-sight algorithm
- Nearby entities (for example, for flocking algorithms)
- …and so on
Even more importantly, you should first think about the problem in an abstract manner to extract the aspects of the system that must be generalized.
Depending on the game you are making, you may not need a complex, sophisticated AI framework. However, It’s always nice to have the capability to author complex behaviour, so…
Existing AI Architectures
…here’s a section of the AI architectures I know of that allows complex behaviour:
In short, the blackboard system suggests that each agent has a “blackboard”.
Blackboard: a large collection of data that holds any and all information needed to represent the world (as seen by the agent).
Entities write to blackboards to update the state (and thus the behaviour) of agents.
Each agent may also have access to a global blackboard; a blackboard that contains information that does not vary per instance (e.g. gravity).
Essentially, the blackboard acts as an interface between the game world and an agent’s behaviour i.e. a behaviour doesn’t directly modify the agent. The agent is informed by the blackboard, and so is the behaviour.
This is the first AI system I came across years ago. I think it’s a great place to start, and while the tutorial is focused on ScriptableObjects in Unity, the concept can easily be carried over to Godot’s Resource counterpart.
It has its limitations though as the system must get a direct reference to the object whose behaviour it wishes to modify - a big nono when building maintable decoupled systems.
Your current Godot solution
I think you’re on the right track to creating a good system, it’s just very rough right now.
I would recommend that you try and create a state-machine system: a simple system that can switch between states based on a condition (even multiple ones). The aforementioned architecture(s) should give you a good idea of how to do this - but don’t be afraid to make your own modifications or solutions to your problem.
I would also recommend that you store your condition-resources as files and name them instead of creating sub-resources. It’s not that nice to work with.
Other helpful resources
Here’s some GDC talks that discuss AI systems that were implemented into some games:
If you got any other specific questions regarding this, I’ll be happy to discuss them with you.