Running the Debug DLL for XML Modders

Thunderbrd

C2C War Dog
Joined
Jan 2, 2010
Messages
29,977
Location
Las Vegas
Reposting this in a new post because this is VERY important for ALL XML modders to know. @DH: Please place a link to this in the modder's documentation thread.


We used to get errors when we'd run the game and the xml was screwed up somewhere. This NO LONGER HAPPENS by default. AIAndy changed the way the game loads data. (And it loads much smoother as a result.)

However, we still recognize a need to be able to easily find these errors. IF we don't find them, we'll have missing items throughout the mod which could cause much bigger problems when something is relied upon elsewhere.



So we now make and include in the mod, in the Assets file, two dlls, not just one.

Now, if a dll file is not named absolutely what it should be: CvGameCoreDLL.dll it will not be the core coding system that will run for the game. If there is no dll file in the assets folder, there's no programming for the game.

So all we must do to disable a dll file without actually harming this core code file in any way is to simply rename it so that the game doesn't find it and run it. Of course there can only ever be ONE dll file in the Assets folder.

So to TEST your XML you MUST load the game under the debug dll rather than the standard one that normally runs.

To do this, we rename the dll. To rename a file, right click on that file name and select 'rename' from the list that pops up. This is standard Windows behavior.

I rename the normal dll, the one in the assets folder named CvGameCoreDLL.dll, to: CvGameCoreDLL.dll.core

Doing this disables that dll since its now not exactly the same name as the core civ execution file is looking for when it goes to run the game. Once renamed, you don't have any game code basically.

Now we take the OTHER dll that's located in the Assets folder and make that the dll the game will run with. This other dll is by default named CvGameCoreDLL.dll.debug. It doesn't do anything when it's named this. It's only named specifically this way (ending in .debug) so y'all will know what its for.

To activate that dll so that the game will find and use THAT set of code, simply rename the debug dll to what the game expects to find: CvGameCoreDLL.dll

This dll (now missing the simple added extension of .debug) is now found as the valid dll when the game goes to run. And it works a little differently.

THIS dll will send you any error reports you may be used to seeing if your xml is flawed. This is because it loads the game under the original set of rules that the old dlls would load by. Without performing this check, you will have potentially a lot of defunct xml code and not even know it, assuming that simply loading the game would've told you if you had a problem as it always used to.

THIS dll is also a LOT slower as it enables a ton of diagnostic checks. That part is where the coders have some insight you don't need to have. You're not running it for that reason anyhow. You're running it so you can get the usual error messages if your xml is flawed so you can find and fix those flaws without assuming everything's been done without any issues.

Therefore, since the debug dll runs VERY slowly, you don't want to commit that dll as the standard dll to be in use - ever. So after you've run your check and resolved any issues in the xml, you must rename it back to CvGameCoreDLL.dll.debug.

Then return the core dll to its standard service for the mod by renaming the core dll back to CvGameCoreDLL.dll (without the '.core' at the end that you put there to disable it.)

Does this make sense why this would be SO very important for anyone doing any XML programming in this mod to understand? Making this a standard 'final check' before committing any new XML will avoid a lot of problems!

NOTE: When renaming sometimes it gives a warning message about how this might cause the dll to become instable yada yada. Ignore that and plow through it. We know what we're doing in the renaming of this thing.
 
So to activate Debug
Rename:

1.CvGameCoreDLL.dll to CvGameCoreDLL.dll.core

2.CvGameCoreDLL.dll.debug to CvGameCoreDLL.dll

Run it to check code before a commit.
 
Thunderbrd said:
We used to get errors when we'd run the game and the xml was screwed up somewhere. This NO LONGER HAPPENS by default. AIAndy changed the way the game loads data. (And it loads much smoother as a result.)
This is how it is, when you don't post what you are currently doing. I am during switching XML loading to xerces library. I don't know, what AIAndy've done, but it is going to be rather unlikely to he could do it better then this library. It is a very experienced one.
 
This is how it is, when you don't post what you are currently doing.
Huh? What are you referring to? This was established almost a year ago now.
 
Huh? What are you referring to? This was established almost a year ago now.
At first I though, you are saying about something new, as the current parsing utils are in quite poor condition, now.

But now, when I am reading again what you wrote, I have a feeling, some part of this poor condition you may refer as an advantage. -- Do you mean, the game do not show error screens when there is something wrong in the XMLs, by "it loads much smoother as a result"? -- It is very bad! When there is something wrong, it should be corrected as quick as possible, not hidden. When there are no screens, you can run a game and think everything is ok, while the game can be actually corrupted.
 
That's what .CvGameCoreDLL.dll.debug is for, its the dianostics/debug dll.
 
That's what .CvGameCoreDLL.dll.debug is for, its the dianostics/debug dll.
It is not good. A player should also know, if the data is corrupted. The information can be less detailed, but it should be shown. If there is no information a player will just play, but after some time, it can appear, he won't be able to proceed. Or after correcting the bug, his saves will not load correctly anymore. So he should have this information to not even start the game.
 
Wow, I love the debug, no more guessing.
Just got the following errors.


4TXwk8W.png


And i love it. I didn't see them before.
 
xerces will add to this a line number and a message what is wrong and validate against schema-s in debug mode (I hope). But, the problem is the c2c's code is a nightmare + the compilation time is like 5 minutes. ... Or more precisely 5 minutes + 5 minutes to run the game. It is like :deadhorse: I just hope I will finish it before going to the hospital.
 
A 5 minute wait to find the error by line is worth it if it's for debug mode.

How long will incorporating Xerces take you, a few weeks or a few months?
 
Wow, it would be a godsend if we could have it in two days, if not no problem
 
By incorporating, I mean getting to a state, where it is working. Not fully operating. I will probably not gonna make the schema validation before leaving.
 
AIAndy did a lot to rework the loading process. I did not question his expertise but it would be interesting if he were to be able to answer some questions you must have about the whys and wherefores of his decision making. He did not make these decisions in a vacuum either but rather did put them to the forum but aside from Koshling's responses he didn't get much in the way of feedback as few of us understand the mechanism he was altering in the first place. Had you been here for that discussion I'm sure y'all could've come to some interesting co-conclusions. It sounds as if you do have some advanced insights into what could be further improved there. But again, I personally have to again rely on trust as I haven't the foggiest how it all works at that stage.

The debug dll method was established to enable xml modders to at least check their work so that nothing should be pushed to the SVN with any major errors. I should've pointed it out AGAIN more recently though as it seems Mr.Azure is only now realizing this thread existed.
 
Thunderbrd said:
The debug dll method was established to enable xml modders to at least check their work so that nothing should be pushed to the SVN with any major errors. I should've pointed it out AGAIN more recently though as it seems Mr.Azure is only now realizing this thread existed.
That is another reason, I can think of, why the release compilation should throw errors. -- I must say, I'm little annoyed by this. It looks like, no one cares about doing the work properly.

Thunderbrd said:
AIAndy did a lot to rework the loading process. I did not question his expertise but it would be interesting if he were to be able to answer some questions you must have about the whys and wherefores of his decision making. He did not make these decisions in a vacuum either but rather did put them to the forum but aside from Koshling's responses he didn't get much in the way of feedback as few of us understand the mechanism he was altering in the first place. Had you been here for that discussion I'm sure y'all could've come to some interesting co-conclusions. It sounds as if you do have some advanced insights into what could be further improved there. But again, I personally have to again rely on trust as I haven't the foggiest how it all works at that stage.
I've been talking with Koshling about it by PM. He agrees to the switch.

The problems with rapidxml parser are, it do not follows the xml's documentation too well, it do not provide good diagnostics and have poor documentation. Yes, It is surely faster then xerces. But we do not have so much xml data. When I read xml-s in python -- which is rather slow -- it takes 20sec, so no, we do not care so much about speed here. I believe, correctness and bug reports are more important. (Taking in account the new encoding errors in Italian translation... I have a feeling, I will shoot someone's head off.)
 
That is another reason, I can think of, why the release compilation should throw errors. -- I must say, I'm little annoyed by this. It looks like, no one cares about doing the work properly.
From what I can see, caring and knowing how are two different issues. I think we've had more of the second here.


I've been talking with Koshling about it by PM. He agrees to the switch.

The problems with rapidxml parser are, it do not follows the xml's documentation too well, it do not provide good diagnostics and have poor documentation. Yes, It is surely faster then xerces. But we do not have so much xml data. When I read xml-s in python -- which is rather slow -- it takes 20sec, so no, we do not care so much about speed here. I believe, correctness and bug reports are more important. (Taking in account the new encoding errors in Italian translation... I have a feeling, I will shoot someone's head off.)
lol... I'll trust your judgement here. :D
 
Don't trust it too much. I also make mistakes as everyone.

Bravo. Your metamorphosis is amazing. Good girl ;)

It is good to hear that we will have good debugger.
It is iimportant to have valid xml files to mass edit them.

Thanks for your hard work.
I wish you all the best and good health.
 
When the move to the new XML loader was made I said that we needed a simple way of getting all the error messages, preferably even more than the civ engine gave us. I was told we would still get the error messages we would just need to set a switch but what I was not told was that it was a switch in the dll compiler and that I would need to make my own copy of the dll to get the messages.:(

The reason for the conversion was speed. The old way is 5-10 slower in turn times.
 
Back
Top Bottom