[PSA] Major Animal Bugs & Issues

Discussion in 'General Discussion' started by Shiverwarp, Oct 31, 2016.

  1. Shiverwarp

    Shiverwarp Starship Captain

    1.2
    UPDATE: They have fixed everything except the gradual decay of happiness (#2 and #4) for the farmer staying up past 6PM. This effectively renders the mood system worthless unless you're neglecting animals completely, or going to bed right at 6pm.
    Thanks to JudasComplex for the help in confirming the decay still exists


    Ever since a forum post on here sparked my interest, I've been looking into the code for the issues that are plaguing Animals. I believe I've found all the major ones, so I'd like to notify the community, as well as make them visible until ConcernedApe has a chance to fix them.

    First a few things to keep in mind: Happiness/Mood refer to the "<Animal> is fine" message and is a value between 0 and 255. Friendship refers to the heart value.
    • 1. Petting your animals when it would put them over 255 happiness, ROLLS OVER their happiness to zero before the petting happiness is added.
      This happens as a result of casting to byte in a few different places in the Pet Function. For example:
      Code:
      this.happiness = Math.Min(255, (byte)((int)this.happiness + Math.Max(5, (int)(40 - this.happinessDrain))));
    • 2. The farmer staying awake past 6PM makes your animals that are inside gradually lose happiness until they bottom out at 150
      This happens every ten minutes of game time, as a result of the following code snippet:
      Code:
      if ((environment.IsOutdoors && timeOfDay > 1900) || (!environment.IsOutdoors && this.happiness > 150) || (environment.isOutdoors && Game1.isRaining) || (environment.isOutdoors && Game1.currentSeason.Equals("winter")))
      {
             this.happiness = (byte)Math.Min(255, Math.Max(0, (int)(this.happiness - ((environment.numberOfObjectsWithName("Heater") > 0 && Game1.currentSeason.Equals("winter")) ? (-this.happinessDrain) : this.happinessDrain))));
      }
    • 3. Having Medium levels of Happiness is more punishing to your Animal's producing deluxe products than extreme low values (Deluxe products include Large Eggs/Milk, Duck Feathers, and Rabbit's feet) This issue does not affect the quality rolls.
      When animals are rolling for deluxe produce, they create a Mood Modifier score. If the animal has 200 or less Mood, it will multiply Mood by -2. If it's more than 200, it multiplies by 2. This happens in the following snippet:
      Code:
      int num2 = (int)((this.happiness > 200) ? (this.happiness * 2) : (-this.happiness * 2));
    • 4. If it's Winter and you have a heater, the farmer staying awake past 6PM will gradually INCREASE your animals happiness up to max IF it is already above 150, else it does nothing.
      This happens in the code snippet listed in #2.
    • 5. If Pigs, Sheep, or Dinosaurs have high mood and Friendship, they won't produce anything at all.
      This happens because these animal types have a -1 deluxeProduceIndex in the Animals.xnb file, and deluxe produce overwrites regular produce during dayUpdate here:
      Code:
      if (random.NextDouble() < (double)(this.friendshipTowardFarmer + num2) / 1200.0 && !this.type.Equals("Duck") && !this.type.Equals("Rabbit"))
      {
            num = this.deluxeProduceIndex;
      }
    Thanks to SunTide, StarPeanut, nevyn12, PathosChild, and Riqua for all the different ways they helped track these issues down.
     
      Last edited: Aug 31, 2017
      Charza, ryusm92, Xenonex and 11 others like this.
    • nevyn21

      nevyn21 Cosmic Narwhal

      You've put a lot of effort yourself into tracking all this down. Mad respect to everyone.

      I hope this see's an official fix.
       
        Shiverwarp likes this.
      • LuthienNightwolf

        LuthienNightwolf Oxygen Tank

        This is still hard for me to wrap my mind around but it does explain an awful lot. I'm on top of animal care like you wouldn't believe and I've still always had issues with getting low quality or no product, from animals with max hearts, for no real reason or at least nothing I could pin down other than multiple rainy days and the animals were just mad cuz they'd been cooped up. Any other time, I just always assumed random factors were at play.
         
          sabrinatw likes this.
        • Shiverwarp

          Shiverwarp Starship Captain

          If you have any questions, ask away. I'm more than happy to try to simplify or explain things. I tried to keep the bold bits in the topic clear, but I'm not the best writer in the world haha.

          The whole thing is very complicated, to be sure, and getting a grasp of the entire system in your head at a once can be a nigh impossible task. Breaking it down into bits is a lot easier.
           
          • LuthienNightwolf

            LuthienNightwolf Oxygen Tank

            lol Much appreciated, its not really a big deal to me personally because I'm not a stickler for the numbers either way...if the animals don't give me products one day its not the end of the world, but I'm trying to understand what these weird rules are basically telling us. Like..."don't allow pigs, sheep or dinosaurs to be too happy", that sort of thing. Non-numerical laymen's terms, does that make sense?
             
            • nevyn21

              nevyn21 Cosmic Narwhal

              Yes. You're looking for a routine that normalizes your production. I'll see if I can help make one clear.
               
              • Borodin

                Borodin Oxygen Tank

                Some good work, there. Have you put this up as well in the Support forum? Because CA doesn't check here (usually), but he does check there.
                 
                • nevyn21

                  nevyn21 Cosmic Narwhal

                  Ok, here's my shot at a daily routine for Cows, goats, chickens, ducks and rabbits:

                  (Suntide, Shiverwarp: if there's something not correct please correct it)

                  Spring, Summer, Fall:

                  1. Pet, then milk if applicable. Let outside to graze if not rain-day.
                  2. Let inside by 6:00pm and close barn door.
                  3. Sleep as close to 6:00pm as possible.

                  Winter:

                  1. Pet, then milk if applicable.
                  2. Sleep at 10:00pm.

                  I think this should normalize production for any animals not affected by issue #5.
                   
                    farmerbunbun likes this.
                  • LuthienNightwolf

                    LuthienNightwolf Oxygen Tank

                    This is what I was looking for, yes. lol The one for spring, summer and fall is pretty much what I already do, though I can't say I always make it into bed quite that early. Never much later than 10 though, on any day. I tend to go to bed earlier in winter because I run out of things to do and don't feel like mining or fishing.
                     
                    • SunTide

                      SunTide Scruffy Nerf-Herder

                      The short answer is "No, it doesn't." There are multiple, independent bugs in the animal system. Well, I'm assuming they're bugs, because if this is the intentional design, it makes no sense.

                      First off, there's the wrap around issue, which is obviously and 100% a bug. It comes up most often if you let your animals graze. Animals LOVE eating wild grass, it sets their happiness all the way to 255, which is the max. The problem is that if you do anything else that increases happiness right after they eat, the wrap around bug hits and they become desperately unhappy. This is why animal mood always seems so random. If you are letting your animals graze, they are usually going to either be 100% happy or 0% happy, depending on whether or not you petted them before or after they eat. This has led to the persistent myth that closing the barn door increases animal happiness. It doesn't, but it prevents them from eating before you pet them, which bypasses the wrap around bug.

                      Then you have the formula that converts happiness into a bonus on the happiness check used to determine animal quality. It makes no sense. If the score is 200 or less, it gets multiplied by negative two (ie you get a penalty). If it's above 200, it gets multiplied by positive two (you get a bonus). That makes no sense. If 200 points is supposed to be the balance point between an animal being happy and being merely content, the bonus should be zero, but instead, you get the maximum possible penalty when the animal is almost but not quite in the "very happy" category. In fact, being "sad" isn't so bad. A happiness of zero afflicts you with a penalty of 0*(-2) = 0, or no penalty at all. A good, just short of being great, score of 200 hits you with a devastating -400 penalty.

                      The sleep behavior also makes no sense. My guess is that the script was supposed to check when the animal goes to sleep, and it gets a happiness penalty if its forced to stay up past 6:00 PM (which can happen if your grazing area is very far area from the barn). Instead, the script checks if you go to sleep, which makes no sense. There's even a special animation and message for animals going to sleep, so the mechanics are there, and I just have to assume that the script isn't working as intended, because otherwise CA is just crazy.

                      Then there's the business with the heater, which also makes no sense. My guess is that the heater is supposed to cancel out the -2 happiness per tick penalty that animals get for being cold, but instead it reverses it into +2 happiness per tick bonus. Since animals apparently go to sleep when you do, instead of when their sleep animation plays, this means that animals like it when you stay up late in Winter, but hate it when you do it in any other season. This has to be a bug. It's just too obscure and arbitrary to be deliberate.

                      And then there's the bit with high end animals not making their products at all if they are very happy (which is actually very hard to arrange, because of all the other issues).

                      I'm not sure what happened. It's so many different things going wrong in so many different ways, and in ways that required deliberate coding, that I can't make heads or tails of CA's design intent. I suspect that the system once made sense, but then he made some changes that broke things and never caught it.
                       
                        Last edited: Nov 1, 2016
                        nevyn21 likes this.
                      • LuthienNightwolf

                        LuthienNightwolf Oxygen Tank

                        See when you explain it all out like that, I'm not just seeing that it's a total mess, but *why* it's a total mess. It really does look like CA needs to make some fixes cuz yeah, that's pretty ridiculous. I have always followed the "pet, collect, let out to graze, barn door closed after they go in" routine but I had no idea the game was calculating anything based on what I did after I said goodnight to the animals. I definitely think you guys should bring this to his attention over in either the suggestion forum or the bug forum, if you haven't already.

                        Also, cookies to you guys for figuring all this crap out - it's way deeper into the game mechanics than I ever would have thought to look. I'm at best a casual player who likes to make things look pretty, that's about as far as I go. lol
                         
                        • Shiverwarp

                          Shiverwarp Starship Captain

                          Just a few corrections to SunTide's message, the Mood Modifier that multiplies by positive or negative 2 only happens when deciding Deluxe produce (Large Milks, Duck Feathers, Rabbits feet), not the Quality rolls (Gold, Iridium etc).

                          The happiness tick isn't -2/+2, it's variable by animal type (4 to 8 points), the difference is pretty minor so I won't list out what animals have which (Funnily enough white chickens seem to have a reversed happiness drain, because all other chickens have 4 while they have 7)

                          Just small things, don't want to nitpick, but I want to try to keep the mechanics clear.

                          But sadly Luithien, a lot of these mechanics aren't easy to create rules of thumb for, because of the way that they're interconnected. It's much easier to solve specific examples (So and so animal, in winter, this many hearts, performing these actions)

                          Nevyn's schedule is probably about as good as you can get. The strange caveat is: You either want to go to bed immediately after 6pm (Within an hour to account for animals that have high happiness drain), or stay up the entire time until much later. This avoids punishing your deluxe products.
                          Only other thing I would add is: On days where you know there will be rain tomorrow, you're better off staying up late, or else you'll end up with the rollover bug while petting them in the morning, and be unable to set them back to 255 happiness, because they can't eat outside.

                          If you have Dinosaurs, Sheep, or Pigs however, that's an entirely different bag of worms.
                           
                            Last edited: Nov 1, 2016
                            LuthienNightwolf and nevyn21 like this.
                          • nevyn21

                            nevyn21 Cosmic Narwhal

                            Any hope on getting this topic pinned by the moderators?
                             
                            • Shiverwarp

                              Shiverwarp Starship Captain

                              I'll just add here my recommendation for how to play around the bugs:

                              IF on your farm you have no Pigs, Sheep, or Dinosaurs, then what you want to do is:
                              1. Pet/Milk your animals in the morning
                              2. Let them outside to eat grass
                              3. When they go to bed at 6PM, close the barn door so they can't eat grass before you pet them in the morning.
                              4. Go to bed before 7PM, closer to 6PM is better. If you miss this window, you're better off staying up as late as possible to avoid the Mood Modifier issue
                              There are a few stipulations:

                              • If you know it's going to rain the next day, you're better off staying up late, or else you'll roll over happiness in the morning [Other option is to not pet them on rainy days, but this will hurt your friendship/mood the following day]
                              • If it's winter, you want to stay up late before sleeping when you have a heater.

                              If you do have Sheep/Pigs/Dinosaurs, it gets a bit more complicated, especially if you have them mixed in with the other animal types.

                              With Sheep/Pigs/Dinosaurs you want their Mood to be 200, or just under, so you have the lowest chance roll Deluxe produce (Which in these animals case, makes them produce NOTHING) This can be achieved by following the previous steps, but going to bed at around 8PM, or a little bit after.

                              Another option for pigs specifically can be to try to keep them at a low friendship value by never petting them.

                              Sorry that it isn't easy to make hard and fast rules, sadly the bugs make it very complicated and quite illogical at times.
                               
                                LuthienNightwolf and nevyn21 like this.
                              • StarPeanut

                                StarPeanut 2.7182818284590...

                                I hacked together a little mod to fix these issues. Please see the mod release thread for details, and please let me know if you try it out! The mod should fix both the broken happiness mechanic and the problem with animals failing to produce anything when they get too happy.

                                http://community.playstarbound.com/threads/happy-animals-1-0.126655/
                                 
                                  Last edited: Nov 5, 2016
                                  Little Lea and nevyn21 like this.
                                • nevyn21

                                  nevyn21 Cosmic Narwhal

                                  Thanks! Definitely give it a thorough testing. :)
                                   
                                  • Shiverwarp

                                    Shiverwarp Starship Captain

                                    I'll just drop another small glitch in here, not as important as the others, and very edge case, and only really affects people positively:

                                    If an animal meets the requirement to produce something, but does not gain the ability to create a Quality or Large/Deluxe product, the game will not register the fact that it produced an item that day. In this case, animals that normally would take multiple days to produce, will produce again immediately the next day. This will happen sometimes when the animal is under 150 mood.
                                     
                                      ChaosAzeroth likes this.
                                    • nevyn21

                                      nevyn21 Cosmic Narwhal

                                      I just want to know that CA is aware of this thread and the issues. I'm going to have to create a twitter account I guess.
                                       
                                      • Magistrella

                                        Magistrella Big Damn Hero

                                        Sent him a tweet and ill submit a bug report via the bug thingy he made at release x.x
                                         
                                          nevyn21 likes this.
                                        • nevyn21

                                          nevyn21 Cosmic Narwhal

                                          Thanks!
                                           

                                          Share This Page