#Smart Formation Reindexing

1 messages · Page 1 of 1 (latest)

spare quiver
#

Hey guys, I'm currently trying to solve a formation problem. Let's say I select a group of units (400), and I resize this formation to an either smaller or larger rectangle. Units should move and line up in formation accordingly to the new rectangle size. I've got that all up and running, but the issue is the optimization of these assignments.

I am noticing that units that used to be on the far left side of a row will now run all the way to the far right side of a row. This is probably due to their "indexing" in the formation, and when a rectangle grows and shrinks, this flat indexing may end up on the far end of a row or the beginning or the middle when I'm trying to make it so that a unit in the middle of the formation will still be in the middle of the formation (roughly) after resizing.

As a result, I've been trying to do some index reassignments that are spacially aware, such as divide the old rectangle's columns and rows by the new ones for each soldier.

I've also tried to deal with any collisions of assigning to the same position with a BFS system that looks incrementally forward in the formation until it finds an empty unassigned slot. This kinda worked, but now there are random gaps in my formation. I presume this is because the rectangles are not perfect fits to the number of men. A size 500 rectangle may be assigned to a 480 man selection, and thus there are technically 20 empty slots.

Have you guys come up with a better system? Everything I've listed above is purely experimental and I'm not sure if it's even the right way to go about the issue. I'm worried I'm over-engineering a solution to what could be a simple matrix problem.

unreal magnet
#

So just from theory, when you select a group and then hit the formation button(?), it would initialize one position for each soldier on that rectangle and keep it as long as the group stays the same? When you change the rectangle, like selecting a new group, it would init again and the soldiers would just order themselves once from top left to bottom right x,y coordinates locally. Is that what you got so far?

spare quiver
# unreal magnet So just from theory, when you select a group and then hit the formation button(?...

right now, I have some moderate success with spatial reformation, which means that when i resize a formation to a different width, units keep their relative position when moving to the new shape... but mine works like 80% of the time... the other 20% they are assigned inefficiently.

So to clarify how the reforming works is, I select a group of units. When I write click and drag it creates a rectangle of a size depending on my original, right click location and my current mouse cursor location.

Units Will lineup information based on this rectangle once I let go.

The current issue is that when I reform my formation to a smaller or larger rectangle, the individual units themselves sometimes are assigned to non optimal locations.

soldiers that were on the far left side of the location may sometimes end up on the right side. This is because columns and rows will increase and decrease depending on the size of the rectangle.

that means soldiers who were originally on row zero column column 10 may find themselves on row one column zero

#

my goal is to make the reassignment as efficient as possible in terms of how far the units will have to move in order to get to their new location. So that means ideally that units on the edges will stay at the edge and units in the middle will pick new rows or columns, depending on the size of the rectangle.