simple AI

Hi all,

i made a simple AI with only logic bricks.
Let me know what you think about it
it’s free to use if you like it :slight_smile: simpleAI_263.blend (406 KB)

The ‘enemy’ is on layer 2

Thats really good- and its great to see a different approach to the Hmmpph node approach that I have seen / used. I could see this being used in Mr Do/ PacMan style games very easily. States are cool!

By the way, this is my interpretation of the Hmmphh approach I was talking about. I got into Python before I started using states with it, but your example shows how powerful states can be.

Attachments

AI_VER3ex.blend (1010 KB)

Holy cow! This was awesome! When I set up enemy AI I always used “steer” which had a lot of bugs, but this… this is just what I’ve needed. Is there any way I/we could get a run through of the process and pieces? Thanks a lot, and swell job!

@Rubbernuke haha I was meaning for BigBastardB to reply to my comment, not necessarily you, but alas no harm done! Thank you anyways!

@BigBastardB but really, could you break down the parts of the blend and explain it (I would ask for a tutorial but I hate the way that sounds so ill just keep my roundabout way of asking) thanks!

hiya,

sorry for late respons but i just became a daddy so have other things on my mind atm :slight_smile:
Quick breakdown is this ; random actuator picks a number for a property, number corresponds with a direction for the enemy to face
when nothing in the way enemy moves forward, otherwise it stops and random act runs again for random number (direction).

I’ll explain in more detail in a few days just need time to spend with my newborn daughter :slight_smile:

Congratulations BigBastardB! (Welcome to the world of random early morning bottle feeds)!

I got two small baby girls and Blender keeps me sane;)

Ok i finally found time to post my answer, been a little busy these days now that i have a daughter to take care of :smiley:

So, the enemy starts in layer 4 and is directed to goto layer 1. This is the main layer for forward movement.
It keeps moving forward until it collides with an object that has a property called “wall” or until it’s radar detects
another enemy or the player.

In the case it detects a wall or another enemy it moves to layer 2 where an always sensor dictates it has to stop
and run a random actuator which randomly picks a number between 1 and 8. These numbers stand for various
directions which correspond with 8 empty’s, all parented to another empty which in turn is parented to a single vertex
of the ‘body’ of the enemy (in this case called ‘EnemyAi’ ).
This ensures all the empty’s stay in place once the ‘body’ of the enemy starts to rotate
to track to a direction. You can think of these empty’s as the enemy’s compass :slight_smile:
So basically the enemy carries it’s own nodes it tracks to.
These empty’s are conveniently called ‘front’, ‘froRi’ (frontRight), ‘froLef’ (frontLeft) and so on.
After the direction process is done it goes back to layer 1 where everything starts all over again.

In the case the enemy’s radar detects the player it goes to layer 3 which basically dictates the enemy
to track to the player and keep following it, until it collides with an object that has a ‘wall’ property in which case
it moves to layer 2 (same as when it collides with a wall prop in layer 1)
or until the player moved too far away for the enemy’s radar to see it in which case it simply goes to layer 1.

Thats basically everything there is to know about it, but if anyone has any further questions plz feel free to shoot :slight_smile:

Edit: The starting direction for each ‘enemy’ depends on the direction of the Y axis of the
empty that spawns the ‘enemy’.

Great work!:slight_smile:

:smiley: ive just got onto making enemy ai. and was hoping to not have to use python as i dont understand it at all… this is exactly what i wanted. thanks very much.

i wondered how to go about adding a flee option to this. when enemy health gets so low he runs away. would i be right in thinking adding another state for running away, and when he gets so far away go back to state 3 ( i want him to run away for a bit and get back in the fight.

Thank’s man, really helped me out for pacman type game. Cheers :slight_smile: