Reaction AI Steroid Edition

Combine Reaction AI Combat with A* Pathfinding and Automatic Sound Detection!
v4.0

Core features:
A* pathfinding
NPC AI Combat
Automatic Sound detection and follow
saving and loading

User Guide

View the sample demo videos!

Reaction AI Steroid Edition brings a new feature that leverages the A* pathfinding implementation where the NPC can detect audio playing and then automatically go to that location. It combines some of the logic for the previous section (A* Pathfinding) with its own specific requirements and features.

Combat:

Reaction AI is an artificial intelligence engine to be used for game developers that have non-player characters governed by AI or other game components that rely on artificial intelligence for reactions based on actions by the avatar.

It can also be used for other systems that require learning systems and provides an intelligent output based on input. Reaction AI models the human brain and neural networks in its design. It learns over time and uses past events in a memory system to determine the next best reaction. However, it is pseudo-dynamic in the resulting output based on how well the “brain” is functioning at that time based on stimuli.

The “brain” is divided into four components, each sized proportionally to the human mind. This includes the Frontal Lobe which performs reasoning and emotion, the Parietal Lobe for movement, the Occipital Lobe for visuals, and the Temporal Lobe for memory. When the “brain” is created, the number of total neurons must be specified. This will generate an n-ary tree. At each time a new “brain” is created (i.e. for different NPCs), a different brain structure is created dynamically and pseudo-randomly. When stimuli is applied (i.e. an avatar action), Reaction AI will send a random set (within a range) of electrons to each component of the brain (also proportional to the size of the respective lobe) to activate a subset of the neurons.

The algorithm uses the active neurons to total neurons to determine the performance of the “brain” in each of the lobes for their respective purpose. Thus, a better functioning “brain” will yield more “intelligent” results. Each time stimuli is applied, the “brain” will function slightly better or worse due to the difference in the number of active neurons. This is done by ranking the results and using data based on whether it can map the avatar action with a calculated emotion and prior reaction data for what the NPC “thinks” is the best next action. If certain data fails to map, fallback mechanisms are performed which still are “intelligent”.

There is a memory system where historical data is stored. When a new memory is created, the successfulness of the most recent reaction is also mapped to that memory cell. The data includes what the avatar action was, what was the AI’s output for that action, and how successful it was. This data grows over time and the “search” starts from most recent memory to earlier in time memories. However, the “search” also goes as far back in memory as the number of active neurons at that time. The maximum size of the memory is the total number of neurons in the temporal lobe. When a new memory is created, and the maximum size is reached, the oldest memory is removed. When the “brain” is created, the memory is initialized with a user defined input (one time) for the NPC’s “personality”, which defines the allowed reactions, sub-reactions, and emotions.

The final output of the system is a reaction category, sub-reaction, emotion, visual rank (ranging from 1 -5 where 1 is the lowest rank and 5 is the highest), and a speed value (ranging from 1 – 4 where 1 is the slowest and 4 is the fastest). You can decide how to handle (how the NPC behaves) based on the output, and can cause a different reaction as well based on the values returned for emotion, visuals, and speed. The neural networks involve the structure of the “brain”, the stimuli that activate neurons, the memory, and the personality, being passed to different functions in different parts of the “brain” and results in final outputs. The fact that the system is varying each time a “brain” is created, the performance of the “brain” per stimulus, and what the allowed output values can be, allow Reaction AI to be reused any number of times with varying results. Thus, the same engine can be used for any number of different NPCs or AI based elements. The user defined “size” of the “brain” also introduces dynamics.

Finally, for extremely large “brain” sizes, and longer periods of learning, Reaction AI can be as complex accordingly.

Also, for NPC attacks (proactive actions instead of reaction to avatar action), use Avatar action states as idle=1, blocking=2, starting attack=3, etc)


A* Pathfinding:

Reaction AI v4.0 supports pathfinding for NPCs using the A* algorithm. The asset contains demo scenes, grid files and scripts.
You can have as many NPCs use A* (limited by performance) with their own AStar object. The pathfinding uses a text file that describes the map/level that you must create first.
You can also call the pathfinding method on the same AStar object if the “goal” has changed by calling the setGoalLocation method and setNPCLocation method and then call getShortestPath after that.

Using Reaction AI allows you to path-find to the Avatar, and then use the combat support to enter combat with the Avatar. Furthermore, you can design the NPC with the Reaction AI to have some of its reactions map to follow/find the avatar.
For example, the Brain can use a ‘reaction’ 4 which maps to ‘follow/find’ if the avatar flees and the ‘Brain’ for the NPC has learned this. There are only four API calls required to implement A* within Reaction AI.