How do I make AI for a top down shooter?

Get help using Construct 2

Post » Sun Feb 17, 2013 9:40 pm

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
B
3
Posts: 7
Reputation: 301

Post » Mon Feb 18, 2013 12:57 am

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)
B
7
S
2
Posts: 18
Reputation: 891

Post » Mon Feb 18, 2013 2:02 am

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 ideasmystazsea2013-02-18 10:02:16
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
29
S
11
G
8
Posts: 313
Reputation: 7,335

Post » Mon Feb 18, 2013 2:21 am

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
[URL]http://s17.postimage.org/6u9nqi7gf/Sketch181131154.jpg[ /URL]mystazsea2013-02-18 02:39:05
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
29
S
11
G
8
Posts: 313
Reputation: 7,335

Post » Mon Feb 18, 2013 3:07 am

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.
B
3
Posts: 7
Reputation: 301

Post » Mon Feb 18, 2013 6:10 am

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...
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Mon Feb 18, 2013 10:05 am

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..:-)
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
29
S
11
G
8
Posts: 313
Reputation: 7,335

Post » Mon Feb 18, 2013 1:21 pm

[QUOTE=mystazsea]
Stay tuned ..a full featured ai will be released soon on the forums for top down shooters....
[/QUOTE]

Exciting!
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Mon Feb 18, 2013 8:45 pm

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
tryingthisout2013-02-18 20:48:43
B
3
Posts: 7
Reputation: 301

Post » Mon Feb 18, 2013 8:50 pm

[QUOTE=mystazsea]
Stay tuned ..a full featured ai will be released soon on the forums for top down shooters....[/QUOTE]

Looking forward to that!
B
72
S
25
G
9
Posts: 382
Reputation: 10,649

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, anty21ro, mallorcaredes, PavleNikolic and 26 guests