You can see a melee example implementation in this video:
The implementation basic sample for this is attached.
to create the brain, you simply need to instatiate a brain object like so:
Brain brain = new Brain(30000, “SampleJSONPersonalityInputFile”);
here, 30000 is the number of neurons for this brain. If you have multiple NPCs, each NPC will need it’s own brain object.
I’ve also attached a sample personality input file. This file has all the “reactions” the AI can perform and you would need to map that to an animation and NPCs action and implement your own logic for that (can be anything you want such as IDLE, BLOCK, FLEE, ATTACK_MELEE, ATTACK_SHOOT, etc). This file is specified for how you want the AI to be able to do and can be different for different NPCs that use Reaction AI.
Here are all the API calls after instatiating the “brain”:
reaction = brain.sendStimuli(avAction);//Reaction AI API #1, avAction is the action the avatar just performed
npcAction = reaction.getAction();//Reaction AI API #2
reaction.getSubReaction();//Reaction AI API #3
reaction.getEmotion();//Reaction AI API #4
reaction.getVisualRank();//Reaction AI API #5
reaction.getSpeed();//Reaction AI API #6
brain.createNewMemory(reaction, successPercent);//successPercent can be a formula based on how much damage the NPC has inflicted on the avatar and how much damage the avatar has inflicted on the NPC - example
brain.clearStimuli();//required to create new memories
It should not affect framerate as the computation speed is high. Just an FYI, a brain with an extremely large of neurons will take longer processing times.
2960066–219706–ReactionAISampleImplementation.cs (20.3 KB)
2960069–219709–SampleJSONPersonalityInputFile.txt (1015 Bytes)
2960066–219707–ReactionAIDemo.pdf (637 KB)