Archived

This topic is now archived and is closed to further replies.

eedok

AI in platform games

Recommended Posts

well I want a certain type of enemy to chase the player, only problem is when they reach a part where it''s like _____ _ _ _ _ ____ they either overjump or don''t make it, and end up committing suicide, even though it is quite entertaining when there''s 20 or so of the type of enemies doing it at once, how would I fix it so they would stay in pursuit of the player?

Share this post


Link to post
Share on other sites
Someone can probably think of a better way of doing it... but perhaps they could have a check run at the end of each movement that checks to see if there''s ground directly below them (or perhaps, at their end trajectory?) If there''s no ground there, then they alter their velocity in the X direction until they are in a position to land on solid ground again.

Share this post


Link to post
Share on other sites
quote:
Original post by VThornheart
Someone can probably think of a better way of doing it... but perhaps they could have a check run at the end of each movement that checks to see if there's ground directly below them (or perhaps, at their end trajectory?) If there's no ground there, then they alter their velocity in the X direction until they are in a position to land on solid ground again.
That brings in the error of disabling them from jumping over obstacles though(correct me if I'm wrong) IE ____|____ when jumping over the | will cause it to find ground underneath so it won't move, or will only move one square at a time(falling behind in the pursuit), again correct me if I'm wrong..

edit:maybe I shouldn't have ignored the part about the trajectory, now it makes sense if I only do that when there's no platform at the end of the trajectory, thx guy

[edited by - eedok on March 23, 2004 2:06:22 AM]

Share this post


Link to post
Share on other sites
Try placing trigger events in your level. If an AI player starts running around and runs on this trigger, if the given direction vector he is running in coincides with the triggers direction, then do a specific action at that trigger which will help the AI continue it''s journey.

So in this case, you want it to jump while chasing someone. Each edge will have a rectangular region specifying a jump zone. If the AI moves on top of the region, has a direction vector leading towards the edge (specified in the trigger zone for quick look-up), they will jump. You could also place speed modifiers on the trigger to prevent the AI from overjumping or underjumping

Share this post


Link to post
Share on other sites