Jump to content
  • Advertisement
Sign in to follow this  

Moving several units at once

This topic is 4229 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. I'm trying to learn how to build an RTS (in Java), and i got an engine up and running. I use A* for pathfinding (with a Binary Heap), and i can move units to where i want. When a unit i ordered to move, it first finds a path without thinking about where other moving units are. It then moves to each tile in that path (in order). If the next tile in the path is taken by another unit, then it finds a new path, this time ignoring tiles that are occupied by moving units. This works fine for moving 1-3 units at the same time, giving them the same goal. But when i try to move like 5-8 units, they all bump into each other all the time, and keep making new paths all over the place. So, i decided that, when the player has selected n units, i'll makes n "goal tiles" around where the player clicked. I then orner one unit to move to each goal tile (in the way mentioned above), sorted so that a unit will not get a tile that is far away from its current position. This works well for up to about 12-15 units, but if i have more units than that, i get the same problem as mentioned above, and somethimes i get a "OutOfMemoryException: Java heap size". This is how it looks. The orange lines goea from a unit to its goal. So. Is this a totaly wrong way to do this? Or maybe i'm just missing something? Anyone here have experienes with this? I want to be able to move an arbitary number of units at once. [Edited by - j0ern on May 15, 2007 8:16:41 AM]

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!