Replies: 2 (Who?), Viewed: 475 times.
Virtual gardener
staff: administrator
Original Poster
#1 Old 4th Sep 2020 at 2:26 PM
Default Experimenting with EA's Debugging tools
Heya!

It's unknown that the game still has a lot of debugging code. And some of it is actually quite valuable stuff! So I kinda wanted to dedicate this thread to open this treasure chest  The Debugging code that i'm specifically looking for is really more the technical stuff, especially since nraas debugenabler did already an awesome job on finding debug options  But it makes sense that they didn't get to enable debug options for non-interactions.

Currently, I've been able to get the following to work:

'Draw line & Draw circle' :

Now, this is a very regular one tbh. If you have WA, you might recognise these lines (They use the same debug code for creating arrows). Currently I got it to work with it showing the forward vector. Which also keeps in mind where the sim will stand and starts it's interaction with the object. (base.StandardEntry() is the function that will lead the sim to here). Same can be used for sims!



Now the circle stuff I still need to fix. I'm actually using the wrong vector3 positionings for it to work. And it takes some maths and brains to figure out the middle of a circle

Toggle Debug Info:
This, I will say, since I've discovered it, is actually a super helpful one when script modding (especially the heavy work!). It shares the Frame rate, the memory usage, how many 'Tasks' there are currently running But also, how much script memory there's still left. Furthermore it includes the time it took to render the game's frame, and how excessive that 'render frame' call was to begin with. 





This also updates in realtime  

What I'm currently trying to get to work:
Currently I'm working on getting the 'AnimationDebugWindow' to work and show up. Looking at the code itself, it seems SUPER helpful for debugging jazz scripts and just animations to begin with!  Haven't yet been able to even pop up correctly but that was partial because it doesn't like static functions.

If you guys have any functions or things that you'd like to see up and running or just share some code/images/things, I'd love to see it!
Screenshots
Advertisement
Virtual gardener
staff: administrator
Original Poster
#2 Old 6th Sep 2020 at 2:33 PM Last edited by Lyralei : 8th Sep 2020 at 12:44 PM.
So by pure accident, I also found another Debug menu! I noticed that EA actually has 4 different 'views'. You know how when you press F10, the UI will disappear?

Well, there are 4 different "UI appearances". I think 2 of them have actually been removed from the initial release, from the looks of it. But whenever I select 'UI appearance 0' I actually get to see this:



This also turns on another debug thing, where if you hover over any lot, you'll see the Lot ID, the filename where the lot had been saved and the residential name. Now, this is my test lot, so you don't see many fun things happening currently.

Num NPC Drivers, is really just what it means. How many NPCs are driving currently in the game? Now the original code for it actually has a few more options:

Code:
     public void UpdateDisplayPanelText()
    {
        bool visible = false;
        Color textColor = default(Color);
        textColor.Alpha = byte.MaxValue;
        string text = "";
        if (GameUtils.IsPaused())
        {
            text += "Paused\n";
            textColor.Red = byte.MaxValue;
            visible = true;
        }
        if (Sims3.Gameplay.Gameflow.SlowMotion)
        {
            text += "Slow Motion\n";
            textColor.Green = byte.MaxValue;
            visible = true;
        }
        if (!AutonomyRestrictions.IsDefault())
        {
            text = text + AutonomyRestrictions.GetLevelString() + "\n";
            textColor.Blue = byte.MaxValue;
            visible = true;
        }
        if (LotManager.sAlwaysAllowUserToMoveObjects)
        {
            text += "Always Allow User To Move Objects\n";
            textColor.Green = byte.MaxValue;
            textColor.Blue = byte.MaxValue;
            visible = true;
        }
        object obj = text;
        text = obj + "Num NPC Drivers: " + CarNpcManager.Singleton.NpcDriversManager.NumDrivers() + " \n";
        mDisplayPanelText.Caption = text;
        mDisplayPanelText.TextColor = textColor;
        mDisplayPanelText.Visible = visible;
    } 
The weird thing is though, I can only get this to show in custom worlds :/ Maybe this is why Sunset valley 2 existed :p ea's test world. 
I still have trouble getting that AnimationDebugModal to show up tbh, it just really doesn't like to be called :p 

EDIT: Also! I just noticed the draw calls keep getting 'exceeded'. :p


Secondly, the debug panel I talked about always is stuck at paused. And the Num PC drivers seems to also stay at 0. Furthermore, it really doesn't seem to function at all, like the slow motion thing doesn't actually link to the cheat. 
Screenshots
Virtual gardener
staff: administrator
Original Poster
#3 Old 16th Jan 2022 at 12:32 AM
I know this is super ancient ago, but I did finally figure out (after literally 2 years :p) how to make the draw circle:

Code:

        public static void DoStuff()
        {
            //Getting position of actor/activesim
            Vector3 position = PlumbBob.SelectedActor.Position;
            // Gladly ignore this. We need this for lazyloading.
            List<ulong> mDrawObjects = new List<ulong>();

            DrawCircle(position + Vector3.UnitY * 0.1f, 10f, Color.Preset.OpaqueRed, ref mDrawObjects);
        }
        public static void DrawCircle(Vector3 center, float radius, Color color, ref List<ulong> drawObjects)
        {
            Vector3 center2 = center;
            center2.y += 0.25f;
            Lazy.Add(ref drawObjects, DebugDraw.DrawCircleTimed(center2, radius, color, 3.40282347E+38f));
        }
Back to top