Announcement

Collapse
No announcement yet.

Fixing SMACX Bugs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Isn't it possible foe the facility to be destroyed during capture? I know for certain they can be destroyed by mindworms, so I'd guess that the same would apply for other factions as well.

    As for the facilities appearing in your core colonies I have no explanation for that.
    I got scolded in Bold letters by Iluminatus.
    That makes me sad. :(

    I can't use smilies in my signature that makes me even more sad. :(

    Comment


    • For a defender in a base, morale_fin starts out as unit's current morale so 0-6
      • if bases has CC, +1 to morale_fin
        -> retrieve morale SE value, if < -4 set to -4.
        -> if > 0, set to 0
        -> if < -1, +1
        So range is from -3 to 0, it now takes this value and calculates: morale_fin = morale_fin - moraleSE_mod. Where moraleSE_mod is the bounded morale SE value.
        After this check, if unit is native and Brood Pit is present in base: +1 to morale_fin
      • If base doesn't have CC but does have a BP and defending unit is native, do following
        -> retrieve morale SE value, if < -4 set to -4.
        -> if > 4, set to 4
        -> if < -1, +1
        So range from -3 to 4, it now takes this value and calculates: morale_fin = morale_fin - moraleSE_mod. Where moraleSE_mod is the bounded morale SE value.
      • If base doesn't have BP/CC or BP/CC checks are done, do the following.
        -> If morale SE value is 2 or 3, +1 to morale_fin
        -> If unit is Aliens (red) faction, +1 to morale_fin


      It then merges into code if unit isn't in base where it checks if attacker has Sorophic Gas ability.

      Can anyone clarify as to how BP/CC should work. Even if it is just a sign error, if you're running negative morale SE you'd be better off not having a CC at all. Or maybe this is to offset the morale bonus units get from CC? Then why does BP range from -3 to 4 rather than -3 to 0 like CC?

      Urg what a mess. Also missing is if base has HQ, it should give +1 to morale_fin. This plus my other two posts is basically how the base strength value is generated before any bonus modifiers. Please, please someone give me an outline on how this should work. There was some stuff posted earlier regarding this but I'd appreciate if someone would take my outline and modify it how it should actually work including HQ etc.

      ---

      @vyeh: I agree about very green units should be part of the range. And you are correct, they would get -25%. GooglyBoogly, based on what yves has posted regarding attacking, do you still think this was intended? Based on location of code, I would highly doubt it was meant for bases only and got messed up. If anything it was a 0/1 mistake or on purpose. Anyone else have thoughts regarding this?
      Last edited by scient; April 9, 2009, 01:17. Reason: clarity

      Comment


      • The attack code is pretty much the same general idea as defensive code with a few changes and different pathing. Actually, few bits I'm even more perplex about then defense code. Tomorrow I'll put together a step by step like I did for defense code.

        On another note, while working on defense code I located global then linked me to area in code that generates unit morale panel with '+' and '-'. After combat functions are sorted, I'll have a look at it since it may shed some light on other potential problems. Same goes for drone riots however I think that's partly due to bugged CC/BP code.

        Also, has anyone ever seen "(d)" attached to unit morale display like below? I forced code to set it, I've just never seen it before.

        Comment


        • Edit: See post #371. I've changed my thinking in several regards.

          Page 166 of manual:

          Children's Creche. ... All negative morale effects are cancelled for units in the base square; instead such units receive a +1 morale modifier.

          Page 9 of manual on SMAX CD:

          Brood Pit. Acts as a Children's Creche for native units, if there is not already one at the base.

          I believe that the CC should have the same values as BP/no CC, i.e.

          no + 1 to morale_fin at the beginning of if base has CC (I think this addition should only occur if base has HQ)

          -> if > 4, set to 4 (Otherwise BP is not acting like CC for native units when there is no CC)

          -> if < 0, +1 (this is what the manual says should happen, negative morale is canceled; instead there is +1)

          This is what I think should happen:

          If base is HQ, +1 to morale_fin (this gives the HQ bonus)
          If base has CC,
          -> retrieve morale SE value, if < -4, set to -4 (lower boundary of morale SE, p. 159)
          -> if > 4, set to 4 (upper boundary of morale SE, p. 159)
          -> if < 0, + 1 (this cancels out the negative morale effects and gives the unit a +1 morale modifier, p. 166)
          So range is -3 to 4, it now takes this value and calculates: morale_fin +moraleSE_mod, where moraleSE_mod is the bounded morale SE value.
          After this check, if unit is native and BP is present: +1 to morale_fin (undocumented addition so BP still adds something if CC is present)
          If base doesn't have CC but does have BP
          -> retrieve morale SE value, if < -4, set to -4 (lower boundary of morale SE, p. 159)
          -> if > 4, set to 4 (upper boundary of morale SE, p. 159)
          -> if < 0, + 1 (this cancels out the negative morale effects and gives the unit a +1 morale modifier, so it acts like CC for native unit, p. 9 of SMAX manual)
          So range is -3 to 4, it now takes this value and calculates: morale_fin +moraleSE_mod, where moraleSE_mod is the bounded morale SE value.
          If base doesn't have BP/CC or BP/CC checks are done, do the following
          -> If morale SE value is 2 or 3, +1 to morale_fin (p. 159 of manual for additional morale on defense)
          -> If unit is Aliens (red) faction, +1 to morale_fin (undocumented penalty for letting mindworm into your undefended base)

          If you're running negative SE, CC is big benefit because negative SE becomes +1 SE.

          If by BP/CC, you mean both BP and CC, it looks like there is an (undocumented) bonus of +1 to morale_fin (the minimum bonus) for having both which makes sense.

          One thing that we haven't included is the effect of a drone riot , but I think it is the home base of the defending unit that gives it a (-) rather than the base the defender is in.

          Edit: See post #371. I've changed my thinking in several regards.
          Last edited by vyeh; April 11, 2009, 10:50.
          Unofficial SMAC/X Patches Version 1.0 @ Civilization Gaming Network

          Comment


          • Originally posted by scient View Post
            The attack code is pretty much the same general idea as defensive code with a few changes and different pathing. Actually, few bits I'm even more perplex about then defense code. Tomorrow I'll put together a step by step like I did for defense code.
            According to Maniac, there are major problems with attacking units and CC's.

            Originally posted by scient View Post
            On another note, while working on defense code I located global then linked me to area in code that generates unit morale panel with '+' and '-'. After combat functions are sorted, I'll have a look at it since it may shed some light on other potential problems. Same goes for drone riots however I think that's partly due to bugged CC/BP code.
            I think + are generated by CC's and BP's, - by drone riots.

            Originally posted by scient View Post
            Also, has anyone ever seen "(d)" attached to unit morale display like below? I forced code to set it, I've just never seen it before.

            (d) is designated defender. See p. 96 of manual. You can also use the menu>action>designate defender
            Unofficial SMAC/X Patches Version 1.0 @ Civilization Gaming Network

            Comment


            • @scient

              Example:
              Playing Gaia, I don't have Information Networks yet and thus no Network Nodes in any of my bases. Upon conquering University Base, Gaia's Landing now has a Network Node.

              This doesn't happen always but with a high frequency, the base on my side that receives the NN seems random and whether the conquered Uni base retains its NN seems random too.

              Same applies to Hive bases and Perimeter Defenses (which is usually easier to recognize due to the changing base graphics).

              Comment


              • If you find the time...

                scient, I understand that it's outside your current purpose, but I'm sure modders would love to have the option of changing/inserting art into interludes. If feasible, it might be something to do when you get around to taking on the scenario editor- or something.

                Darsnan can tell you more if you're interested, as I don't really know what I'm talking about.


                Thanks.
                AC2- the most active SMAC(X) community on the web.
                JKStudio - Masks and other Art

                No pasarán

                Comment


                • Example of Nim's Bug from ACDG5 (SMAC):

                  Look at Bay Area (6, 54)

                  At 2167, no perimeter defense.

                  At 2168, there is a perimeter defense.
                  Unofficial SMAC/X Patches Version 1.0 @ Civilization Gaming Network

                  Comment


                  • Units not attacking from a base tile:
                    • Obtain attacking unit's morale + 6, so range 6 to 12 -> store in morale_fin
                    • Obtain attacking unit's weapon value
                    • Check if unit is native
                      -> check if attacking faction has Dream Twister and if so give 50% bonus to armor_val
                    • strength = ((armor_val * 8) * morale_fin) / 64


                    Units attacking from a base tile
                    • Obtain attacking unit's morale -> store in morale_fin
                    • If CC is preset:
                      -> +1 to morale_fin
                      -> retrieve morale SE value, if < -4 set to -4.
                      -> if > 4, set to 4
                      -> if < -1, +1
                      So range from -3 to 4, it now takes this value and calculates: morale_fin = morale_fin - moraleSE_mod. Where moraleSE_mod is the bounded morale SE value.
                      After this check, if unit is native and Brood Pit is present in base: +1 to morale_fin
                    • If base doesn't have CC but does have a BP and defending unit is native, do following
                      -> retrieve morale SE value, if < -4 set to -4.
                      -> if > 4, set to 4
                      -> if < -1, +1
                      So range from -3 to 4, it now takes this value and calculates: morale_fin = morale_fin - moraleSE_mod. Where moraleSE_mod is the bounded morale SE value.
                    • +6 to morale_fin, so range from 3 to 10
                    • Obtain attacking unit's weapon value
                    • Check if unit is native
                      -> check if attacking faction has Dream Twister and if so give 50% bonus to armor_val
                    • strength = ((armor_val * 8) * morale_fin) / 64



                    Notice something missing? There is a whole section of code that gets skipped over compared to defensive code. It's the area that handles the bounds before +6 to morale_fin and like defensive code it is 1 to 6. So the only reason why attack code gives the -25% is because this is never accessed. Also skipped are checks if morale SE value is 2 or 3 to +1 and if attacking unit has soporific gas. All of these are only if unit is attacking from a base so maybe you were right vyeh when you said the 1 to 6 bounding was base only. I've got to do more analysis on the root combat bonus code to determine what toggles this area being accessed because so far I haven't been able to get the toggle to be set.
                    Last edited by scient; April 10, 2009, 09:36.

                    Comment


                    • Not attacking from a base tile:

                      I think you mean weapon_value for attacker

                      Attacking from a base tile (CC present):

                      This +1 to morale_fin if CC is present must be an undocumented effect of CC. If this is the case, then it should also occur for defenders and should be included for defenders. I noticed that the additional +1 morale also affects units that start movement in a base. A commando in a CC base was bumped up to elite in an ACDG6 game and received an extra movement point.

                      I'm confused about moraleSE_mod. morale_fin starts at 0-6. After we add +1 to morale_fin, it ranges from 1-7. What are the ranges for moraleSE_mod? Is this the correspondence between morale SE and moraleSE_mod?

                      morale SE, moraleSE_mod
                      -4,-3
                      -3,-2
                      -2,-1
                      -1,-1
                      0,0
                      1,+1
                      2,+1
                      3,+2
                      4,+3

                      If so, then subtracting moraleSE_mod from morale_fin should give values running from 7-(-4) = 11 to 1-3=-4. And why is it a subtraction rather than an addition? Shouldn't 4 morale SE add 3 morale levels to the unit's morale?

                      Why do we have a range from -3 to 4? Is this morale SE or moraleSE_mod? (Morale SE should run from -1 to 4, while moraleSE_mod should run from -1 to 3, unless I'm missing something.)

                      Obviously, we are also adding +1 to morale_fin for BP. Is there a bounded value on morale_fin? (If we started with a demon boil, morale_fin is 6. With CC and BP, we would add +2. If we had the highest moraleSE_mod (-3 or 3), that would mean morale_fin could be as high as 11.

                      Attacking from base (no CC, but BP):

                      There is no +1 to morale_fin, so if you have a CC, but no BP, you get +1 for a native unit.
                      If you have CC and BP, you get +2 for a native unit.
                      If you have a BP but no CC, you get +0 for a native unit.

                      This doesn't seem to make a BP a replacement for a CC for a native unit.

                      Once again, it seems to subtract rather than add. Could this be the reason for the big mess that Maniac noted?

                      If we are talking about a range from 3 to 10 after we add +6 to morale_fin, we must have been talking about morale_fin. So if no CC and no BP, morale_fin started from 0 to 6, then moraleSE_mod runs from -3 to 3 so adding, it should run from -3 to 9. When we add +6, it should run from 3 to 15, unless there is an upper bound. Is there one?

                      Once again, I think it should be weapon_val rather than armor_val.

                      The check for morale SE value is 2 or 3 should only apply to defense. p. 159 gives an additional morale for defense only.

                      Soporific gas only has an effect on the defender so there shouldn't be a check for the attacker.
                      Unofficial SMAC/X Patches Version 1.0 @ Civilization Gaming Network

                      Comment


                      • I did some work with the scenario editor and I think I understand what is happening.

                        Originally posted by scient View Post
                        For a defender in a base, morale_fin starts out as unit's current morale so 0-6
                        • if bases has CC, +1 to morale_fin
                        • this gives the +1 morale modifier and is applied to morale_fin, so morale_fin now runs from 1 to 7

                          Originally posted by scient View Post
                          -> retrieve morale SE value, if < -4 set to -4.
                          -> if > 0, set to 0
                          this is intended to reverse the effect of morale SE. So we get moraleSE_mod running from -4 to 0.

                          morale SE <= -4, moraleSE_mod = -4
                          morale SE = -3, moraleSE_mod = -3
                          morale SE = -2, moraleSE_mod = -2
                          morale SE = -1, moraleSE_mod = -1
                          morale SE >= 0, moraleSE_mod = 0

                          Originally posted by scient View Post
                          -> if < -1, +1
                          this takes care of the fact that morale SE = -4 only corresponds to a -3 morale drop, morale SE = -3 only corresponds to a -2 morale drop, morale SE = -2 only corresponds to a -1 morale drop.

                          morale SE <= -4, moraleSE_mod = -3
                          morale SE = -3, moraleSE_mod = -2
                          morale SE = -2, moraleSE_mod = -1
                          morale SE = -1, moraleSE_mod = -1
                          morale SE >= 0, moraleSE_mod = 0

                          Originally posted by scient View Post
                          So range is from -3 to 0, it now takes this value and calculates: morale_fin = morale_fin - moraleSE_mod. Where moraleSE_mod is the bounded morale SE value.
                          So this is what we now have:

                          morale SE <= -4, subtract -3 from morale_fin
                          morale SE = -3, subtract -2 from morale_fin
                          morale SE = -2, subtract -1 from morale_fin
                          morale SE = -1, subtract -1 from morale_fin
                          morale SE >= 0, subtract 0 from morale_fin

                          What this does is reverse the effect of negative morale SE on the unit. So if morale SE was -4 and the original morale_fin (under morale SE = 0) was 3 (hardened), then the morale_fin that we started the calculation (before adding the +1) would be 0 (very green). After we add the +1 and make this adjustment, the morale_fin is now 0 + 1 - (-3) or 4 (veteran). So we have cancelled out the negative morale effects and given a +1 morale modifier, which is what we wanted.

                          Note that for morale SE >= 0, the effect is only to give a +1 morale to the unit.

                          So if the original morale (under morale SE = 0) was 3 (hardened) and if morale SE = 3, then the morale_fin that we started the calculation (before adding the +1) would be 5 (commando). After we add the +1 and make this adjustment, the morale_fin is now 5 + 1 - 0 or 6 (elite).

                          Originally posted by scient View Post
                          After this check, if unit is native and Brood Pit is present in base: +1 to morale_fin
                          this is an undocumented benefit to having both a CC and a BP. The SMAX manual says that a BP in a base without a CC acts like a CC for native units. It doesn't mention what happens when a base has both a BP and a CC. Instead of a BP being redundant (like what happens when you have the Virtual World, a network node and a left-over hologram theatre), the BP still contributes. I don't regard this as a bug.


                          Originally posted by scient View Post
                        • If base doesn't have CC but does have a BP and defending unit is native, do following
                          -> retrieve morale SE value, if < -4 set to -4.
                          -> if > 4, set to 4
                          -> if < -1, +1
                          So range from -3 to 4, it now takes this value and calculates: morale_fin = morale_fin - moraleSE_mod. Where moraleSE_mod is the bounded morale SE value.
                        The 4 looks wrong. I think this code should be identical to the CC code above. We need to see if we get the Maniac error on defense for BP only base. So I see a bug here (and maybe we get to write a part 3 to Maniac's column).

                        Originally posted by scient View Post
                      • If base doesn't have BP/CC or BP/CC checks are done, do the following.
                        -> If morale SE value is 2 or 3, +1 to morale_fin
                      Apparently morale_fin was originally adjusted based on the following:

                      morale SE = 2, add + 1 to original (under SE = 0) morale_fin
                      morale SE = 3, add +2 to original (under SE = 0) morale_fin

                      This adjustment gives us

                      morale SE = 2, add + 2 to original (under SE = 0) morale_fin
                      morale SE = 3, add +3 to original (under SE = 0) morale_fin

                      which takes care of (p. 159)

                      Morale
                      ...
                      3 +1 Morale (+2 on defense)
                      4 +2 Morale (+3 on defense)

                      Originally posted by scient View Post
                      -> If unit is Aliens (red) faction, +1 to morale_fin
                      Obviously, if a red unit is in the base, it gets a +1 to defense, an undocumented penalty to letting a red unit occupy your base.

                      Originally posted by scient View Post
                      It then merges into code if unit isn't in base where it checks if attacker has Sorophic Gas ability.
                      Attacker having this ability should give -2 morale to defender.

                      Originally posted by scient View Post
                      Can anyone clarify as to how BP/CC should work. Even if it is just a sign error, if you're running negative morale SE you'd be better off not having a CC at all.
                      Note that if you're running negative morale SE, you get to subtract the negative effect of the negative morale SE. Look at the example of the original hardened reduced to very green under SE = -4. Now it is veteran. So you are better off having a CC.

                      Note that even if you're running a positive morale SE, you still get a +1 bump in morale_fin.

                      Originally posted by scient View Post
                      Or maybe this is to offset the morale bonus units get from CC?
                      The confusion is the subtraction of a negative number and the fact that the morale_fin you started with at the beginning has already been modified by the negative morale SE. In the scenario generator, I noticed that changes in morale did not happen when I did social engineering, but waited until I ended the turn. If I was in SE=4 and I created a very green (morale_fin = 0) with the scenario generator, it would show up as hardened (morale_fin = 3). So the SE=4 (+ 3 morale) was implemented.

                      Originally posted by scient View Post
                      Then why does BP range from -3 to 4 rather than -3 to 0 like CC?
                      I think this is a bug.

                      Originally posted by scient View Post
                      Urg what a mess. Also missing is if base has HQ, it should give +1 to morale_fin.
                      We need to add HQ in.

                      Originally posted by scient View Post
                      This plus my other two posts is basically how the base strength value is generated before any bonus modifiers. Please, please someone give me an outline on how this should work. There was some stuff posted earlier regarding this but I'd appreciate if someone would take my outline and modify it how it should actually work including HQ etc.
                      So basically, the only changes I would make on defense is

                      (1) add in HQ
                      (2) modify BP code to conform to CC code (pending verification in the scenario generator that there is a problem with BP only and native life units on defense).



                      ---

                      Originally posted by scient View Post
                      @vyeh: I agree about very green units should be part of the range. And you are correct, they would get -25%. GooglyBoogly, based on what yves has posted regarding attacking, do you still think this was intended? Based on location of code, I would highly doubt it was meant for bases only and got messed up. If anything it was a 0/1 mistake or on purpose. Anyone else have thoughts regarding this?
                      Note that very green units get (+)
                      units in a base with CC only or BP only get (+)
                      units in a base with CC and BP get (++)
                      Unofficial SMAC/X Patches Version 1.0 @ Civilization Gaming Network

                      Comment


                      • Yes you are correct the VG units probably should get the full25% penalty
                        Into Alien Crossfire? It has been almost 10 years. Time to update your datalinks.
                        Try out my Comprehensive Datalinks Update. Now v1.3!

                        Comment


                        • "Morale for native life-forms ... is called lifecycle level, since a native unit's morale reflects not only the experience of its human handlers, but also its physical maturity." (p. 87)

                          I've discovered using the scenario editor that social engineering does not affect lifecycle.

                          In the datalinks, it says for brood pits, "Negative LIFECYCLE effects cancelled in base square."

                          LIFECYCLE is a link to MORALE, which contains the table on p. 159.

                          Under "morale" in the datalinks is the following sentence, "A unit with a "+" sign after its morale possesses a combat bonus from its location in a base with a children's creche."

                          So there is no negative LIFECYCLE effect.

                          Compare what happens to a hardened (morale = 3) unit and a boil (lifecycle=3) native life-form built under morale SE = 0.

                          If morale SE becomes -4, the hardened unit becomes a very green (morale = 0) unit, but the boil native life-form remains a boil (lifecycle=3).

                          If both are in a base with a children's creche, the very green unit receives +50% (4 morale levels) and defends like a veteran (morale=4) unit would in a base without a children's creche; and the boil also receives +37% (3 morale units; a pre-boil would have received +50%; but defenders are capped) and defends life a demon boil (lifecycle=6) native life-form would in a base without a children's creche or a brood pit.

                          So if I were the Gaians and I had a mindworm defending a critical base with a children's creche, my best strategy would be to go for as negative morale SE as possible. This doesn't seem right.
                          Unofficial SMAC/X Patches Version 1.0 @ Civilization Gaming Network

                          Comment


                          • Great work with follow up vyeh. I haven't been feeling well so haven't had a chance to do any more analysis on bonus code to understand part of attack code.

                            So for defense code the only changes to add in are the following:
                            • If unit is in a base with HQ present, +1 morale_fin. Check before BP/CC code branches.
                            • Make BP code conform to CC code as follows:
                              If base doesn't have CC but does have a BP and defending unit is native, do following
                              -> retrieve morale SE value, if < -4 set to -4.
                              -> if > 0, set to 0
                              -> if < -1, +1
                            • Set morale_fin minimum bound to 0 instead of 1 to sort issue with very green units not getting penalty.


                            So my understanding there is no sign error? The reason for positive gain when CC/BP is present is to cancel out morale SE penalties to unit morale?

                            Comment


                            • scient,

                              I'm still working on a post about the native life problem!

                              This is my tentative hypothesis:

                              There is a variable, call it morale, for every unit, which ranges from 0-6.

                              It denotes morale for non native life-forms and lifecycle for native life-forms. I can set it through the scenario editor.

                              For what you call morale_fin at the beginning of your checks:

                              For non native life-forms, morale_fin = morale + moraleSE_mod

                              For native life-forms, morale_fin = morale

                              Apparently mindworms do not care what morale SE is (they are just as effective under police state and democracy and there is no leakage from their handlers).

                              So, we need to make the following changes:

                              1) change for HQ
                              2) if unit is in base with CC and it is a native life-form, we want morale_fin = morale_fin + 1, ie no correction for moraleSE_mod
                              3) if there is a BP and unit is a native life-form, we want morale_fin = morale_fin + 1, ie no coorection for moraleSE_mod (this is cumulative with CC, so if both CC and BP, morale_fin = morale_fin +2, if only one present, then morale_fin +1.
                              4) morale_fin minimum bound to 0.

                              I really hate it when I was checking for the issue of 4 vs. 0 in the code and discovered that there are no negative effects for native life-forms due to morale SE, so the code was correcting for a non-existent negative effect!

                              I'm sure you're the only one that can empathize with me.

                              There is no sign error. The reason for positive gain when CC/BP is present is to cancel out morale SE penalties to unit morale. In other words, we subtract a negative quantity to compensate for a calculation elsewhere where the negative quantity was added to morale to produce morale_fin.

                              Somewhere in the code, the maximum morale_fin is 6 (elite). There does not appear to be this maximum for attack, which I think is a bug.
                              Unofficial SMAC/X Patches Version 1.0 @ Civilization Gaming Network

                              Comment

                              • Working...
                                X