With today’s Processing Power I think its time to Revisit Rule-based AI. I’m particularly interested in Expert Systems using if–then rules. An expert system is a computer system that emulates the decision-making ability of a human expert. Expert systems are designed to solve complex problems by reasoning through bodies of knowledge, represented mainly as if–then rules rather than through conventional procedural code.
In revisiting, IF THEN Rules, I reviewed an old post of mine back in my DarkBASIC days on my first Behavioral Rules A.I. Nodes System (BRAINS)concept of implementation. I found this hilarious as at that time I really didn’t know that such an AI existed and thought I was on to something new. Theres even a Behavior Tree in there, LOL. But I felt there were some nuggets of value hiding in this old post.
BRAINS incorporates Give||Take Registry, Binary Decision Trees, Hit Objects (Triggers), Tasks (LUA Script), Dark AI (Pathfinding), and Q & A Diaglog.
The Give||Take Registry
The Give||Take Registry is a list (queue, stack, or any other data structure) of Node Keys. A Node Key contains a: name, value, compare operator, and logical operator. Node Keys can represent any kind of property. The data in the Node Key is used to perform a simple IF condition and return a TRUE/FALSE result. I find it easier to visualize each IF Condition as a node
in a decision tree, hince the label Node Key. All the Node results are tallied to produce a final TRUE/FALSE result.
All Interactive Entities have their own Registry and the Give||Take role is based on the entity that initiates the interaction (collision check). Entities who initiate the interaction are Giving, the receiving Entities are Taking. When Giving, each Node Key can represent something the Entity possesses. When Taking, each Node Key can represent something required by the Giving Entity for positive interaction.
From a coding perspective, we iterate through each Node Key in the Take Registry. Each Node Key is matched-by-name to a Node Key in the Give Registry. The Operators from Take Registry Node Key are used to perform the comparison. If the result is TRUE we continue to the next Node Key, otherwise we exit checking returning a FALSE result. If we’re able to iterate through all the nodes we return a TRUE. Thats it! The final result can used to execute a scripted action.
GTR is a simple and high performance solution for dealing with Interactions that require many conditional checks against a Player Character abilities, skills, accessories, items etc. GTR solves Question #1.