Cognitive dissonance around how Flanking works

Describe your experience with the latest version of FreeOrion to help us improve it.

Moderator: Oberlus

Forum rules
Always mention the exact version of FreeOrion you are testing.

When reporting an issue regarding the AI, if possible provide the relevant AI log file and a save game file that demonstrates the issue.
Message
Author
BlueAward
Vacuum Dragon
Posts: 621
Joined: Mon Aug 08, 2022 3:15 am

Cognitive dissonance around how Flanking works

#1 Post by BlueAward »

I have quite a cognitive dissonance between the way how I read "Flanking" policy description and what I see in game.

Going into MP23 I knew something's funky and didn't exactly know how it worked, but during gameplay I noticed some "truths". Flanking often feels delayed, sticky and dependent on supply, none of which is obvious from the description! Though only now I did some additional tests and some look at scripting\policies\FLANKING.focs.txt and I got even deeper understanding than from MP23 (probably should've done those tests during the match to use that better against wobbly :lol: )

My guess is weirdness in how flanking works comes mostly from two things:
  1. Funkiness with "Stationary" test that I think evaluates True unless you were on a star lane previous turn, which has unintended consequence that it stays true even if you moved, as long as you finished in a star system rather than on a starlane
  2. I gather it needs supply to adjust damage up, similarly to getting bonus damage from technology
I conclude that from what I observed, like:
  • The "Stationary" part is essentially one turn delayed. It doesn't work on ships that have just arrived into the system, at least from "midflight" i.e. not directly from another system. Presumably the "Stationary" test is not "True" for these ships yet. So you lose the bonus if you end your turn on a starlane.
  • However, the bonus sticks with your fleet as long as you are doing single hops without in-between flight that puts you on a starlane. It's on for fights at the destination and stays with you as long as you are left with more ships than enemies. My guess is there is "funkiness" in "Stationary" condition as mentioned above. Even a single ship is boosted next turn if it stays in a system and other ships fly away, or if it singlehandedly one-hops into an enemy. Though such single ship keeps the bonus only for the fight and loses it later (if it survives to tell the day); if you're left with fewer ships than enemy, they will lose that bonus as well. But if they keep it, they don't need supply to keep it
  • Ah yeah, the "Stationary" part doesn't turn on for a single ship in a system. Not obvious/mentioned but fine in hindsight, hard to flank on your own though arguably not impossible (stealth attack - oh yeah maybe flanking should interact with stealth and make it even more powerful, but I digress)
  • Otherwise you need supply to get the bonus. Once you lose it (entering mid-lane or system with more enemy ships), you need supply to regain it, you won't get it back even if you start having superior numbers but outside of supply.
  • The pincer manouver actually works on the turn of arrival, however only if there was supply access, making whole pincer business even less useful than it sounds. And next turn it's taken over by "Stationary" bonus if you stay around, so at least if you lost supply there and then, you'd keep the bonus through the "Stationary" test that keeps your damage/attacks up. So pincer can work just outside your supply but not deeper into the enemy territory, meanwhile the "Stationary" part would work deeper as long as you were one-hopping not to lose the "Stationary" condition
Long story short, gather your ships in one in-supply system and start one-hopping with them into enemy. None of that pincer stuff. Perhaps you wanna reconsider faster ships if you want flanking to have more one-hops within range because getting caught on a lane between systems breaks your flanking bonus and you won't regain it outside of supply.

You can observe it for example turn 204 in MP23 before I rammed my ships into wobbly. Regardless of how many ships I would ram into wobbly, I would have the Flanking bonus (so e.g. my arc disruptors would take 5 shots each turn bout, combined with Charge). When I finish the fight with more ships, they keep the bonus next turn as well, if I finish with fewer, they lose the bonus. If I fly away to another system and try the fight from mid lane, there's no flanking bonus.

Pincer is harder to set up, I was playing with it in single player but could be tested with same savegame from MP23 if my smaller fleet would be given chance to get from behind. The ships that come from within supply would get the bonus (mind to lose the "stationary" bonus to test it), while the ships that came from behind would not get the bonus. Still something, I guess
Last edited by BlueAward on Fri May 19, 2023 2:00 pm, edited 2 times in total.

BlueAward
Vacuum Dragon
Posts: 621
Joined: Mon Aug 08, 2022 3:15 am

Re: Cognitive dissonance around how Flanking works

#2 Post by BlueAward »

OK and maybe now the part that would make it work more as I thought it would, just to be clear: first, have the bonus work regardless of supply, and second - a ship should not be considered Stationary if it moved directly from another system last turn (if my assumption is correct about how "Stationary" test works/does not work)

And perhaps make it more obvious from description that a ship is stationary only after it already spent a turn not moving (with the caveat of the presumed "funkiness of Stationary test" put under the rug I guess, until fixed)
Last edited by BlueAward on Fri May 19, 2023 2:05 pm, edited 1 time in total.

wobbly
Cosmic Dragon
Posts: 1808
Joined: Thu Oct 10, 2013 6:48 pm

Re: Cognitive dissonance around how Flanking works

#3 Post by wobbly »

A lot these things come down to metre update and turn sequence shenanigans. You can think of turns as having sub-phases. During the phase that you move and that combat occurs it doesn't care what's in scripting because it doesn't run them till a later phase.

What it does care about is the metre on the weapon. If that was boosted before you move its still boosted until the metre updates. If it wasn't it won't be boosted till the metre updates.

There's similar funkiness with stuff like stealth and ion storms etc.

BlueAward
Vacuum Dragon
Posts: 621
Joined: Mon Aug 08, 2022 3:15 am

Re: Cognitive dissonance around how Flanking works

#4 Post by BlueAward »

Well, if anything, at least I hope I made it clearer to the posterity, how it actually works (but still would argue about something funky with the Stationary test... because there is clear difference between one hopping systems and going directly to your destination including mid-lane turns...)

Say if there are systems A -> B -> C and you can hop A -> B in one turn, B->C in one turn, and A->C in two turns directly but missing system B along the way, if you hop A->B->C you arrive at C in two turns with your Flanking bonus up, but if you hop A->C in two turns, missing B along the way, then you arrive without the bonus and it's only active the following turn.

Okay I suppose you are saying that the bonus is sort of lost, but in a subphase that does not matter, because it's active at the beginning for the fight because it was active last turn and it didn't update just yet, and then will be active next turn again assuming outcome of any battle evaluates again favorably for the Stationary condition? And only entering mid lane makes it actually register as lost.. huh

So that still leaves the issue of leaving supply through one-hopping systems or more directly to the destination including mid-lane, because this is when the difference hits harder. There would still be difference on when you regain the bonus, but at least you would regain it, if with a delay, rather than completely losing it without supply

Or perhaps it should go away with the whole "Stationary" bonus making only the superior number of ships important, I originally thought it works that way to be honest. So superior numbers would give you flanking or pincer without superior numbers, skipping on the stationary idea.

I suppose the latter would mean ships in flight would always show as having the bonus... and always have it for a fight at destination... Which probably was the reason to add the condition... oh gosh

Only conclusion may indeed be that faster ships have a hidden benefit out of flanking if you use them right xD So perhaps at least make it supply independent so slower ships might catch up on occasion with the bonus, but dunno if that's possible

wobbly
Cosmic Dragon
Posts: 1808
Joined: Thu Oct 10, 2013 6:48 pm

Re: Cognitive dissonance around how Flanking works

#5 Post by wobbly »

BlueAward wrote: Fri May 19, 2023 1:32 pm
  1. I gather it needs supply to adjust damage up, similarly to getting bonus damage from technology
Are you certain on this one? The scripting looks identical to how it works on Charge and the Species bonus. I've never checked what happens if you adopt Charge with ships out of supply. It's possible that there's an issue there as well, I'll check if you don't 1st.
BlueAward wrote: Fri May 19, 2023 2:06 pm Okay I suppose you are saying that the bonus is sort of lost, but in a subphase that does not matter, because it's active at the beginning for the fight because it was active last turn and it didn't update just yet, and then will be active next turn again assuming outcome of any battle evaluates again favorably for the Stationary condition? And only entering mid lane makes it actually register as lost.. huh

So that still leaves the issue of leaving supply through one-hopping systems or more directly to the destination including mid-lane, because this is when the difference hits harder. There would still be difference on when you regain the bonus, but at least you would regain it, if with a delay, rather than completely losing it without supply

Or perhaps it should go away with the whole "Stationary" bonus making only the superior number of ships important, I originally thought it works that way to be honest. So superior numbers would give you flanking or pincer without superior numbers, skipping on the stationary idea.

I suppose the latter would mean ships in flight would always show as having the bonus... and always have it for a fight at destination... Which probably was the reason to add the condition... oh gosh
To be honest I'm pretty sure its currently broken left, right and sideways. For instance its very easy to out number 20 ships with 2 ships if the 2 ships happen to be where the 20 are not. I'm also unsure if scripting can actually count ships on a starlane. Someone who understands the backend a little better would have to answer that one. When ships are at a system they have a location, I believe on a starlane it's more like co-ordinates? I don't really know.

At the end of the day flanking doesn't do what it says, it does something else, so its definitely a bug. A lot of the game's logic seems to be similar to knowing you need to put your pants and underwear on, except you keep doing it in the wrong order.

BlueAward
Vacuum Dragon
Posts: 621
Joined: Mon Aug 08, 2022 3:15 am

Re: Cognitive dissonance around how Flanking works

#6 Post by BlueAward »

wobbly wrote: Fri May 19, 2023 3:08 pm
BlueAward wrote: Fri May 19, 2023 1:32 pm
  1. I gather it needs supply to adjust damage up, similarly to getting bonus damage from technology
Are you certain on this one? The scripting looks identical to how it works on Charge and the Species bonus. I've never checked what happens if you adopt Charge with ships out of supply. It's possible that there's an issue there as well, I'll check if you don't 1st.
It is not so much about adopting the policy. I meant even if you already have it adopted, if you stray away from your supply, the ships will not get Flanking bonus when they eventually stop, if you lost the bonus along the way by e.g. by entering mid lane. Easy to check with just two ships and the Stationary part. Within your supply you get the bonus. If you go away with them, you do not. Unless you one-hopped along the way to keep it up. I even checked it with random krill and whatnot flying within my empire or outside of it to check

wobbly
Cosmic Dragon
Posts: 1808
Joined: Thu Oct 10, 2013 6:48 pm

Re: Cognitive dissonance around how Flanking works

#7 Post by wobbly »

Ok I can confirm flanking doesn't work out of supply. I can also confirm Charge doesn't work for a ship outside of supply until it re-enters supply.

Ophiuchus
Programmer
Posts: 3427
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Cognitive dissonance around how Flanking works

#8 Post by Ophiuchus »

there are two types of flanking bonus (last turn stationary and last turn moving in to a pincer attack) and none of those should depend on supply

as there is nothing in the focs files about supply there would be something very very very broken for it to depend on supply
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

wobbly
Cosmic Dragon
Posts: 1808
Joined: Thu Oct 10, 2013 6:48 pm

Re: Cognitive dissonance around how Flanking works

#9 Post by wobbly »

Ophiuchus wrote: Thu May 25, 2023 6:36 pm there are two types of flanking bonus (last turn stationary and last turn moving in to a pincer attack) and none of those should depend on supply

as there is nothing in the focs files about supply there would be something very very very broken for it to depend on supply
There's also nothing in the .focs file about current meters either. Only max meters. At least by my read.

At the end of the day, both BA and I checked the UI in-game.

Ophiuchus
Programmer
Posts: 3427
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Cognitive dissonance around how Flanking works

#10 Post by Ophiuchus »

wobbly wrote: Thu May 25, 2023 7:14 pm There's also nothing in the .focs file about current meters either. Only max meters. At least by my read.
ah, that could make sense
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

Ophiuchus
Programmer
Posts: 3427
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Cognitive dissonance around how Flanking works

#11 Post by Ophiuchus »

so i guess what could cause this: capacity meter gets only set to max meter when in supply.

i think there was some focs or cpp code which always set the capacity to the max capacity for ship parts(?) but dont know where (maybe supply phase?).

edit: couldnt find it in FOCS, also in v0.4.10; dunno since when this was borked. If the theory is right a very late FOCS effect setting the capacity and secondary meters to the max meter values should fix it. Dont have time to try that in the next month though. So somebody please fix or at least create a bug report
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

Ophiuchus
Programmer
Posts: 3427
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Cognitive dissonance around how Flanking works

#12 Post by Ophiuchus »

PR-4557 for master.

If that is gets positive feedback after your playtesting, we coooould think about backporting to 0.5.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

User avatar
Atreides
Space Kraken
Posts: 151
Joined: Sat Jun 24, 2023 1:46 am
Location: 40 Eridani

Re: Cognitive dissonance around how Flanking works

#13 Post by Atreides »

Note to self: stop adopting this policy.

Ouch. : )

BlueAward
Vacuum Dragon
Posts: 621
Joined: Mon Aug 08, 2022 3:15 am

Re: Cognitive dissonance around how Flanking works

#14 Post by BlueAward »

Atreides wrote: Sun Jul 02, 2023 10:36 pm Note to self: stop adopting this policy.

Ouch. : )
It is quite nice actually, particularly to boost strikers and mass drivers, where it makes huge relative difference. It may seem what I said is only for early game but fighters keep on giving, and even mass drivers may be relevant longer cause cheap in terms of PP and RP. You could conceivably skip building and therefore upgrading lasers to save on research, in grand scheme of things, going more directly to plasma. Some would still want lasers though, particularly if you have better piloting species, so that is not like a hard rule, just a possibility

It is just that the way Flanking works is bit convoluted and therefore more useful on defense rather than offense, particularly on the release version where it quickly loses its charm outside supply, though even that can be somewhat worked around.

Plus maybe you have some species that likes it and you'd keep it just for stability boost. Not like there is a lot of competition for military spots

Granted in the release version I liked Charge more if I had to choose, but it got nerfed now on master.

wobbly
Cosmic Dragon
Posts: 1808
Joined: Thu Oct 10, 2013 6:48 pm

Re: Cognitive dissonance around how Flanking works

#15 Post by wobbly »

I'm bumping this thread as I mentioned flanking weirdness elsewhere.

2 ships (system A) ----- 5 ships (system B)

1 jump difference, the 2 ships have flanking. The 2 ships always out number the 5 regardless of who attacks who. Why? Because the effect triggers at system A and counts 2 friendly and no enemies.

Edit: an example with order of events.

Turn 1, 2 ship arrive at system A
Turn 1 combat phase: no combat
Turn 1 scripting: ships considered stationary, 2 friendlies, no enemies, outnumber enemy. Ships gain bonus.
Turn 1 order placement: move to system B
Turn 2 combat phase: combat occurs, ships have bonus.

Post Reply