0 Favourites

How to make AI for a Shooter?

This forum is currently in read-only mode.
  • 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.

  • Topdown or side view?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • top down

  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)