Page 1 of 1

Make the enemy follow a point

Posted: Sat Sep 07, 2013 12:14 am
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?

Re: Make the enemy follow a point

Posted: Sat Sep 07, 2013 12:44 am
by ceriux
i assume it would be the same way but enemy wouldnt be the player.

Re: Make the enemy follow a point

Posted: Sat Sep 07, 2013 1:23 pm
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?

Re: Make the enemy follow a point

Posted: Sat Sep 07, 2013 4:27 pm
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.

Re: Make the enemy follow a point

Posted: Sat Sep 07, 2013 4:52 pm
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.

Re: Make the enemy follow a point

Posted: Sat Sep 07, 2013 5:15 pm
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

Re: Make the enemy follow a point

Posted: Sun Sep 08, 2013 12:18 am
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.

Re: Make the enemy follow a point

Posted: Sun Sep 08, 2013 10:52 pm
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?) ?

Re: Make the enemy follow a point

Posted: Mon Sep 09, 2013 1:06 am
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