Announcement

Collapse
No announcement yet.

Fixing SMACX Bugs

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

  • Originally posted by BlackCat View Post
    To be honest, I've known it from before I sold my soul joined this site, but thought it was common knowledge - you guys had a wast amount of knowledge about the program that I didn't.
    It is old knowledge (for some). I think it could be abused in multiplayer btw. Might not be such a good idea to leave it in.
    Contraria sunt Complementa. -- Niels Bohr
    Mods: SMAniaC (SMAC) & Planetfall (Civ4)

    Comment


    • This is how morale is calculated if unit is defending in a city with children's creche. I haven't gotten to other modifiers (positive and negative) yet so this isn't the complete picture.

      1. Retrieve SE morale value, store in nSEMorale variable
      2. If nSEMorale is less than -4, set to -4
      3. If nSEMorale is less than or equal to -3, add 1. So -4 would be -3, -3 would be -2.
      4. If nSEMorale greater than 0, set to 0.
      5. Subtract nSEMorale from unit's current base morale.

      A defending elite unit would have a base morale of +6 with +1 from CC for a total of +7. So, if this unit's faction had SE rating of -4 you would end up with the following.

      nSEMorale = -3, nUnitMorale = 7 => nFinMorale = nUnitMorale - nSEMorale => nFinMorale = 7 - (-3) = 9

      Easy fix would be to change it from subtraction to addition since there is no positive defending bonus beyond the +1.

      Comment


      • Originally posted by Maniac View Post
        It is old knowledge (for some). I think it could be abused in multiplayer btw. Might not be such a good idea to leave it in.

        Just out of curiosity, how do you tell the other players that you have started a new game after the game is started ?

        EDIT: Well, I guess that if you are game starter and can make a pregame with a couple of interesting units (formers, crawlers) before other factions make any kind of units, it could be abused, but can't that be done easier with the editor ?
        Last edited by BlackCat; February 26, 2009, 18:00.
        With or without religion, you would have good people doing good things and evil people doing evil things. But for good people to do evil things, that takes religion.

        Steven Weinberg

        Comment


        • Originally posted by scient View Post
          This is how morale is calculated if unit is defending in a city with children's creche.
          ...
          5. Subtract nSEMorale from unit's current base morale.

          A defending elite unit would have a base morale of +6 with +1 from CC for a total of +7. So, if this unit's faction had SE rating of -4 you would end up with the following.

          nSEMorale = -3, nUnitMorale = 7 => nFinMorale = nUnitMorale - nSEMorale => nFinMorale = 7 - (-3) = 9

          Easy fix would be to change it from subtraction to addition since there is no positive defending bonus beyond the +1.
          Clearly a sign error. I imagine that everywhere else, one would add SE morale to base morale. So if SE morale is +2 and base morale is +2, you would end up with +4 morale and if SE morale is -2 and base morale is +2, you would end up with 0 morale.
          Unofficial SMAC/X Patches Version 1.0 @ Civilization Gaming Network

          Comment


          • Originally posted by scient View Post
            ...
            On another note, next thing I'll see about sorting are issues regarding morale and combat. Now, I've tracked down the huge ass function used to handle all combat stuff. Before I start doing analysis on it, are there any other know bugs/exploits regarding combat besides children's creche? I think somewhere in here someone posted something regarding incorrect combat stats? And there was an issue regarding strength probability? Also, with morale besides the children's creche issue are there any other problems? In Maniac article, it looks like there are issues regarding it and drone riots? Maybe if someone could highlight issues regarding morale and combat and whether there are any internal mechanics folks would like to know more about. I did find area in code that handles probability of increasing morale due to combat but I haven't looked at it further.
            Here is some onfo from my datalinks that I summarised from Maniac's treatise on morale

            Here are the effects of the drone riots bug in regards to morale:

            $LINK
            ^A unit homed to a base under drone riots gets a (-) morale modifier.
            ^The effects of this modifier differ depending upon SE MORALE setting: (This is a {Bug})
            ^-3 SE Morale: Units homed to a crecheless base get a 25% combat bonus. Units homed to a creche base get a 12.5% bonus.
            ^-2 or -1 SE Morale: Units homed to a crecheless base get a 12.5% attack bonus. Units homed to a creche base get no bonus.
            ^0 SE Morale: No effect
            ^1 or >1 SE Morale: -12.5% combat bonus (as expected)
            In regards to the children's creche bug, when attacking from a base with a creche:

            When the unit is attacking:
            ^
            +4 SE Morale: -37% battle penalty
            ^+3 SE Morale: -25% battle penalty
            ^+2 SE Morale: -12.5% battle penalty
            ^+1 SE Morale: no difference
            ^0 SE Morale: +12.5% battle bonus
            ^-1 SE Morale: +25% battle bonus
            ^-2 SE Morale: +25% battle bonus
            ^-3 SE Morale: +37.5% battle bonus
            ^-4 SE Morale: +50% battle bonus
            ^
            For attacks from a children's creche base there is {no limit at all} for the battle bonus.
            ^This could potentially give a +100% attacking Combat bonus to an elite unit under -4SE Morale
            there is a screenshot of this in action from a post I made long ago:



            Edit: In regards to combat odds it should also be noted that the odds are shown per round, not for the entire combat.
            So while a 6 vs 3 (at same health) would be displayed at 2:1, the odds are actually much better than that. Not sure if you would want to fix the engine, or just the display, but I always found it misleading thinking the defender would have a 33% chance to win in the above case.
            Last edited by GooglyBoogly; February 27, 2009, 02:47.
            Into Alien Crossfire? It has been almost 10 years. Time to update your datalinks.
            Try out my Comprehensive Datalinks Update. Now v1.3!

            Comment


            • Right now I've been working on analyzing defending portion of code. Is there any documentation of the minimum negative bonus an unit can receive while defending in a city? In the code it is capped at -12% regardless of how low it goes. If the return value from all morale modifiers ends up being less than 1, it gets set to 1 and if above 6, gets set to 6.

              return value:
              1: -12%
              2: 0%
              3: +12%
              4: +25%
              5: +37%
              6: +50%

              I don't see anything giving unit bonus for HQ like it says it should in manual. I can easily add this in emulating how it checks for children's creche / brooding pit. There are some inconsistencies for native units if city has both a brooding pit AND a children's creche. There are a few positive and one negative (-2) bonuses I've yet to identify. The negative looks like special ability flags but I could be wrong. I want to track these down before I finalize any changes.

              Once I get defending code working I'll move on to attacking. After that, drone riots and see if I can garner some more details about +/- display.

              Comment


              • Appendix 2, Facility (p. 166),

                "Children's Creche. Base receives +2 on growth scale and +2 on efficiency scale. All morale negative effects are cancelled for units in the base square; instead such units receive a +1 morale modifier. Reduces base's vulnerability to mind control."

                Your list is:
                1: Green
                2: Disciplined
                3: Hardened
                4: Veteran
                5: Commando
                6: Elite

                Where does manual say HQ gives bonus?
                Unofficial SMAC/X Patches Version 1.0 @ Civilization Gaming Network

                Comment


                • CC is only one component of the overall modifier value. Those values 1-6 are the FINAL modifier which is generated in defending code. They aren't "morale" value of unit but sum of modifier values for various things like if city has CC or brooding pit. My question is, for defending should units be able to get less than -12% modifier? Because currently, that is the minimum you can possibly get even after fixing that sign error.

                  As for HQ, page 104 of AC manual.

                  Comment


                  • See the third line for the defender in each of the combat screens. I believe the 1-6 that you see generates this line.

                    Note this is SMAniaC, where elevation matters and I am in the scenario editor, so there are unit ID's.

                    Note that very green is also -12%. If you change the minimum, then very green would probably be -25%.

                    The manual (p. 88) lists the morale from very green to elite and says: "Each level of morale gives a +12.5% bonus to the unit, in both offensive and defensive combat."

                    I would interpret it to mean that very green should be -25%. So I think the code should have been that if the return value from all morale modifiers ends up being less than 0, it gets set to 0 and if above 6, gets set to 6.

                    It seems to me that a typical coding mistake would have someone put in 1 instead of 0.

                    Note that Gaians are the main beneficiaries. Of the 7 SMAC units, they are the only ones with Very Green morale. The effect of the floor of 1 means that at the beginning there morale is the same as all of the others except the Spartans. So the only effect of very green is that when they gain two morale levels, it comes out as only one.

                    I assume you've looked at Maniac's treatise on morale, parts 1 and 2.

                    You should fix the HQ.

                    In scenario editor, when I added children's creche, scout inside base went from "green" to "green (+)" and mindworm went from "larval mass" to "larval mass (+)." When I added brood pit, mindworm went from "larval mass (+)" to larval mass (++)." When I subtracted children's creche, mindworm went from "larval mass (++)" to "larval mass (+)."

                    Could the -2 bonus be from a drone riot? If a unit is inside a base that is in riot, it gets a "(-)."
                    Attached Files
                    Last edited by vyeh; February 27, 2009, 09:28.
                    Unofficial SMAC/X Patches Version 1.0 @ Civilization Gaming Network

                    Comment


                    • Originally posted by Doux View Post
                      The actual bug is: when you attack a Locusts of Chiron, combat starts immediately without confirming the odds.
                      This is a subset of a more general situation. Any instance of Air Intercept combat does not show the confirm odds screen. Air Intercept combat occurs whenever the attacker is an air unit and the defender is an air unit with the Air Superiority (SAM) special ability. Locusts have the SAM ability defined in the unit entry in alpha.txt. This holds for all air chassis (Locusts are gravships), and holds regardless of the location of the defending air unit (even a 'grounded' SAM helicopter defends as an air interceptor.)

                      You _do_ get the Confirm Odds screen against a defending Locust (or any other SAM air unit) when the attacker is a land or sea unit.

                      The odds screen is skipped for intercept combat to cover the case of scrambling defenders. Suppose a copter attacks a supply crawler, and a defending interceptor needlejet scrambles to protect it. If the copter could see the Confirm Odds screen and choose not to attack, then that defeats the whole point of the scramble mechanic in the first place.

                      If there's a bug, it's that the Combat Odds screen is skipped for Air Intercept combat even when the defender did not scramble. Although I'd call it behaving as designed and perhaps the design is just a bit unintuitive.

                      Comment


                      • Originally posted by vyeh View Post
                        Board transport ("L") is also used with sleep. In sleep a unit does not activate until an enemy unit comes near it or it has completely healed (or healed to 80% outside a base).
                        So how does the above work in regards to scient's RB fix? Say I have a land transport with RB that I have set to "go to" mode and it is automatically moving along: what does a unit which is newly healed (by the land transport RB) do? Should the newly healed unit wake up at the beginning of the turn, and if so, then does the transport move on without it?

                        D

                        Comment


                        • I think that a very green -25% combat bonus when defending on a city square is a bit harsh.

                          I cannot point to any documentation right now, but I am reasonably sure that the limit for morale penalties was -12.5% when defending a base square intentionally, the very green only comes into effect when out of a base square then the full -25% modifier is in effect. The lower cap code seems to be fine, at least to me.
                          Into Alien Crossfire? It has been almost 10 years. Time to update your datalinks.
                          Try out my Comprehensive Datalinks Update. Now v1.3!

                          Comment


                          • My test shows that there is no -25% for very green out in the open. The defenders in the combat screens in my post above were both outside the base.

                            The disparity between a Spartan unit (hardened) and a Morgan unit (green) is greater than between that Morgan unit and a Gaian unit (very green). If there is documentation that caps the SE penalty for a unit in a base without a hatchery, I don't have problems with keeping the cap.

                            My understanding is that the code scient found applied to all defenders, whether they were in a base or not.
                            Unofficial SMAC/X Patches Version 1.0 @ Civilization Gaming Network

                            Comment


                            • Originally posted by Darsnan View Post
                              So how does the above work in regards to scient's RB fix? Say I have a land transport with RB that I have set to "go to" mode and it is automatically moving along: what does a unit which is newly healed (by the land transport RB) do? Should the newly healed unit wake up at the beginning of the turn, and if so, then does the transport move on without it?
                              I'm not positive about the ordering but I think that healed unit becomes active before any of the other units. If you set it to sentry mode again, it will continue on with transport otherwise transport will move on without it. I could look into suppressing unit from waking up when completely healed if on transport but I think the way it does it seems ok. Unless someone can find a problem or wants to make an argument for not letting units wake up in transport. If someone wants to do more tests to see if it is possible for "go to" unit to move on without the newly healed unit (ie. "go to" unit movement superseeds healed units) then I would be more inclined to patch it.

                              Originally posted by vyeh View Post
                              My understanding is that the code scient found applied to all defenders, whether they were in a base or not.
                              That is correct. If someone can find documentation or any info about how this was intended, please post it. Otherwise I'm going to err on the side of caution and leave it as is with a fixed -12% lower limit. Having different caps for whether unit is in city or outside is trivial to implement so that won't be an issue.

                              Comment


                              • I've pointed to p. 88 of the manual which lists "very green" as a different morale level from "green" and says "The importance of morale in combat cannot be overstated. Each level of morale gives a +12.5% bonus to the unit, in both offensive and defensive combat."
                                Unofficial SMAC/X Patches Version 1.0 @ Civilization Gaming Network

                                Comment

                                Working...
                                X