Advertisement
Civilization Fanatics' Center  

Welcome to Civilization Fanatics' Center.

You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support.

Go Back   Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - SDK/Python

Notices

Reply
 
Thread Tools
Old Feb 26, 2008, 02:49 AM   #1
avain
(key)
 
avain's Avatar
 
Join Date: Jul 2006
Location: Budapest, EU
Posts: 2,770
Debugging loading errors/CTDs

Hi all!

I'm writing here in a hope that I can gather some useful ideas as to how to debug a CTD that happens during loading a saved game.

The situation is the following:
- I'm doing a massive modpack that involves a lot of SDK and Python changes (Quot Capita mod)
- When starting a new game it can be played, loaded, etc. without problems.
- When exiting and reentering Civ, and trying to load a saved game one of the following happens:
a) It loads ok. I can load it several times afterwards, no problem.
b) It loads ok. After loading, I try to load it again, there is a CTD

I didn't get a Python exception.

Can this be a memory leak?
Did you have similar problems?
How can this one be traced and debugged?

Thanks for helping.

Last edited by avain; Feb 26, 2008 at 05:50 AM.
avain is offline   Reply With Quote
Old Feb 26, 2008, 07:19 AM   #2
Kael
Deity
 
Kael's Avatar
 
Join Date: May 2002
Location: Ohio
Posts: 17,392
I would ping TAfirehawk about it. He leads the Visa mod and they have doen a ton of working getting around the MAF (memory allocation failure) errors with large saves. As I recall that was a crash during saves, not during loads but I may have that wrong.

You don't mention if you are on BtS or not. If your not I would highly reccomend you move to the BtS codebase to help with this issue (they rewrote the save process).

A few questions:

1. Do you sometimes get a crash and sometimes get a good save off of the same save game?

2. Do you get crashes off of tiny save games (say a new map at duel size)?

3. What is the filesize of save games that cause crashes when they load?

4. How much memory does your computer have?

5. What Civ version / patch level are you using?
Kael is offline   Reply With Quote
Old Feb 26, 2008, 08:40 AM   #3
avain
(key)
 
avain's Avatar
 
Join Date: Jul 2006
Location: Budapest, EU
Posts: 2,770
Quote:
Originally Posted by Kael View Post
I would ping TAfirehawk about it. He leads the Visa mod and they have doen a ton of working getting around the MAF (memory allocation failure) errors with large saves. As I recall that was a crash during saves, not during loads but I may have that wrong.

You don't mention if you are on BtS or not. If your not I would highly reccomend you move to the BtS codebase to help with this issue (they rewrote the save process).

A few questions:

1. Do you sometimes get a crash and sometimes get a good save off of the same save game?

2. Do you get crashes off of tiny save games (say a new map at duel size)?

3. What is the filesize of save games that cause crashes when they load?

4. How much memory does your computer have?

5. What Civ version / patch level are you using?
First, Kael, I'm really happy you responded, thanks once more!

Yes, I'm on BtS, 3.13. Also, I'm aware of the MAF problem with large saves, but that's not the case here (although I'd like to know a solution to that issue, too - but it was, at least for me, not related to the loading-saving process)

1. Exactly, that's the most frustrating. It seems the saves are 'OK', they just sometimes fail to load. As if Civ itself is in an OK state to load multiple times the savegame, or to break after the first succesful load -> reload.

2. Yes, it is independent of map size, save size.

3. Any or not relevant.

4. 2 Gb. (Vista)

5. BtS 3.13

Also, I had a chance to test the mod on a different machine with 1Gb, it produces the same symphtoms. Also, it was an XP and I got civ crash report after exiting civ (so not via CTD, but normally). Not so in Vista.
avain is offline   Reply With Quote
Old Feb 26, 2008, 09:32 AM   #4
Seven05
Emperor
 
Join Date: Dec 2005
Location: St. Charles, IL USA
Posts: 1,808
What compiler are you using? If you're using Visual Studio (2003 or 2005 express) and you enable the crash dump in your civ4 ini file you can open up the dump file in visual studio. Unfortunately you won't have the symbols for any of the files except the GameCoreDLL but you'll be able to see if the most recent calls were in your DLL and if so which method was running.

My experience with failed load games have all been related to XML changes or not doing a clean build of the DLL after changing header files (especially enums). However, in those cases it failed to load any game and was always after I made changes.
__________________
________________________________________________
FfH Map Script:Erebus Continent
Fury Road Map Scripts: Fury Road Unofficial Map Pack
Seven05 is offline   Reply With Quote
Old Feb 26, 2008, 09:50 AM   #5
avain
(key)
 
avain's Avatar
 
Join Date: Jul 2006
Location: Budapest, EU
Posts: 2,770
Quote:
Originally Posted by Seven05 View Post
What compiler are you using? If you're using Visual Studio (2003 or 2005 express) and you enable the crash dump in your civ4 ini file you can open up the dump file in visual studio. Unfortunately you won't have the symbols for any of the files except the GameCoreDLL but you'll be able to see if the most recent calls were in your DLL and if so which method was running.

My experience with failed load games have all been related to XML changes or not doing a clean build of the DLL after changing header files (especially enums). However, in those cases it failed to load any game and was always after I made changes.
Thanks, I might try something along those lines.

The only thing that discourages me is that the thing WORKS most of the time, but then it suddenly fails. I mean, I start Civ say 10 times, and try to load exactly the same save. The first load is ALWAYS ok, the second either fails, or it's ok for the time being.
What can I do when it works 50% of the time (same save), and it concerns loading?...

I just found a better wording for the error: Loading from the Main Screen is 100% ok, loading the same from the loaded game fails 50% of the times (but if it's ok, I can load it seemingly infinite times again and again).

PS: I really appreciate all your help!

Last edited by avain; Feb 26, 2008 at 10:08 AM.
avain is offline   Reply With Quote
Old Feb 26, 2008, 03:12 PM   #6
Kael
Deity
 
Kael's Avatar
 
Join Date: May 2002
Location: Ohio
Posts: 17,392
Intermittant problems are the worst. I really can't think about what would be different between 2 saves of the same game that would cause occasional crashes during load.
Kael is offline   Reply With Quote
Old Mar 03, 2008, 06:38 AM   #7
avain
(key)
 
avain's Avatar
 
Join Date: Jul 2006
Location: Budapest, EU
Posts: 2,770
Well, I tried with Visual Studio:
- resource sharing violation, at seemingly different places
- also, not surprisingly, a null pointer afterwards...
- and of course, cannot trace it really, because it ends in the exe...

What I've seen thou, is that most of the times it's related to deleting/freeing up arrays, might be coincidence thou...
avain is offline   Reply With Quote
Old Mar 04, 2008, 05:58 PM   #8
Seven05
Emperor
 
Join Date: Dec 2005
Location: St. Charles, IL USA
Posts: 1,808
When debugging you should also look several steps back (at least three) to get an idea of what started the chain reaction. I had a consistent game crash on turn 3 using newely created gamespeeds, looking at the dump file it was pointing to errors in the exe but about 4 or 5 calls back there was a reference to the interface and when I looked into that it was the turn number/calendar display and it turns out my fatal CTD was caused by using 'non-standard' values for the number of months per turn (like 9, 13, 22)... fancy that, an XML error

It will normally be a wild goose chase, followed by a forehead slapping 'duh' moment of enlightenment.

Now, if it is an error with your arrays have you added any? And if so do you create & destroy them in the same methods as the original game uses for their arrays? Or, have you altered the way objects are created, initialized, reset or destroyed? Or perhaps you've added in code that is interfering with the default destructor, or overriding it, or terminating at the wrong time and preventing the destructor from being called (or finishing) thus triggering the crash. Could be pointers too, Civ4 is riddled with pointers and misusing them can be hard to trace since you're likely pointing to data it just isn't the right data.
__________________
________________________________________________
FfH Map Script:Erebus Continent
Fury Road Map Scripts: Fury Road Unofficial Map Pack
Seven05 is offline   Reply With Quote
Old Mar 05, 2008, 01:27 AM   #9
avain
(key)
 
avain's Avatar
 
Join Date: Jul 2006
Location: Budapest, EU
Posts: 2,770
Now at least I have a consistent error on a 2nd load attempt.
The debug points at an isBusy call (I'm not at home, so cannot check now) in I guess CvUnit.cpp, which fails I think because the unit's <this> is a null pointer(?).
Also, I checked the call stack back as long as I could, one strange thing is that there's a malloc call on I guess CvGame(?), and the size variable is a really big one (like 1 222 222 222), also, I've seen a read call have the stream pointer altered after the call (if the sequence is correct), prior to calling it seems like ok, after it it's like 0ffffffffff.

I believe I'm using arrays in civ fashion, but the next step will be that I'll try disabling the custom writes and reads to the savegame, and check if the error returns...

I cannot rule out XML errors, since this error seems to happen in the late(r) game saves, just started games load ok 2 times in a sequence...

Last edited by avain; Mar 05, 2008 at 01:31 AM.
avain is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - SDK/Python > Debugging loading errors/CTDs

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML Errors when Loading Alzibiades Civ4 - Bug Reports 11 Jan 20, 2008 07:36 PM
Lagging performance on recomended PC - No CTDs, BSODs or errors otherwise Purest Warrior Civ4 - Technical Support 5 Jan 28, 2006 07:49 PM
Loading Errors and Tutorial Crashing snoopsbme Civ4 - Technical Support 0 Jan 01, 2006 10:25 AM
Auto save loading errors Ur Mum Civ3 - Technical Support 2 Apr 05, 2005 03:30 PM
Graphical errors, PCX errors...etc gear theory Civ3 - Technical Support 12 Aug 28, 2004 05:09 AM


Advertisement

All times are GMT -6. The time now is 01:05 PM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
This site is copyright © Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR