Debugging Strategies ?

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
User avatar
Hairless-Ape
Posts: 316
Joined: Wed, 6. Nov 02, 20:31
xr

Debugging Strategies ?

Post by Hairless-Ape » Sun, 28. Nov 21, 14:56

The situation is where many changes have been made to the AP code (some mine, some not), and am now getting random lockups/freezes and I can't find a methodology for pinning down the problem.
It's random and rare enough that I can't pin it down on a particular change-set out of hundreds. It leaves no log files, or entries in the event viewer when it happens. Unmodified AP works fine. I have decent programming skills, but just not familiar enough with the 'global' debugging capability for X3.

Is there any particular strategy that you use, or would recommend for figuring this out?
I.E. if you had no idea where a lockup was occurring, what would you do to pin it down? Assume it's impractical to remove changes one at a time and re-test given the rarity of the problem, or to add "print" statements randomly.

Any advice or help appreciated.

Thanks.
Out of my mind. Back in 5 minutes.

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24950
Joined: Sun, 2. Apr 06, 16:38
x4

Re: Debugging Strategies ?

Post by X2-Illuminatus » Sun, 28. Nov 21, 16:40

I would start from the latest save before a freeze, ideally one where I still have a few minutes to actually do something before it freezes. Then I would try to narrow down what script it could be that is causing the freeze by canceling scripts or destroying objects scripts can run on, and see if that stops the freeze from occuring. First on a large scale (canceling all global scripts or destroying all ships (minus the Playership) or destroying all stations etc.), then on a smaller scale (destroying NPC ships vs. player-owned ships) and so forth. Once I have narrowed it down, adding logging to the scripts in question to see if I can find the problematic command or situation.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

User avatar
Hairless-Ape
Posts: 316
Joined: Wed, 6. Nov 02, 20:31
xr

Re: Debugging Strategies ?

Post by Hairless-Ape » Mon, 29. Nov 21, 00:44

Excellent advice. Makes great sense. Thank you.
Out of my mind. Back in 5 minutes.

User avatar
Hairless-Ape
Posts: 316
Joined: Wed, 6. Nov 02, 20:31
xr

Re: Debugging Strategies ?

Post by Hairless-Ape » Mon, 29. Nov 21, 19:34

X2-Illuminatus, this was EXACTLY the type of help I have been looking for, and while it took a few hours, I was able to successfully find the problem with my Mayhem 3 stuff.

Basically, 'near' the beginning of the Mayhem 3 game you are offered a mission to pickup a data scanner.
Unfortunately, the code looking to find a station for me to dock at to complete this mission was in a never-ending loop that expanded it's range to find a dockable station. (Mayhem.PlotDataScanner.Trigger.xml)
What the code didn't realize, was that I generally cheat and give myself an M7 to start the game just to make things move along quicker in the early game.
At that early point in the game, when all this occurs, there ARE no dockable stations for an M7 :) BINGO! The M7 can only dock at the player outpost and this early, you haven't put one down yet.

So, it was looping there indefinitely with no safety check on the number of loops. Can't quite blame it on the code given I cheated. Just happy to finally figure out how to proceed with a workable debugging strategy.
Anyway, the first global script that I killed made the problem go away, and then it was a matter of log to file statements from there. I.E. You friggin rock.
Out of my mind. Back in 5 minutes.

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24950
Joined: Sun, 2. Apr 06, 16:38
x4

Re: Debugging Strategies ?

Post by X2-Illuminatus » Thu, 2. Dec 21, 18:00

You're welcome. :) Glad, you were able to fix your problem.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”