"Unclutter" units in RTS game

Posted by TravisG on Game Development See other posts from Game Development or by TravisG
Published on 2012-11-24T17:20:47Z Indexed on 2012/11/24 23:22 UTC
Read the original article Hit count: 242

Filed under:
|

For intentional reasons, certain units in the game I'm currently programming don't have any collision detection and response among each other.

This enables them to clutter right on top of each other. This is a wanted behavior, since there will be situations in the game when the player does want them to stack like that.

However, I want to make the process of uncluttering them easy for the player, so that they just have to press a hotkey or click some button on the screen and have the units disperse just enough so it's easy to select a group of them with the mouse (if they stand on top of each other one mouseclick selects all units).

How could I do this without running a brute force N^2 nearest neighbor search on all units?

© Game Development or respective owner

Related posts about 2d

Related posts about rts