How to make AI for a Shooter?

For questions about using Classic.

Post » Mon May 30, 2011 5:48 am

My current project, Welcome to the wasteland, will require at least average AI, but so far all I can do AI for is for stupid melee fighters. I know how to do some things, but does anyone know an easy way to make AI stop before it gets to close to you and take cover? And how about attack you only when you attack them or say a certain to them? I could just make it unfair for the player by giving the enemies ALOT more health then him but this game is a shooter/simulator so I want it to be as realistic as possiable. Also I need to know how to make people move from one place, stay there for about 25 seconds then move to another place and repeat.
B
5
S
3
G
4
Posts: 189
Reputation: 2,910

Post » Mon May 30, 2011 9:32 pm

Topdown or side view?
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Mon May 30, 2011 11:02 pm

top down
B
5
S
3
G
4
Posts: 189
Reputation: 2,910

Post » Wed Jun 01, 2011 1:26 am

The AI has to know about the environment. So it needs to know what is actually classed as cover. I'm no AI expert.. hell I'm not even an AI beginner, more like an AI NOOB! but this is my (untested) theory (logically it should work, or you could mix this with A* to get the desired results)....

Let's say you have a PLAYER sprite, an ENEMY sprite, and also a WALL sprite (the cover). What I would do is have SAFECOVER sprites (dummy sprites) around the WALL sprite (all 4 corners and all 4 sides I think - maybe too much?) and have each of them fire off a bullet sprite (dummy sprite that has bullet behaviour) towards the PLAYER. If the bullet sprite hits the WALL, then that is flagged as a good cover position, so move onto the next SAFECOVER sprite. If it hits the player, then obviously it's not safe there, since the enemy can see the player, so therefore, the player can see the enemy. After checking all SAFECOVER sprites, cycle through the enabled ones (good cover) and maybe randomly choose which one to move the enemy towards so it seems less robotic.

If I was to do that kind of game, that's how I would approach it. I'm sure someone can come up with better but since no one has yet offered any suggestions, I thought I'd throw it out there. I have thought about this problem in the past ;) Good luck!
B
15
S
5
G
7
Posts: 877
Reputation: 5,650


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests