Bug with modded version of 2 022

Sto

Should i code today ...
Joined
Dec 15, 2005
Messages
1,144
Location
Marseille (France)
For Kael which offered its assistance to correct a bug .

This is a test game to check is AI_Player are able to start the game properly in order to play in MP games . Speed up the game and turn it into a war game only .

Changes :

_ Played with a script that add lots of animals at the beginning of the game (except those that multiplicate)
_ lots of resources
_ some trait added to all players . barbarian , insane , adaptive trait replaced .
_ most wonders are national wonders
_ an orthus guardian for each goody hut (range 8 min)

I wanted to check if i've forgotten something in the changes but my 2 022 installer is broken and i can't download it anymore .

Thanks for your help :) . i've got this bug for 3 weeks and can't be able to fix it .

Tcho !
 
The AI is castign a spell which is causing the spinlock. Im isolating on the spell now.
 
Its being caused by the PyAIWeight check on the crew spells (the ability to change the crew of your ship). To fix it remove the PyAIWeight attributes from the SPELL_CREW_BUCCANEERS, SPELL_CREW_LONGSHOREMEN and SPELL_CREW_SKELETON_CREW spells.

I'll change that in the next patch for 0.23 too so it won't happen anymore.
 
Could you please write a tutorial on how, by having a save, you can pinpoint the cause of a crash if you don't get any python exceptions or such? :mischief:
 
Sure, the general steps are here: http://forums.civfanatics.com/showthread.php?t=175005.

Specific to this event I went through the following steps.

1. Overlayed Sto's changed files on 0.22 to get Sto's build.
2. Loaded Sto's save to verify that the problem was reproducable (it was).

Now I typically start with the "Little Hammer" method, cutting pieces I suspect. Having run through a ton of these Im a pretty good guesser. Spinlocks are usually AI issues so I start with the things that effect AI.

3. I switched from Sto's modified python files (there is only 1, the CvEventManager.py) back to the origional 0.22 file. Reload shows that the issue still occurs, so its not coming from Sto's python files.
4. I would have went to the SDK if Sto had a modified SDK file, but he didn't.
5. I ran some file compares between Sto's XML files and the ones from 0.22. Nothing suspicious.

At this point I have to admit that this is probably a KaelBug(tm). I start with the Spell file. I go into CIV4SpellInfos.xml and remove every entry except the first one. This is an easy trick to do because nothing refers to spells (spells refer to other things) so you can add and remove them at your leisure.

6. The bug doesn't occur with only 1 spell in the spell file, so this is a spell problem.
7. I remove all of the A-L spells. No error.
8. I restore the origional spell file then remove all of the A-E spells. No error.
9. I restore the origional spell file then remove all of the A-C spells. No error.
10. I restore the origional spell file then remove all of the A-B spells. The crash returns, its a problem with a C spell.
11. C spells has a few suspicous characters, the new Call Holy War spell, the Commander Join and Split spells and the Crew spells. Adding them in bit by bit shows the problem, the Crew spells.

Once you know the spell thats causing the problem its pretty easy. The crew spells are one of the few that use pyAIWeight so its the first thing I cut and the error stops. We don't really need that function, it can be rewritten as a part of the requirement, and we are done.
 
Could you please write a tutorial on how, by having a save, you can pinpoint the cause of a crash if you don't get any python exceptions or such? :mischief:
I've done this a few times for my modmod, so:

You need:

1) The save
2) the debugger
3) a build with the debug information (either with the .dll, or separately)

Steps:
1) Run the software normally.
2) Once launched, attach the debugger to the process.
3) If needed, load in the debug information.
4) Replicate the defect.
5) Now, instead of reporting the crash to Microsoft (or ignoring it), enter the debugger.
6) You should now be in the code line that crashed. From this point, any C++ debugger tutorial should help.
 
I like your hammer methods. I'll note that typically if I don't know the source (and have a version where something works, and another where it doesn't), I typically try to keep breaking the diffs into halves. Basically, the idea is to be able to converge on the issue in roughly logarithmic time, even if I have no clue as to the cause of the problem.
 
Its being caused by the PyAIWeight check on the crew spells (the ability to change the crew of your ship). To fix it remove the PyAIWeight attributes from the SPELL_CREW_BUCCANEERS, SPELL_CREW_LONGSHOREMEN and SPELL_CREW_SKELETON_CREW spells.

I'll change that in the next patch for 0.23 too so it won't happen anymore.

Thank you very much :) . We can play now :lol: we were always frightened to not be able to finish the game .

I've also read your tutorial to isolate a crash , this is a great help . I missed it i think .

Tcho !
 
I'm posting here to subscribe to this thread so I can go back and read more about this later. ;)
 
Back
Top Bottom