How do you make advanced combat AI?

I am currently working on an AI system where the AI pressures the player by attacking, parrying, and even rolling.

An example:

I already have the combat system down, my problem is I don’t know how to recreate the movement where the NPC approaches the player or even backs up at times. Any ideas on how this was made?

AI?

Don’t you mean IF statements?

If enemy player is doing a light attack, 50% chance to block, 50% chance to dodge.

For more advanced you can use Machine learning which is basically just learning which one is more effective based on input data.

More examples, and a link to behavior trees to organize that If else behavior.

1 Like

Alright, thanks! Just one question, how would I make the NPC move to the side of the player that is attacking? My first thought was to use :MoveTo() then offset the position of the character for a bit but I couldn’t quite figure it out.

Use :MoveTo() and offset the position

Sorry Im working on a similar thing rn so I have a question for you. With machine learning what are some conditionals to run for finding which is the best option because for the past 2-3 days I haven’t been able to think of any good conditionals to make the ai decide whether to block or dodge.