Page 1 of 1

Unavoidable Habitat.ConstructFacilities NullReferenceException crashes the game

Posted: Sat Jan 16, 2016 10:11 pm
by Bitwise
Hi,

Firstly: new to the game and I have enjoyed it immensely so far. [:)] Thanks to the developers for all their work on it.

I was planning my next strike to liberate the independent Sol system from their perpetual pirate war. (It seriously never seemed to end. Not sure if that's common, but it's pretty entertaining!)

However, much to my dismay, I've run into this error:

Code: Select all

System.NullReferenceException: Object reference not set to an instance of an object.
    at DistantWorlds.Types.Habitat.ConstructFacilities(Double timePassed)
    at DistantWorlds.Types.Habitat.DoTasks(DateTime time)
    at DistantWorlds.Main.PQo4IlPDFvaC1bjsUOp(Object , DateTime )
    at DistantWorlds.Main.oP9trwAmGw(DateTime  , Int64  , BuiltObjectList  , Boolean  )
    at DistantWorlds.Main.ProgramLoop()

(This seems to have been reported once before, so perhaps it cannot be fixed. The forum won't let me post a link to it, apologies.)

It occurs every time I reach a certain date, +/- 5 days. I'm not sure if this error refers to an actual planet facility being constructed or a habitat module on a ship, but I've tried to work around it. Things I've tried:

[*]Deleting all other empires and pirate factions.
[*]Deleting all of my own ships and bases.
[*]Removing any planet facilities under construction on my planets. (I'm assuming that deleting an empire would do the same for the AI.)
[*]Going back to an earlier save (over a year) and letting it run through without doing anything.
[*]Going back to the same earlier save and deleting all other factions and all of my own ships/bases/facilities under construction.

The error still occurs at around the same time. I'm beginning to wonder if there's a zombie object stuck in the game trying to be built.

I've put a zip in the upload FTP site with the name "[Bitwise]Habitat.ConstructFacilities NullReferenceException". The error occurs within 10 days of unpausing.

If there are any suggestions on other ways to try to avoid this, or if I can provide any other information, please let me know.

RE: Unavoidable Habitat.ConstructFacilities NullReferenceException crashes the game

Posted: Sun Jan 17, 2016 3:44 am
by zakblood
sorry for the default reply but sometimes it does help.

add the exe of the game to your Anti Virus and firewall program, to make sure check the logs of these to see if it was one of them which was to blame.

That usually means a 3rd party program, like an Internet security programs, is interfering with the game or update installation.

run the game from a admin account and use full admin permissions.

please make sure all game pre requisite are installed with the game, even if you think or fully know there are already installed, it will only over write, and it may be that you have a older or newer version of these where as the game in question may need a certain version.

please make sure you are running the latest game version and have up to date drivers installed on your pc,

If you have the original version. So you'll need to update it from the Internet.
Please note that you'll only need the last update, as the updates are comprehensive.

RE: Unavoidable Habitat.ConstructFacilities NullReferenceException crashes the game

Posted: Sun Jan 17, 2016 7:18 pm
by Bitwise
No problem, and thanks, I agree it's important to cover the basics first. I have reinstalled the game and all components but there is no change, sadly.

I can start a new game without any issue but I am a bit reluctant to do so right away, even though this error might be very rare.

RE: Unavoidable Habitat.ConstructFacilities NullReferenceException crashes the game

Posted: Mon Jan 18, 2016 2:43 am
by zakblood
the only thing that you can do with code is try and replicate it, if you can do this for certain with a given save, then the developers can fix it, but it has to be reproducible from a save using a well written and easy to follow steps, if you can, then it's a bug, but if you do it and it doesn't crash there machine, then it's not a game code bug but a hardware / software one, with something on your pc that the game code doesn't like, and that's the problem with random events i'm sorry to say, if it happens more often it's good as it normally means it's reproducible, the more rare it is, the harder it is to fix, if it only happens at a given point and then only on your pc and not reproducible from the save on the developers, it won't or can't / or next to imposable to fix with a patch[:(]

RE: Unavoidable Habitat.ConstructFacilities NullReferenceException crashes the game

Posted: Mon Jan 18, 2016 9:10 pm
by Bitwise
Yes, hopefully someone can take a look at the save I uploaded. I'd be interested to know if it happens to other people. Thanks again!

RE: Unavoidable Habitat.ConstructFacilities NullReferenceException crashes the game

Posted: Tue Jan 19, 2016 10:08 am
by Bingeling
To be fair, Elliot has solved a bunch of rare crashed based on a report like the original alone. Of course a save game that is predictable can help in finding a root cause of the crash.

There are lots of things that can be achieved with a null check and/or a lock/synchronization block :)

If you need a bit of a confidence and got some spare electricity and stuff, I can suggest to start a fully automated game to build confidence in the game stability. If (when) it eventually crashes, pay attention to the date of the last auto save, my guess is that it will run far longer than you are ever likely to actually play a game. If it even crashes before you get tired of it taking ages and a half to save :)

How to do so? When you start a game, go into menu (escape, top left button, that kind of stuff), options and set Rule in Absentia as your style to quickly get all automated. Then head into Empire Settings from the same screen, and select "Suppress all popups" or something very similar.

It can even be a bit fun to watch poor AI fleet management at times ;-)