More Awesome Than You!

Awesomeware => AwesomeMod! => Topic started by: twallan on 2009 July 18, 03:11:40



Title: Code Fix for inactive slacker sims
Post by: twallan on 2009 July 18, 03:11:40
Greetings:

I've been encountering a problem regarding my inactive sims, where they simply don't go to school or work when not actively selected.  With AwesomeMod's "AllowInactivePerfGain" enabled, this tends to cause all my sims to eventually lose their jobs.

(Edit: Removed obsolete code, in favor of later posts)

Good day. :)


Title: Re: Code Fix for inactive slacker sims
Post by: J. M. Pescado on 2009 July 18, 04:13:56
I provide this here for use by the El Presidente, if he so chooses.  It is not a perfect solution, but it does produce improved results over nothing at all.  I'm certain his most Malevolent will think up a better solution.
Uh...that's not a fix. In fact, you're not even in the right code. That function you're looking at? Isn't what controls whether inactive sims go to work when not selected. That's the fallback check in Supreme Commander. Furthermore, your code is based on an OLD version.


Title: Re: Code Fix for inactive slacker sims
Post by: twallan on 2009 July 18, 05:30:00
Quote
Uh...that's not a fix. In fact, you're not even in the right code. That function you're looking at? Isn't what controls whether inactive sims go to work when not selected. That's the fallback check in Supreme Commander. Furthermore, your code is based on an OLD version.

I am aware that it is not a true fix, simply a workaround to the core problem.  Until you have an official release of AwesomeMod that corrects the issue, it works for me.

The hooked code block is Sims3.Gameplay.Autonomy.Autonomy.RunAutonomy(), in which I found no AwesomeMod changes.  It did make use of a work handler that was available within AwesomeMod, because that was the effect I wanted (namely to push a "Go To Work" interaction on my sims).

If you could direct me to the actual location of the errant "Go To Work" process, I would be most grateful.  I would love to debug that process and find out why that system is not pushing my inactive sims to work or school. :)

The code is based on the official release of AwesomeMod, at least the one available via Mirror #1.  Since that is the only version I have available, I could not base the changes on anything newer.

Good Day. :)


Title: Re: Code Fix for inactive slacker sims
Post by: J. M. Pescado on 2009 July 18, 05:37:19
The actual go to work handler is buried someplace complex that I haven't found yet, something in the EAxis code involving alarms and whatnot. There are also lots of other things which could disrupt it, and other conflicting things.


Title: Re: Code Fix for inactive slacker sims
Post by: twallan on 2009 July 18, 05:46:22
Quote
The actual go to work handler is buried someplace complex that I haven't found yet, something in the EAxis code involving alarms and whatnot. There are also lots of other things which could disrupt it, and other conflicting things.

Yes, still being a neophyte to this particular code-base, I was perhaps too overly impressed with myself when I got my sims actually back to work.

I shall await your future Awesomeness in this regards, and just continue remerging my personal changes with your new versions, at least until you state a fix has been located.

Good Day. :)

----

Update:

Code:
protected virtual void RegularWorkDayTwoHourBeforeStartAlarmHandler()
{
    DateAndTime queryTime = SimClock.CurrentTime();
    queryTime.Ticks += SimClock.ConvertToTicks(3.1f, TimeUnit.Hours);
    if (this.ShouldBeAtWork(queryTime))
    {
        Sim createdSim = this.OwnerDescription.CreatedSim;
        if ((createdSim != null) && (this.mCurLevel != null))
        {
            if ((!createdSim.IsSelectable || !this.mbCarpoolEnabled) || !this.mCurLevel.HasCarpool)
            {
                queryTime = SimClock.CurrentTime();
                float num = ((this.mCurLevel.StartTime - queryTime.Hour) + 24f) % 24f;
                float time = num - this.AverageTimeToReachWork;
                if (time < 0f)
                {
                    time = 0f;
                }
                this.mRegularWorkDayGoToWorkHandle = AlarmManager.Global.AddAlarm(time, TimeUnit.Hours, new AlarmTimerCallback(this.RegularWorkDayGoToWorkHandle), "Career: time to push go to work", AlarmType.AlwaysPersisted, this.OwnerDescription);
            }
            else
            {
                StyledNotification.Format format = new StyledNotification.Format(Localization.LocalizeString("Gameplay/Objects/Vehicles/CarpoolManager:CarpoolComing", new object[] { createdSim }), ObjectGuid.InvalidObjectGuid, createdSim.ObjectId, StyledNotification.NotificationStyle.kTip);
                StyledNotification.Show(format, this.CareerIconColored);
            }
        }
    }
}

After further investigation, I found that the RegularWorkDayTwoHourBeforeStartAlarmHandler alarm was being fired 2.25 hours before work.

However the ShouldBeAtWork() check at the beginning of the routine originally only allowed for a 2.1 hour tolerance.

Changing the tolerance to 3.1 hours resolved my issue, without the need of any other code changes.

Yes, this is yet another workaround for an error further down in the system, but I did not investigate further into why the alarm was fired early.

Good Day. :)


Title: Re: Code Fix for inactive slacker sims
Post by: twallan on 2009 July 24, 15:45:58
Further to this issue.

Though the 3 hour tolerance corrected the problem with the inactive sims going to work, it is still possible for them to bounce and drop the interaction.

So in addition, it was necessary to reapply the alarm to give the sim another chance to actually work.

Code:
        public static void RegularWorkDayGoToWorkHandle(Sims3.Gameplay.Careers.Career career)
        {
            Sim createdSim = career.OwnerDescription.CreatedSim;
            if (((createdSim != null) && ((AutonomyRestrictions.GetLevel() >= AutonomyLevel.Two) || createdSim.IsNPC)) && !createdSim.InteractionQueue.HasInteractionOfType(career.WorkInteractionDefinition))
            {
                // Update the HoursUntilWork()
                career.SetHoursUntilWork();

                VisitSituation.AnnounceTimeToGoToWork(createdSim);
                createdSim.InteractionQueue.AddNext(career.CreateWorkInteractionInstance());
            }
        }

The embedded code is a personal function called by Career::RegularWorkDayGoToWorkHandle.  The addition is a call to SetHoursUntilWork().

Normally SetHoursUntilWork() would be updated by the Autonomy::Update call, but my suspicions are that some sims are not being updated fast enough.  Perhaps I have too many and updating them all takes several sim-hours.  I will have to look into this further.

The consequence is that the HoursUntilWork member can be grossly incorrect (one sim was over three hours off).  And since it is used in WorkInRabbitHole.Definition::Test(), any attempt to push that interaction will fail.

Good Day. :)

( Edit: Updated intent of post entirely )


Title: Re: Code Fix for inactive slacker sims
Post by: Motoki on 2009 July 26, 18:47:24
Since Pescado's usage and modification policy is "meh" can you post your version or at least tell us how to modify ours?

I am sick and tired of my god damned neighborhood sims never going to work or school.  >:(


Title: Re: Code Fix for inactive slacker sims
Post by: twallan on 2009 July 26, 19:48:33
Since Pescado's usage and modification policy is "meh" can you post your version or at least tell us how to modify ours?

I am sick and tired of my god damned neighborhood sims never going to work or school.  >:(

(Download removed...  AwesomeMod version 28-07-2009 incorporates its own fix)

Here you go.  An modified copy of AwesomeMod version 23-7-2009.

Remove your "awesome.package" and replace it with the "updated_awesome.package".

If you are having the same issue as myself, then this should fix the problem.  If not, then you will need to wait until Pescado determines a solution.

My apologies in advance if the link doesn't work properly...  This is first time I've attempted this type of file sharing.

If it all works out in the end, I'd love to know.

Good Luck. :)

(Edit: corrected names of packages)

(Edit: Download removed...  AwesomeMod version 28-07-2009 incorporates its own fix)



Title: Re: Code Fix for inactive slacker sims
Post by: Motoki on 2009 July 26, 20:09:35
Cool. I will try it out.

You did mention a whole mess of kids at the school in the morning. Have you had any issues with the zergswarming to all get into the tiny rabbit hole at the same time?

I followed someone's suggestion in the other thread and edited one of the ini's to let the sims walk through each other. :P


Title: Re: Code Fix for inactive slacker sims
Post by: twallan on 2009 July 26, 20:35:54
You did mention a whole mess of kids at the school in the morning. Have you had any issues with the zergswarming to all get into the tiny rabbit hole at the same time?

I followed someone's suggestion in the other thread and edited one of the ini's to let the sims walk through each other. :P

I too have turned the DynamicAvoidance to 0.0 on my game.

Though prior to doing so, I still didn't note anything untoward regarding their school work...  Even if a couple chose to stand outside for several hours, they usually corrected it the next day by not being the last in that time around.

Good Day. :)

(Edit: Hit enter too early :P )


Title: Re: Code Fix for inactive slacker sims
Post by: JBoat on 2009 July 26, 22:47:54
I too have turned the DynamicAvoidance to 0.0 on my game.
I simply cut the values in half (from defaults) which is quite realistic enough, and alleviates most of the traffic jams I see in-game.


Title: Re: Code Fix for inactive slacker sims
Post by: cheriem on 2009 July 27, 11:27:09
Thank you for solving the biggest frustration of this game for me.  Everything else is working flawlessly in my game and this was driving me insane. :P


Title: Re: Code Fix for inactive slacker sims
Post by: shadow on 2009 July 28, 04:22:24
This disables the 'lifetimehappiness' cheat for more reward points.


Title: Re: Code Fix for inactive slacker sims
Post by: Motoki on 2009 July 28, 04:35:24
This disables the 'lifetimehappiness' cheat for more reward points.

I never used that one but you can still left click on the happiness points screen next to the treasure box to add more points as long as you have testingcheatsenabled set on in the awesomeconfig.


Title: Re: Code Fix for inactive slacker sims
Post by: twallan on 2009 July 28, 05:27:12
This disables the 'lifetimehappiness' cheat for more reward points.

Interesting, though I don't see why.  I was very careful to only make the three necessary changes to the code-base required to correct the work/school issue.  Everything else should be as is in the 23-07-2009 version of AwesomeMod.

Using a properly defined aweconf.package and the "updated_awesome.package", I was able to use the "lifehappiness" command.  If you are having issues, it is probably related to something other than this mod.

Good Day. :)


Title: Re: Code Fix for inactive slacker sims
Post by: Marhis on 2009 July 28, 07:16:30
I already had the lifetimehappiness code not working, without this modification, so I think it's due to something else too.


Title: Re: Code Fix for inactive slacker sims
Post by: J. M. Pescado on 2009 July 28, 11:47:22
I am applying a more brute-force solution: I am just changing it so that instead of using frequently rubbish cached data, HoursUntilWork will always actually calculate the value, as the calculation doesn't look all that intensive anyway.


Title: Re: Code Fix for inactive slacker sims
Post by: alphagirl on 2009 July 28, 17:57:02
I too have turned the DynamicAvoidance to 0.0 on my game.
I simply cut the values in half (from defaults) which is quite realistic enough, and alleviates most of the traffic jams I see in-game.

Is there a chance you might share this in form of a mod? With nearly all other annoyances having been covered by now, this one still doesn't seem to have been covered, and kitchen crowds are driving me crazy.


Title: Re: Code Fix for inactive slacker sims
Post by: Gastfyr on 2009 July 28, 17:57:27
instead of using frequently rubbish cached data, HoursUntilWork will always actually calculate the value
Pes, is that why when I switch to my inactives it has been saying they are "missing work" but if I try to send them to work, it says "it is not your time to work come back in X hours?".


Title: Re: Code Fix for inactive slacker sims
Post by: Motoki on 2009 July 28, 18:02:33
I too have turned the DynamicAvoidance to 0.0 on my game.
I simply cut the values in half (from defaults) which is quite realistic enough, and alleviates most of the traffic jams I see in-game.

Is there a chance you might share this in form of a mod? With nearly all other annoyances having been covered by now, this one still doesn't seem to have been covered, and kitchen crowds are driving me crazy.

It's not necessary. You modify the "DynamicAvoidance*" settings yourself in file C:\Program Files\Electronic Arts\The Sims 3\Game\Bin\Sims3.ini

Either half them from the defaults as JBoat did or just set them totally to 0 if you don't mind them completely walking through each other.


Title: Re: Code Fix for inactive slacker sims
Post by: alphagirl on 2009 July 28, 18:37:41


It's not necessary. You modify the "DynamicAvoidance*" settings yourself in file C:\Program Files\Electronic Arts\The Sims 3\Game\Bin\Sims3.ini

Either half them from the defaults as JBoat did or just set them totally to 0 if you don't mind them completely walking through each other.
That's great, and sounds easy enough. However there are several DynamicAvoidance entries. Do I set the Field Radius to 0.06 (if I want it halfed), or do I have to half all values?



Title: Re: Code Fix for inactive slacker sims
Post by: Motoki on 2009 July 28, 18:46:36
That's great, and sounds easy enough. However there are several DynamicAvoidance entries. Do I set the Field Radius to 0.06 (if I want it halfed), or do I have to half all values?

Yep. Just change all of them. Make a backup copy before you do just so you have the original values and in case the patch decides to get picky about modified files.


Title: Re: Code Fix for inactive slacker sims
Post by: alphagirl on 2009 July 28, 20:59:58
That's great, and sounds easy enough. However there are several DynamicAvoidance entries. Do I set the Field Radius to 0.06 (if I want it halfed), or do I have to half all values?

Yep. Just change all of them. Make a backup copy before you do just so you have the original values and in case the patch decides to get picky about modified files.

I have tested this for a few hours now, and the kitchen situation has definitely improved. Thanks a lot!


Title: Re: Code Fix for inactive slacker sims
Post by: Entgleichen on 2009 August 04, 16:47:53
My sims still don't go to work/school. This happens to be only in a certain savegame. Something must be corrupted in it. Is there anything I could try to fix this?


Title: Re: Code Fix for inactive slacker sims
Post by: AlexanderMorgan on 2009 August 19, 08:50:27
Same here. Despite the newest update this 'slacker syndrome' has appeared yet again. I've been trying to figure out what was the cause but no luck. At first i thought it may be the usage of switching between households by holding CTRL and clicking on a sim or house and selecting "Select Sim" or "Switch to [household name]". But it's not that. Than i thought maybe the sacred tag might have something to do with it, but so far i've tagged many sacreds and in my new game the town is still alive and everyone is going to work and school.

Now that i think about it, this problem might have first started to appear when i was saving my game and i received that "something-something-something error 12". So i tried again, and again and again and finally the game saved. Maybe the savegame was corrupt in the process? Who knows...

Too bad this slacker problem happens.  It convulses the entire town after a while in a game. If we could only discover what was causing it, we could avoid the trigger. I'm open for any gameplay testing if necessary.


Title: Re: Code Fix for inactive slacker sims
Post by: varmint on 2009 August 19, 10:04:15
Old thread is old. This issue still exists, but alternative solutions have been found (http://www.moreawesomethanyou.com/smf/index.php/topic,16412.0.html).


Title: Re: Code Fix for inactive slacker sims
Post by: AlexanderMorgan on 2009 August 19, 17:45:21
I'm blind as a bat mate lol. Why didn't i see that linked thread in the pudding factory subforum? I guess i just didn't expect to see a solution in there. Thanx for the link, will give it a go.