# How to make a fighting AI for my game

So I’m trying to make an AI for my game and wanted to know what are things I can use to make it work? Currently I’ve made a table of different actions it can do like attacking, walking, jumping etc and then I just kind of make it choose the action.

However, I want it to be smart I want it to react to the player and make choices not just randomly do things. I found this module for a neural network Neural Network Library (Obsolete) which could be the way to go, however, I’m not sure if this is the most efficient way.

Try behavior trees visualization, even if not using the API. Think about alot of cases that go in a tree like structure.

1) Firstly
The AI Firstly goes twoards the ai if there is a certain distance…

Once in the actual like ‘striking distance’ the ai needs to find a certain way to interact with the player and actually schedule attacks. For example when it actually stops based on the actual distance vector, you can attack differntly. and you can have different weights of random-ness based on distance.

Reactions. aswell, reactions for AIs Can be instance. but based on a skill or reaction variable you have to make them wait from actually reacting to changes inn the position and the actual striking distance.

Eh, heres me just pouring my thoughts into how you would do it|
Heres the Behavior Trees!

4 Likes

Decision and behavior trees are the best for attempting to make AI for beginners. I feel like neural networks are a bit overkill in your situation.

Neural networks are rarely used for game AI’s, the only game I can think of that uses it is Vehicle Simulator, it doesn’t have to be advanced, it just has to make the impression that its smart, kinda how you can make a flawless Tic Tac Toe AI by just checking for a crazy amount of situations.

I think this AI can be done in a simpler way than by using neural networks. I think the AI should be like this: (let’s pretend I’m the NPC)

if the player is about to hit me, play my block/jump animation to block/dodge the attack
if the player is not in range to attack, play my walk animation
if the player is in range to attack, play my attack animation

It’s obviously more complex than that, but I hope you get the idea.

The thing you linked looks very interesting however I’m a bit confused on how to set it up haha there’s a lot to read brain can’t figure it out.

didn’t see the link linking to the plugin at the verytop L

Spent some time learning behavior trees and this is absolutely poggers thanks so much for sharing this. I still don’t have anything intelligent it’s still just doing things randomly, but using the trees the dummy can move forward, back, jump or attack, and surprisingly my code was somewhat flexible enough to implement the trees and get it working easily.