Jump to content
  • Advertisement
Sign in to follow this  
starstriker1

Smoothing out AI pathing

This topic is 4866 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm currently developing a 2D sidescroller. My goal is to have relatively intelligent foes populate this game, that are capable of at least finding their way around the level without looking too stupid. I recently got an A* (or A*-ish, at any rate) algorithim working. I've been for the most part satisfied with how the AIs are finding their way around my test level, except for one thing. Whenever they try to reach a node above them, the crazed jumping they do is insane. Basically the moment the area they're trying to reach is above them, they jump, resulting in bunny-hopping and poorly timed jumps that can even accidently drop them down to another level! What I want to do is have them figure out when to time their jumping and their acceleration so that they'll pass through the node they're trying to reach in a more convincing way than they currently are. What ways can I go about this?

Share this post


Link to post
Share on other sites
Advertisement
Well, you could presumably make the holes unwalkable (so it doesn't path into them) and make jumping more costly than moving on the ground (so it only chooses it if nessesary).

Share this post


Link to post
Share on other sites
Thats not the problem. I WANT them to reach the upper nodes, but they're doing it in a stupid manner.

The AI have the ability to move left, right, and jump (when on solid ground). They also have relatively limited air control. What I currently am having them do in order to reach a specific corrdinate is a method so simplified that its sickening: if its off to either side, move towards it. If its above the AI, jump, regardless of current velocity and distance to targetted position.

What I WANT them to do is make more intelligent looking movements. Specifically, I want them to stop bunny hopping and choose their jumping time (as well as the position and velocity they leave the ground) more intelligently.

Share this post


Link to post
Share on other sites
Well, if your agents miss their jumps, the problem is very clear: In your A* implementation, you add nodes to the path that arent really accessible from the top node. No smoothing is gonna help you there: you have to come up with a correct accessibility function that check if the node is *really* accessible from the current node with the specified action and current velocity.

Good luck!

Share this post


Link to post
Share on other sites
They aren't so much missing their jump as simply jumping too soon or too late. Its because they constantly bunnyhop whenever they want to get somewhere above them, even though they should probably time the jump. I just don't know how to do that properly.

Share this post


Link to post
Share on other sites
The solution seems fairly simple... you need to constrain the agents trajectory at the point of hitting the node, so that when it executes the jumping action, the result is a transition to the higher level. Personally, I'd fit a spline for the velocity curve, constrained by the spatial nodes resulting from the pathing search (which are discrete solutions of the integral of the velocity spline). This will give you the information you need for your agent to move in the correct directions and jump so as to achieve the correct transition.

Cheers,

Timkin

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!