Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Kestrellius on October 04, 2016, 07:05:44 am

Title: CTDs and the limits of the engine
Post by: Kestrellius on October 04, 2016, 07:05:44 am
So I'm dicking around with the editor, trying to make a Vasudan/Shivan BoE because why not. (I know BoEs are semi-frowned upon here, or at least were in the past, but this one is actually working really well. But that's a matter for another thread.) Unfortunately, I'm occasionally getting CTDs.

Now, this is a big mission. I'm throwing a lot at the game -- there are like eight destroyers, ten or so corvettes, and twenty to thirty cruisers, plus a bunch of fighter and bomber wings. I would understand completely if there were performance issues. But there aren't -- my framerate is a perfect 60 (or whatever it normally is, anyway. It's easy to tell because of the frame overlap of the pulses from my guns.)

But from time to time -- usually about five to ten minutes into the mission, I think -- the game freezes up, then crashes.

Anyway, is this a known issue? Is there an easy solution, or am I just pushing the game harder than it can take? I haven't added all the fighters I was planning to yet, so if the problem can't be fixed I'll have to rearrange some things.
Title: Re: CTDs and the limits of the engine
Post by: The E on October 04, 2016, 07:30:19 am
The only way to figure this out, unfortunately, is running a debug build to see if you can reproduce the issue, and if you can, to send us the log it generates.
Title: Re: CTDs and the limits of the engine
Post by: Kestrellius on October 04, 2016, 07:41:46 am
Oh, right, that's how you get the log. I couldn't remember; I thought it was an option in the launcher somewhere. Yeah, I'll work on doing that.

EDIT: Alright, here we go. I was able to reproduce the issue.

Also it said a ship (one of the Dragon fighters, specifically) "rotated too far" one of the times it crashed (I was using debug, but not windowed, so I had to redo it). I have no idea what that means.  :confused:

[attachment deleted by admin]
Title: Re: CTDs and the limits of the engine
Post by: AdmiralRalwood on October 04, 2016, 01:37:26 pm
Code: [Select]
ASSERTION: "sw->num_objs_hit < SW_MAX_OBJS_HIT" at shockwave.cpp:330
Congratulations! You have a shockwave that's hitting more than 64 unique objects during its lifetime. That's... honestly rather impressive.

No, there's not really anything to be done about that except reduce mission clutter so that shockwaves hit fewer objects. Sorry.

Also it said a ship (one of the Dragon fighters, specifically) "rotated too far" one of the times it crashed (I was using debug, but not windowed, so I had to redo it). I have no idea what that means.  :confused:
I honestly don't think anyone actually understands the purpose of that assertion... :v: appears to have been debugging a physics bug there at some point, but it's really unclear what the point of keeping it around now is.
Title: Re: CTDs and the limits of the engine
Post by: Kestrellius on October 04, 2016, 01:41:08 pm
...huh. I'm not sure how that would be happening. I guess most of it's probably debris? Or...does weapons fire count toward this? Non-destructible missiles and energy bolts and such?

Maybe I'll have the mission not contain any torpedoes. That might help.
Title: Re: CTDs and the limits of the engine
Post by: AdmiralRalwood on October 04, 2016, 01:52:23 pm
...huh. I'm not sure how that would be happening. I guess most of it's probably debris? Or...does weapons fire count toward this? Non-destructible missiles and energy bolts and such?

Maybe I'll have the mission not contain any torpedoes. That might help.
No; only ships get stored in the object list, and weapons without hitpoints (and ones that can't be damaged by shockwaves) don't get processed anyway.

Additionally, running out of room in the list can't be the cause for your CTD in Release builds, because without that assertion it just reuses the last slot in the list for everything (so there's no invalid memory access going on).

EDIT: oh wait, lol, the code that ensures it's in a valid range executes after the code that uses it to iterate through the list of hit objects, so there is an invalid memory access going on (but, annoyingly enough, it happened before that assertion was triggered)
Title: Re: CTDs and the limits of the engine
Post by: Kestrellius on October 04, 2016, 04:35:08 pm
Hm. Well, the shockwave from a destroyer exploding is pretty enormous, and the mission tends to degenerate into a ball of warships all clustered together toward the end, so maybe it is managing to hit 64 ships. But them getting all close together like that isn't a desired effect anyway, so I'll just have to work on fixing it.
Title: Re: CTDs and the limits of the engine
Post by: Mito [PL] on October 04, 2016, 05:44:47 pm
Suggestion!
For testing purposes - isn't there a "Custom shockwave" parameter in FRED? Just set the range to something low enough and keep testing! :P
Title: Re: CTDs and the limits of the engine
Post by: Kestrellius on October 05, 2016, 02:00:16 am
Ooh, good idea. Thanks!

EDIT: Yeah, I haven't had any crashes since I disabled the shockwaves on the destroyers. Good call.
Title: Re: CTDs and the limits of the engine
Post by: Kestrellius on October 07, 2016, 09:55:07 am
I've started getting crashes again, so I figured I'd make a log and post it in case anyone wants to help me decipher it. There's a whole lot of "could not create debris, no slots left" in there.

[attachment deleted by admin]
Title: Re: CTDs and the limits of the engine
Post by: The E on October 07, 2016, 10:02:02 am
Code: [Select]
-mod derelict,mediavps_2014,MediaVPs_2014
Well, that ain't right. You only need to include the mvps once (this shouldn't actually cause issues, but you never know)
Ultimately, this is a "this thing rotated too far" issue, which we really need to decide what we as coders need to do with; not a lot you can do there unfortunately. That there are no debris slots available is completely uncritical.

[/code]
Title: Re: CTDs and the limits of the engine
Post by: Kestrellius on October 07, 2016, 10:38:27 am
I think that's an artifact from when I was playing Derelict, and wanted to do it with the MediaVPs? I just never got around to removing it from the custom flags. I have gotten rid of it now, though.