enemy AI

Talk about making games.

enemy AI

Postby elite » Sat Oct 13, 2007 11:34 pm

hi, could someone tell me how to make enemy AI. Because i need the enemy to "wander" around the level and shott you when it sees you. This is a prety advanced question, should i have put this in the advanced forum area? :D
thanks
twigser
after reading this you have just realized you have wasted 5 seconds of your life.
User avatar
elite
 
Posts: 29
Joined: Wed Oct 03, 2007 12:07 pm
Location: in URECTUM
Score: 0 Give a positive score

Re: enemy AI

Postby DilloDude » Sun Oct 14, 2007 4:17 am

It really depends on your exact setup. There is no 'universal' AI where you can just tell an enemy what it can do and what it hopes to achieve and it will sort it out. For your situation, I'd would do something based along these lines:
ENEMY:
check health and other important data. Get distance to player. If distance < some value,( turn towards player. Shoot at player if aiming in general direction. ) else move aboout randomly.
Of course you can add other effects (such as weaving about to avoid your shots if you're aiming at him). If you need more help, I can give you some proper code. Just describe the situation and tell me what actor variables you have available.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: enemy AI

Postby elite » Sun Oct 14, 2007 6:16 am

have you ever played the game worms? the layout is kinda like that.
after reading this you have just realized you have wasted 5 seconds of your life.
User avatar
elite
 
Posts: 29
Joined: Wed Oct 03, 2007 12:07 pm
Location: in URECTUM
Score: 0 Give a positive score

Re: enemy AI

Postby Kalladdolf » Sun Oct 14, 2007 11:52 am

worms is very, VERY advanced and difficult to make :shock:
I tried it once, but had to give it up.
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: enemy AI

Postby Bee-Ant » Mon Oct 15, 2007 1:42 pm

Make an actor called "PlayerArea", with Filed region parent with player
If your enemies are colliding with it make your enemies shoot you..maybe :

Enemy>CollisionEvent>PlayerArea>ScriptEditor>
Code: Select all
shoot=1;

Enemy>CollisionFinishEvent>PlayerArea>ScriptEditor>
Code: Select all
shoot=0;

Enemy>DrawActor>ScripEditor>
Code: Select all
if(shoot==1)
{
    //shoot action
}


If you want to move this topic to the Advance Topic, so you're advance user, if you're advance user you must know what I mean... :D
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron