Engine Crash

Expanding and utilizing the engine via C++.
22 posts Page 1 of 3
Hodo33
Posts: 86
Joined: Fri Dec 29, 2017 4:34 pm
by Hodo33 » Tue Jan 15, 2019 2:11 am
I say engine crash but probably my bad script code so I'll open with that.
Did a release build and getting crashes at various parts of script execution. Got in the engine and altered a couple defines and it's a bit more stable.
#define TORQUE_TOOLS commented out and removed tools directory from release
#define TORQUE_SHIPPING added in
Other than these two are there any other defines or flags that should be set ?

The crash mostly happens on a zone switch. I use triggers to call a zone switch and tried to follow the cyclegame routines.
Stop all schedules, wait for any mid schedule events to complete, stop all client side actions kill the server, endgame etc then load the new zone. The transition seems to be the crash point. Is there a "safe" order to shutdown one zone and load another? Yeah I know big ask in the blind but any suggestions would help... thanks....
Duion
Posts: 1377
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Tue Jan 15, 2019 9:46 am
Well it is hard to guess what is wrong from that description, you should try to debug yourself first.
First you should install something like Torsion, a Torquescript debugger and see if you can identify the error in the scripts, if that does not help, use a code debugger like Visualstudio for example and see if you can find the error there.
At least that is how I do that.

It seems like you want to remove the tools from the game, I think you can just delete the tools folder and remove it from being executed, but I think it loads automatically from the main.cs in the tools folder or so.
Hodo33
Posts: 86
Joined: Fri Dec 29, 2017 4:34 pm
by Hodo33 » Tue Jan 15, 2019 1:08 pm
I have Torsion
Tried a debug build but it runs at 2 fps
Did a optimized debug build but it wouldn't run

Just looking for any other flags or defines in the engine to alter. I can chase it down but trying to minimize or optimize what should be there on a release build.
I have read through the books/docs but not much of explanation on order of execution for loading and unloading a game zone. Just curious if any of the engine gurus have some insight. I would like to think it's a timing issue like server being shut down before client data, ghosting, materials get cleared. That sort of thing has never been defined.
thanks for help
Duion
Posts: 1377
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Tue Jan 15, 2019 2:12 pm
It should run smooth, you do not need a debug build for debugging with Torsion, Torsion just goes through the scripts.
Try setting a break point at the beginning, then you can see what gets executed in what order, may take a while, but you will be sure later, you should try that at least once anyway, to see how the engine loads stuff.
Happenstance
Posts: 88
Joined: Sat Apr 11, 2015 9:08 pm
by Happenstance » Tue Jan 15, 2019 3:02 pm
The new template modules might be different but in the old 'Full' template search for onCyclePauseEnd(). That gets called on the server when it's time to cycle to the next mission. From there you can trace the mission loading process - through the loadMission() calls and so on.

Your hunch about it being a timing issue is probably correct but you'll have trouble pinpointing that without running a debug build and seeing the stack trace, etc.
Bloodknight
Posts: 234
Joined: Tue Feb 03, 2015 8:58 pm
by Bloodknight » Wed Jan 16, 2019 1:52 am
Tried a debug build but it runs at 2 fps
There is something terribly wrong going on somewhere if this is happening.
Hodo33
Posts: 86
Joined: Fri Dec 29, 2017 4:34 pm
by Hodo33 » Thu Jan 17, 2019 5:09 pm
I tracked the problem or closed in on it some. The crash happens here

BATCH OF DATABLOCKS DONE 8 8
ON TO NEXT PHASE
LOADING PROGRESS SET TO 1
*** Phase 2: Download Ghost Objects 8 levels/Meyrud.mis

Happened here more than once so I am thinking it's a ghost issue.
Next question is: I have 300 to 400 objects being loaded ( added a counter in script) could it be the game wants to start running before the ghosting is complete ?

As a side note I have been chasing the "cant find material for this texture" console spam so to hone in on what object was causing it I did this:

Line 373 MaterialList.cpp added in the full path so I know which directory to look in:

Con::errorf( "[MaterialList::mapMaterials] Unable to find material for texture: %s %s",mLookupPath.c_str(), mMaterialNames.c_str() );

Not sure if that spam causes any issues but I don't like red ink...
Thanks for the help...
Happenstance
Posts: 88
Joined: Sat Apr 11, 2015 9:08 pm
by Happenstance » Thu Jan 17, 2019 8:45 pm
So "phase 2" of the mission loading process happens after the client has downloaded datablocks and asks the server to send over any active ghosts. Typically this would be any objects within the client control object's view range. Crashes at this point are usually caused by a mismatched read/write order in an object's packUpdate()/unpackUpdate() methods (i.e. you're sending some data without reading it on the other end) or possibly a bad file path (maybe a missing texture, material, or shape).

Attempting to track this down without running a debug build is going to be pretty difficult. The console log can narrow things down but there's a lot that happens between "Phase 2" starting and the mission being fully loaded and ready to play.
Hodo33
Posts: 86
Joined: Fri Dec 29, 2017 4:34 pm
by Hodo33 » Fri Jan 18, 2019 9:51 pm
I found the issue and fixed or hacked it here is what happens:
I am running 8 missions cycle. The game crashes downloading ghosts on the 4th or 5th mission.
In the engine netGhost.cpp line 961 we have this
// Set up a buffer for the object send.
U8 iBuffer[4096];
BitStream mStream(iBuffer, 4096);

I thought that array would be cleared with the call to clearGhostInfo but it is not. I calculated the ghost count and size and it seems I overrun the array so I changed it to 8192 and the game runs fine. So perhaps that should be a malloc/free or dmemset on each call ... not sure but changing the size of that array makes the game work without fail now.... sorry to drop bug stuff in this area and thanks for help everyone ....
Hodo33
Posts: 86
Joined: Fri Dec 29, 2017 4:34 pm
by Hodo33 » Tue Jan 22, 2019 7:21 pm
Well I was wrong on that last post. It just pushed the bug out to another location. I have 8 missions and it will always crash going into number 5. If I go to main menu after 4 then re enter the game, no crash. So something is not being cleared on a zone switch. I was careful to put everything into missioncleanup.add(%x) I delete things in order, cancel all schedules and cleanup every thing I can find that might hang out there. It still crashes in the ghosting.
22 posts Page 1 of 3

Who is online

Users browsing this forum: No registered users and 1 guest