Enemy AI?

hi, me again. i wanted to know how i can make enemy ai for my fighting game.
i tried to do it but i failed. terribly.
if your ingame and you want music press one, when it finishes press 3 or 1 again depending on which song you want to hear. Plz help me. :slight_smile:


Practice of magic.blend (719 KB)

An AI is basicly an decider. It decides what to do next.

If you think about the user control is a special form of an AI. It takes the user input to decide what’s next.

All you need to do is “simply” write logic that decides.

Some hints:
Find out what options are present (the analysing part).
Then choose one of the options to be processed (the evaluating and choosing part).

Processing the decision is the same as for the player (e.g. go left, go right, pickup something, open door).

I hope it helps

PS: The decision should be something that the logic can process. “Hating the player” is a bit difficult if not defined in detail, while “turn left by 90 deg” is much more specific.

You can have something like:

  1. When the enemy touches he property of your player, then he attacks
  2. You can add states for different attacks that switch off(ex: Punch, kick, punch, kick)

I would also recommend Python if you’re not using it already. Doing AI in logic bricks will most likely be very difficult - more than just to learn the Python necessary to implement the same behavior. It also will give you more flexibility (head towards the nearest health pack, move towards the Player, etc).