I’m sorry, I don’t understand. Could you elaborate?
Select units. Find a center point. Find the furthest unit out from that. When moving these units, shrink down all the units selected positions until the furthest point is within whatever radius you set. The units will condense down some when moving.
And how do you detect enemy droids near each droid without causing insane lag?
if you had 99 soldiers and the enemy had 99,that would be 9,801 droids to loop through for your side. Then you multiply that number by 2 because the enemy side also has to detect your soldiers and you get 19,602. That would cause way too much lag. This is by going through each droid and finding the closest one to it.
I’m looking into octree, but maybye there is a more simple way to do this.
Dont check your own soldiers or an ally’s. But yes, you will need to come up with a solution for scanning potentially thousands of magnitudes a second. An octree and other optimizations(depending on what you’re doing) will be needed.