Stacks that need re-awakening for each unit

Koshling

Vorlon
Joined
Apr 11, 2011
Messages
9,254
I recall some (fairly recent) discussion of some isue whereby if you attacked with a stack the first unit attacks then the stack goes to sleep again unless expliciotly re-awakened. I also recall someone saying stacks of workers behaved similarly when given orders.

I can't locate the original posts to get the details (yeh, yeh, I suck at search), and I can't reproduce any obvious problems in my test games. I have tried stacked workers giving the stack an impovement order, and all members perform it (seems right). I have also tried attacking a city with a large stack (with stack attack option not enabled) and that too behaves as expected (best unit attacks then focus returns to the rest of the stack).

Can anyone clarify the issue, and what is needed to reproduce it please...?
 
I never got that by attacking directly, but by ranged warfare or bombard. try put 5 catapult outside any city with <5% defense, then stack bombard it. then you'll see only 1-2 siege correctly bombard but other siege unit sleeps.

Dunno if that's a feature..
 
Hmm.. I might have run into this once or twice, but not typically. I think usually when a group is selected to attack, the best one is chosen to strike. But what if that unit has extra moves, but can't attack a second time? Might the AI be trying to use that unit, but since it can't get a second attack, it wants the whole stack to wait another turn?
 
Hmm.. I might have run into this once or twice, but not typically. I think usually when a group is selected to attack, the best one is chosen to strike. But what if that unit has extra moves, but can't attack a second time? Might the AI be trying to use that unit, but since it can't get a second attack, it wants the whole stack to wait another turn?

It worked fine for me when I used a large stack in attacking a city, so if someone can provide a save game wi a stack that exhibits I'll take a look, otherwise I wont stress over it
 
Heres one from the version 16. I'm attacking the city of Moscow with a stack, if I kill the first defender with any of my attackers I don't then go to attack the next defender, it sets everyone waiting till the next turn and picks someone else.
 
I ran into this last night after never having a problem with it before. I may have stumbled onto the cause though!

I turned on Quick Combat (Offensive), and now every time a unit survives combat it performs the wait command (like, pressing space) afterwards. Even if it has no movement left it still wants to wait! If your unit is in a stack the whole stack will want to skip the rest of the turn. This happens even if the unit is by itself, it is not a stack issue at all.

I think the worker and bombard ones are unrelated, I have had workers being strange before but never my military. As soon as I turn that one option on after EVERY combat it happens. In my current game my workers are still being normal. Unrelated I say.

edit: I should probably add that whilst attacking with a stack, if the units die I can keep attacking as normal. It's only when a unit survives (by winning the combat) that the stack is sent to sleep.
 
ThoricFrame is correct. Tested it out myself and found it to be the reason why. Now all that's needed to be done is to reverse that problem, so Quick Combat doesn't put a unit or stack to sleep after winning a battle.

Cheers
 
Heres one from the version 16. I'm attacking the city of Moscow with a stack, if I kill the first defender with any of my attackers I don't then go to attack the next defender, it sets everyone waiting till the next turn and picks someone else.

Thanks for the save game, and thanks Thoric for spotting the key issue (which I would never have found as I never use that option). With this combination I am easily able to reproduce the issue, and BOY is it weird!!

Based on the code my first reaction to hearing this happened only with quick offensive combat was 'No way!', but it certainly does happen. As far as I can tell this is a bug in the main game engine, and the DLL was doing everything correctly. Basically there are two code paths involved:

The first is the response to your initial attack order. If quick moves are on, this evaluates the combat and completes it immediately, telling the game to deselect just the attacking unit. If quick moves are not on, it sets up a multiple sub-battle sequence and extends the number of combat rounds needed to complete the attack (it has resolved the result, but the sub-rounds it sets up will be what plays out the animations and so on). It then tells the game engine how many extra combat rounds are needed to 'play it out' and returns without completing.

The second is a timer update callback that plays out a sub-round (as set up by the first call). This does nothing at all except count down the sub-round count. On the call that it reaches 0, it completes the combat using EXACTLY the same call sequence the first path does in the quick-combat case. There is NO differecne at all in the actions taken, just in the timing.

So it seems like the main game engine misintreprets a combat completion on the first call as the stack being done with (even though the DLL code only tells it to deselect a single unit). This seems like a bug in the main game engine to me.

What I have done is workaround the issue by never completing combat on the first call, and instead setting up a 1-sub-round (with no animations or focus changes) completion. This causes the completion to occur on the first timer callback, so the net effect is quick-as-possible-but-not-theoretically-ulimately-quick combat and the stack focus behaves like it does without quick combat. The delay of 1 sub-round is not, in practise, noticeable, so this technique is at least perceptually a fix.

I'll be uploading the 'fixed' DLL to the patches thread later today, or possibly tomorrow (I am still testing some other changes I have in my current DLL before I release it, but I'm done apart from an hour or so play-testing as my final test round, so hopefully today)
 
Spoiler :
Thanks for the save game, and thanks Thoric for spotting the key issue (which I would never have found as I never use that option). With this combination I am easily able to reproduce the issue, and BOY is it weird!!

Based on the code my first reaction to hearing this happened only with quick offensive combat was 'No way!', but it certainly does happen. As far as I can tell this is a bug in the main game engine, and the DLL was doing everything correctly. Basically there are two code paths involved:

The first is the response to your initial attack order. If quick moves are on, this evaluates the combat and completes it immediately, telling the game to deselect just the attacking unit. If quick moves are not on, it sets up a multiple sub-battle sequence and extends the number of combat rounds needed to complete the attack (it has resolved the result, but the sub-rounds it sets up will be what plays out the animations and so on). It then tells the game engine how many extra combat rounds are needed to 'play it out' and returns without completing.

The second is a timer update callback that plays out a sub-round (as set up by the first call). This does nothing at all except count down the sub-round count. On the call that it reaches 0, it completes the combat using EXACTLY the same call sequence the first path does in the quick-combat case. There is NO difference at all in the actions taken, just in the timing.

So it seems like the main game engine misinterprets a combat completion on the first call as the stack being done with (even though the DLL code only tells it to deselect a single unit). This seems like a bug in the main game engine to me.

What I have done is workaround the issue by never completing combat on the first call, and instead setting up a 1-sub-round (with no animations or focus changes) completion. This causes the completion to occur on the first timer callback, so the net effect is quick-as-possible-but-not-theoretically-ulimately-quick combat and the stack focus behaves like it does without quick combat. The delay of 1 sub-round is not, in practice, noticeable, so this technique is at least perceptually a fix.

I'll be uploading the 'fixed' DLL to the patches thread later today, or possibly tomorrow (I am still testing some other changes I have in my current DLL before I release it, but I'm done apart from an hour or so play-testing as my final test round, so hopefully today)

WOW, that is just amazing find and excellent explanation, nice find and hope, great fix.;)
 
Appreciate you fixing this so quickly Koshling. Isn't it strange though when you find out the way you have set everything up isn't the way that everyone else sets up? I couldn't live without quick combat :p
 
Appreciate you fixing this so quickly Koshling. Isn't it strange though when you find out the way you have set everything up isn't the way that everyone else sets up? I couldn't live without quick combat :p

I'm a very builder-oriented player, so I tend to indulge in wars quite rarely and maintain a small standing army of higher tech units rather than large numbers, so it all conspires not to make me care much about slow combat. Of course a major late game war might change my opinion ;-)
 
Quick combat / Quick move and no battle zooming reduce play time tremendously. :lol:
 
@Koshling. Have you got that fix uploaded yet? I just updated my .svn and started a new game and my tracker is still going to sleep after killing something, even if he still has a movement point left.
 
The DLL is available in the patch thread. From another discussion though I think it hasn't been included in the SVN yet.
 
The DLL is available in the patch thread. From another discussion though I think it hasn't been included in the SVN yet.

Correct. It will be today after I finish testing some other changes also
 
Top Bottom