Original Post
Hey everybody! For all of you who know the Total-War series: I am trying to get the same effect you get when moving a unit around in Rome or Medieval 2. I'm trying to make 2D squares arrange in the best possible way when moved from one point to another. For example, if I have 3 rows of 4 soldiers each, and want to turn that into 2 rows (6 soldiers each), I want it to look and feel realistic, so I don't want soldier number 5 (first one on 2nd row) to walk all the way to the right on first row near soldier 4, instead, I need the first row (soldiers 2,3 and 4) to move to the right and make place for him. They also have to make room for one more, but I can't even figure out for which one and how, how is this solved in the real army? So, you see my problem is a bit complex, I was thinking about making an array of all the "free future positions", and then, starting from the left, occupying them one by one by the closest soldier to that position, soldiers on different rows being prefered (in case of same distance). Has anybody tried this before? Would it work this way? Or is there another way? Thanks for your help! :)
