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-
i need some help with AI
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
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.
-
- Posts: 32
- Joined: Tue Dec 21, 2004 11:36 am
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
20 goto 10
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]
http://irrlicht.sourceforge.net/phpBB2 ... gle#18985 [/url]