Make the enemy follow a point

Discuss Artificial Intelligence and Bot programming.
Post Reply
JasonX
Posts: 422
Joined: Tue Apr 21, 2009 2:08 pm

Make the enemy follow a point

Post by JasonX »

I'm working on a small Tower Defense mod for Q1 and i'm trying to make dogs and enforcers to follow a specific entity in the map and attack it. I could not find any examples of this, other than following the player. Is there a way to attack something else, other than the player?
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Make the enemy follow a point

Post by ceriux »

i assume it would be the same way but enemy wouldnt be the player.
JasonX
Posts: 422
Joined: Tue Apr 21, 2009 2:08 pm

Re: Make the enemy follow a point

Post by JasonX »

Can i set any entity as the enemy? And how do i make the AI find the best path to the enemy? Is there an AI tutorial for path finding, without path helpers?
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Make the enemy follow a point

Post by ceriux »

i havent really messed with ai. so i dont really know. i know if you use quakes basic AI it may or may not get caught on corners and what not.
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: Make the enemy follow a point

Post by frag.machine »

Yes, a monster can attack other entities (even in vanilla Quake - see monsters infight). All you need is to set the .enemy field.
Navigation without path_corners is more complicated.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: Make the enemy follow a point

Post by r00k »

i was doing something like this on a test zombie mod.
in just an open field i was using tracelines to find a player and stepping forward and turning at a set rate based in the health of the entity. but once u add bsp objects thing get tricky
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: Make the enemy follow a point

Post by frag.machine »

Well the very concept of navigation is to find a way thru obstacles... :D
The obvious way in Quake is to use path_corners, specially if the target is fixed.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
JasonX
Posts: 422
Joined: Tue Apr 21, 2009 2:08 pm

Re: Make the enemy follow a point

Post by JasonX »

frag.machine wrote:Well the very concept of navigation is to find a way thru obstacles... :D
The obvious way in Quake is to use path_corners, specially if the target is fixed.
Is there a sample AI that uses path_corners? Also, what happens if the path gets obstructed in realtime (with a huge obstacle, for instance?) ?
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: Make the enemy follow a point

Post by frag.machine »

JasonX wrote:
frag.machine wrote:Well the very concept of navigation is to find a way thru obstacles... :D
The obvious way in Quake is to use path_corners, specially if the target is fixed.
Is there a sample AI that uses path_corners? Also, what happens if the path gets obstructed in realtime (with a huge obstacle, for instance?) ?
The default QC uses it. Check monsters.qc for walkmonster_start_go (IIRC). If the monster has a .target defined then walks torwards any entity with the same value in the .targetname field, otherwise just sits idle awaiting for a player.

Quake monster walking/running AI struggles to navigate through even relatively small obstacles, let alone something like a large wall.
Unfortunately besides hacks using breadcrumbs or similar clever tricks, better navigation would require some engine support and a new map format to store navigation data.

EDIT: grammar
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
Post Reply