kmitahj
Posts: 100
Joined: 4/25/2011 Status: offline
|
quote:
ORIGINAL: awbergs The 20 is the sum of all attack values: anti-armor, -personnel, -air (high), and -air (low). [...] Just by accident. I did think along the same lines initially. In fact I thought so until recently when I decided to spend some time to find an algo to calculate basic strengths (AP, AT, DEF etc.) based on unit's equipment list (and other unit attributes) in a way which is consistent with numbers displayed by TOAW gui. There are many different strengths used within TOAW engine, all calculated by the same basic procedure (let's call it CalcUnitStrength). Amongst them are basic strengths as AT (anti-tank), AP, AA(l), AA(h), DEF, ARTY and some more exotic which we would rather call capabilities: Recce, Engineering, RailRepair, Minor/Major Ferries, AirmobileLift, TrafficControl... For GUI related purposes basic strengths (AT,AP,AA l/h, DEF) are scaled down from raw numbers provided by CalcUnitStrength. Lets call APraw unit's anti-personal strength calculated via basic procedure. APgui value (used on unit icons, in upper-right UnitBox, and in 'Strengths' sub-panel of UnitReport dialog) is derived from APraw: IF APraw > 0 THEN APgui := 1 + INT(APraw/ScalingDivisor) ELSE APgui := 0 END; To find out ScalingDivisor for given scenario TOAW scans through all units (of both forces) looking for highest value among unit's AP and DEF values. Then ScalingDivisor := INT(MaxAPOrDEFValue/30. In unlikely special case when all scenario AP,DEF values are < 30 no scaling is needed and so ScalingDiviosr is set to 1. For example for my test case scenario (DNO) max APraw=2185, max DEFraw=2663 so ScalingDivisor:= INT(2663/30) = 88; The goal here is to have gui basic strength values normalized (mostly) within 0-31 range. Note however that only AP and DEF are used to find out scaling divisor (which makes sense as these are the only two painted directly on unit's icons) so at least in theory one can construct scenarios with unit's ATgui (or AA or ARTY) values > 31 (with unit using equipment for which AT > AP, DEF values). Back to raw values. APraw is sum of APraw values calculated for each equipment line (that is EquipAP * EquipNumber). However each such value may be modified by various factors depending on given equipment capabilities as defined by equipment flags (also note that EquipAP values used here are as seen by TOAW engine which may be different from "uncooked" values in Equipment database file). Finally per unit modifiers are applied (like proficiency/readieness/supply, Global Shock/Handicap etc...) Here comes important point: there is only one strength calculating procedure but it has a parameter which defines the context from which the procedure was called (like GUI context or combat resolution context(s)). Depending on the context provided some of the modifiers are skipped. For that reason even APraw or DEFraw values calculated in GUI context are not exactly the same as used inside combat resolution procedure. And as last niusanse: for GUI purposes raw values are calculated with assumption of zero range. So if an arty unit has combination of tubes of differnet ranges then actual AP value used in combat maybe much less then one would expect based on value displayed by GUI (same for air units with planes of different range). Now knowing the above: what the Attack number is? "By eye" in my test case scenario it is usually equal or only slightly larger (by 1 or 2) then APgui+ATgui value (however for very small units you shall be able to find reverse case: for such units all Attack=APgui=ATgui=1 thus Attack< APgui+ATgui). It turns out that amongst many Strengths defined inside TOAW engine there is one "composed" Strength called (you guessed) "Attack" which is simple sum of (EquipAP+EquipAT)*EquipNumber for all unit's equipment items adjusted only by per-unit modifiers. That is in this case there is no per-equipment modifiers applied at all. This is one source of difference, the second are rounding effects of INT arithmetic: scaling down separately AP and AT and then adding them up will in general give slightly different result then scaling down sum of the two. Is such combined "attack" strength used somewhere besides the GUI? - frankly I don't know as I didn't checked it yet. If I had to guess: it may be (just maybe) useful in calculating A.R. value (Assault Ratio) for which raw, unmodified (by terrain etc.) values are supposed to be used. Or it may be just a leftover without any use besides that specific GUI place. To be investigated in due time I guess... As an example of difference between "Attack" and AP+AT combination here is one of possible test cases: find a unit for which APCs are present in large number comparing to other equipment. Then change unit's Order Emphasis from Minimize to Ignore Losses and observe AP, AT and Attack values. Note that if you change Emphass from within UnitReport dialog you will have to close and reopen the dialog again to observe any changes (no autorefresh). If you have chosen right unit (APC-heavy) and have a bit of luck you shall observe changes on AP and/or AT values but will never see any change in Attack number of UnitReport panel. It is because OrderEmphasis is one of modifiers applied for APC equipment (even in GUI context) but as said above there is no per-equipment modifiers applied to "Attack" strength. Of course it is not a hard proof - mere a hint of difference between AP+AT and that composed "Attack" strength.
|