Jump to content
  • Advertisement
Sign in to follow this  

Pathfinding Units Overlap!

This topic is 4372 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

Hi everyone, I've got a simple gauntlet clone going and marking where units move on a grid to keep units from overlapping. Things work fine if they only move in 4 directions (up,down,left,right) but diagnol moves cause overlaps. ------------------ | A | B | | | | ------------------ | 1 | 2 | | | | ------------------ Unit A to 2 is valid move, unit B to 1 is valid but of course they overlap. I would like to avoid complicated steering since this is a simple game. Can someone give me some pointers? Thanks for the help! -adrian

Share this post


Link to post
Share on other sites
Advertisement
Depending on the kind of data you have, without adding steering to your system (which ain't that hard, check out Craig Reynold's page for more info), you could check neighbor units and do this test, and probably wait until their move is done before doing yours.

Hope this helps

Share this post


Link to post
Share on other sites
You could also hardcode so that if a unit wants to go diagonally, it also has to check the neighbours of that tile.

I.e

Wants to go NW?
if NW, W, N == free
Go there.
else
move straight.



Sort of. :D

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!