by Spike » Wed Feb 06, 2013 11:31 am
movetogoal will not really do anything except horizontal stuff. its for MOVETYPE_STEP monsters stepping through the world, nothing more. it can do vertical stuff only for FL_FLY or FL_SWIM monsters, and very much as a if (target.origin_z > self.origin_z) self.origin_z += 16;
its really dumb, and doesn't have any routing. it'll let the monster run away from its goal more as a bounce than anything inteligent.
there's a lot of ways you can write a routing algorithm. most are basically a flood-fill routine. that is, you walk each node to every single other node counting how long it took, then walk through backwards taking the cheapest route.
routing-type algorithms are generally fairly simple in concept (as opposed to implementation and optimisation), so you should be able to find a good overview of the various possible algorithms.
most maps will need waypoints of some kind. You can use lots of ways to auto-generate waypoints. interrogate the bsp to find surfaces, flood-fill the world, use light entities, periodically placing waypoints underneath players, etc.
the real problem is determining connectivity of waypoints - velocity, gravity, size, etc. which of course depends upon the previous node, which makes following the route order dependant. with stepping monsters, there is no velocity or gravity, yay.
.