Here is a rough example how you can keep order queues intact. The marines can be shift ordered to move all over the map and it will still displace the order correctly. The only issue seems to be patrol, however players seldom use that and I am sure there would be some solution to it.
Of note is that the process is very resource intensive. Even queuing maximum orders for 10 marines can cause frames to drop. A possible optimization could be to use a statically allocated stack for orders instead of a local array since that would reduce the stack frame and function initialization complexity. Another approach would be if you could stop the order from ever being issues (dummy ability) then you could only add the correct orders to the stack preventing the need to rebuild the entire order stack.
An idea that popped into my head was that you could read all queued orders on the unit into an array (you can query queued orders in SC2). You then issue the first order you want to keep replacing all orders. Then you append the following orders you want to keep to the unit. Performance may or may not be a concern but it will work. The order queue in SC2 is only like 64 or 128 orders so do not worry about overflowing a reasonably sized array. Only 1 array for orders is required, and it could even be made locally on demand.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Here is a rough example how you can keep order queues intact. The marines can be shift ordered to move all over the map and it will still displace the order correctly. The only issue seems to be patrol, however players seldom use that and I am sure there would be some solution to it.
Of note is that the process is very resource intensive. Even queuing maximum orders for 10 marines can cause frames to drop. A possible optimization could be to use a statically allocated stack for orders instead of a local array since that would reduce the stack frame and function initialization complexity. Another approach would be if you could stop the order from ever being issues (dummy ability) then you could only add the correct orders to the stack preventing the need to rebuild the entire order stack.
An idea that popped into my head was that you could read all queued orders on the unit into an array (you can query queued orders in SC2). You then issue the first order you want to keep replacing all orders. Then you append the following orders you want to keep to the unit. Performance may or may not be a concern but it will work. The order queue in SC2 is only like 64 or 128 orders so do not worry about overflowing a reasonably sized array. Only 1 array for orders is required, and it could even be made locally on demand.