Dynamic group reordering
PostPosted: 23 Jan 2013, 02:11
Krom and I talked about doing this a long time ago but never got around to it, until last night when I was looking for something to do and I thought "why not?". Basically the idea is that soldiers in a group should not have fixed positions that they will always stand in, they should swap positions if it involves less walking/messing up. This is especially noticable if you change the formation or rotate your group 180 degrees. Because each solider has a fixed position he that he MUST stand in they will end up pushing each other around for a few minutes before reaching their final positions. Under the new system each soldier will be assigned a new position in such a way that there is minimal walking/reordering required.
Thankfully there are mathematical solutions to solve this problem, the most notable of which is called The Hungarian Solution. It involves assigning a cost for each soldier to walk to each available position (the distance he has to walk), then trying to match the soldiers to the positions in such a way that the total cost is minimal.
I found a nice open source Hungarian algorithm written in C# and translated it to Pascal then made groups use it to reorder themselves before walking/rearranging. The results are quite impressive. It's hard to explain or show with images so I made a quick video:
http://www.youtube.com/watch?v=LqG5Tr2kz1c
What do you think?
Lewin.
Thankfully there are mathematical solutions to solve this problem, the most notable of which is called The Hungarian Solution. It involves assigning a cost for each soldier to walk to each available position (the distance he has to walk), then trying to match the soldiers to the positions in such a way that the total cost is minimal.
I found a nice open source Hungarian algorithm written in C# and translated it to Pascal then made groups use it to reorder themselves before walking/rearranging. The results are quite impressive. It's hard to explain or show with images so I made a quick video:
http://www.youtube.com/watch?v=LqG5Tr2kz1c
What do you think?
Lewin.