i need some help with AI

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
databandit
Posts: 32
Joined: Tue Dec 21, 2004 11:36 am

i need some help with AI

Post by databandit »

Hi,
I am developing an FPS game.
I have almost everything done... except the most important thing: AI!
I need help with two things:
1. How to make an enemy shoot me when I come near him
2. How to make the enemy keep facing towards me until I kill him.

I also need some help with timing.
For example.. if the player is using a shotgun, there's a pause of 500ms before each shot.

It will be really helpful if someone posted some code.
Thanks
-Zubair-
FlyHigh
Posts: 111
Joined: Wed Mar 23, 2005 12:05 am

Post by FlyHigh »

AI is a very vast subject so there isn't really one way of doing it.

But simple speaking just draw a ray between the two players and if it doesn't connect with a wall first then your in line of sight so they can start shooting each other.

To keep them shooting just have a boolean value set to true when they see someone and set it to false when either die or lose line of sight.

This is far from intelligence but you should see results

#edited: can't find link now :(
Last edited by FlyHigh on Sun May 15, 2005 11:21 am, edited 1 time in total.
databandit
Posts: 32
Joined: Tue Dec 21, 2004 11:36 am

Post by databandit »

well...
i took care of problem number 1...
Brinsky
Posts: 28
Joined: Sun May 08, 2005 3:05 pm
Location: Slovenia

Post by Brinsky »

well first point partially solves your second problem. If you already set the line of fire, it means you have a planar (x,z component) line between them. From the enemy you calculate the angle between his line of view (x,z component of rotation) and the line that connects him to your character. If you set a while(fighting) condition, the angle should be set to approx. = 0. Have fun
10 I lovez my computer
20 goto 10
SARIN
Posts: 139
Joined: Fri Oct 29, 2004 3:53 am

Post by SARIN »

heh, uh, for my game i cheated a little. i simply made it random that everytime they fired they would hit me with a 1/5 chance. for facing you, use arras's code, it worked for me
http://irrlicht.sourceforge.net/phpBB2 ... gle#18985 [/url]
Post Reply