How do I make AI for a top down shooter?

0 favourites
  • 13 posts
From the Asset Store
Cannon Ball Shooter game assets for 2D bubble shooter puzzle game.
  • I want to make a top down shooter that has zombies that follows the main character when they are in sight of him. If he gets around a corner (out of the line of sight) then I want then to stop following him. I have the free version.

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I also was trying to do this. I currently have this set up but it doesn't work the way it should:

    Enemy: on created ---> Enemy: find path to (Player.X, Player.Y)

    Enemy: on path found ---> Enemy: move along path

    Enemy: on path arrived ---> Enemy: find path to (Player.X, Player.Y)

  • You are on the right track...see post below for some ideas...I have a full pre formatted customizable plug and play A.I. specially designed for construct 2 and for platformers and 8 direction shooters due out in a few few weeks.. For free as a special gift to all construct 2 users...

    until then see below for a few ideas

  • Ai is complex

    But can be simplified

    You will need some various states of activity for the zombie such as

    1-normal/patrol mode

    2-targeting/targeting mode

    3-dying mode (of course:-) :-) )

    Then Use an invisible helper sprite ...pinned to the zombie ..a fake awareness sight field of view...with the zombie patrolling when the field of view collides with the player you then target lock on by setting the angle of the fov every tick to the xy coordinates of the player...simulating real vision field. ..can also be done for smell or hearing ranges...when this view range is blocked or out of view range the zombie can be told to return to patrol mode...or any other behavior..

    Just remember to reset the fov angle as well

    if you need a full ai

    Stay tuned ..a full featured ai will be released soon on the forums for top down shooters....

    Like this

    http://s17.postimage.org/6u9nqi7gf/Sketch181131154.jpg[ /URL]

  • So this is how I got it set up so far, and it's not working too well...

    System - Every tick:

        Fov Set position to (Zombie.X, Zombie.Y)

    System - Every Tick & Player - Is overlapping FOV (the helping sprite):

        FOV set angle toward (Player.X, Player.Y)

        Zombie set angle toward (Player.X, Player.Y)

        Zombie Toggle findpath

    System - Every tick & Zombie - Is findpath(boolean):

        Zombie Find path to (Player.X, Player.Y)

        Zombie Move along path

    This will turn the zombie's head to me whenever i'm in the FOV but he doesn't follow me. When I leave the FOV then he follows me(sometimes). When he comes to follow me he does a 360 turn then starts heading in the direction I last was. Please help.

  • I would check the ghost shooter tutorial for the events for the actual movement of the Zombies... it should pretty much match what is in that tutorial...

  • Bluephaze is right...that tutorial pretty much covers all you need..

    Fully scripting a complex A.I. can take months to debug .especially for complex environment navigation....but you have to start somewhere and that tutorial is a great place..:-)

  • Stay tuned ..a full featured ai will be released soon on the forums for top down shooters....

    Exciting!

  • Well I added on from what I had and added the ghost tut movement and this is what I have now:

    System - Every tick:

        FOV Set position to (Zombie.X, Zombie.Y)

        FOV Set angle to Zombie.Angle degrees

    System - Every Tick & Player - Is overlapping FOV (the helping sprite):

        FOV set angle toward (Player.X, Player.Y)

        Zombie set angle toward (Player.X, Player.Y)

        

    Here the zombie is looking at the player and has bullet movement so he goes to the player, but my problem is that when I leave the zombies FOV then the Zombie goes off randomly and most of the time gets stuck in a wall and spazes out. Please help

  • Stay tuned ..a full featured ai will be released soon on the forums for top down shooters....

    Looking forward to that!

  • Well I added on from what I had and added the ghost tut movement and this is what I have now:

    System - Every tick:

        FOV Set position to (Zombie.X, Zombie.Y)

        FOV Set angle to Zombie.Angle degrees

    System - Every Tick & Player - Is overlapping FOV (the helping sprite):

        FOV set angle toward (Player.X, Player.Y)

        Zombie set angle toward (Player.X, Player.Y)

        

    Here the zombie is looking at the player and has bullet movement so he goes to the player, but my problem is that when I leave the zombies FOV then the Zombie goes off randomly and most of the time gets stuck in a wall and spazes out. Please help

  • set an event so that if nothing is in the line of sight he will stand there. that will probably fix it.

  • tryingthisout or in your event that checks for the player, add an else that just has the zombie stop by stopping the bullet movement if the player is out of range?

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