whos gonna help me with my new mars mod?

keldath

LivE LonG AnD PrOsPeR
Joined
Dec 20, 2005
Messages
7,578
Location
israel
hi,

im making a new mars based mod, calling it, red horizon.

ive done substantioal work, got it all, civs, units, buildings, superb terrain arts, a map.

but some help would be nice.

also, i have a ctd now that ive spotted, and i hjave some trouble pointing the bug.

so anyone out there who still interested in modding and wishes to assist?
 
Isn't there already a Mars mod? Regardless of what other mods exist, I wouldn't mind playing this one once it's playable.

I could take a look at the CTD, particularly if you have a savegame, which triggers it each time you load and do something like end turn. I'm not going to get involved modding this mod. However I view identifying the cause of a CTD not to be modding as such because it's not about having a vision and implement it with graphic, xml data and perhaps a bit of DLL/python coding. In other words a good modder is a jack of all trades. However debugging CTDs is an expert demanding task. In other words, you don't need a modder, you need C++/debugger specialist, which is where I come into the picture.

Do you have the code on a git or svn server somewhere?
 
hi dear nightinggale,

theres the mod - mars , now, a really old but good one.

first off, again , i thank you for giving me some attention :) thats nice.

and yup, you are current, i do need a specialist :)
i understand not getting involved in modding, thats fine of course.

if you can assist me in the debugging, that will be most generous of you,
i will upload here everything you need, the dll code, a few saves just a turn before the ctd.

thank you so much :)


alright here it is:

http://www.filedropper.com/conquestofmars


i tried to debug my self, didnt succeed, there are a bunch of assert errors as well , dont know what to do with them...
 
hehehe yeah, each time i get a mod, sometimes im not happy with the final result and
i get the vibe to use another subject.

this time, i actually converted my song of the moon 2, since it was never a real mod, i thought maybe work on the moon, but then i saw the movie , the martian, and i went with mars mod.

ive made a new great redish terrain, far nicer then barsooms....


i guess what i like the most on civ4, is the modding :)

and yeah, modding never ends :)
 
Modding, Modding Never Changes...

As ever you are welcome to mine FTTWs Source Code. We think it is stable now. Just some functions do not quite work...right...

I have Flitz slowly tapping away at it to see if he can make some of the more important ones bloom.

The whole thing was rebuilt and overhauled by Archid though. Very Fancy!
 
ahh how nice to know,
maybe ill take a look then, thanks my good friend.

ive added some more stuff into my dll code, so once ill get first version on the air, youll be able to look at it, unless you want i can send u just the dll for now.
(ive added some dune stuff - like forbidden religion).
:)
 
As ever you are welcome to mine FTTWs Source Code.
The same goes for M:C. Colonization is essentially a major BTS mod and as different as it may seem, lots of code is more compatible than most modders are aware. I have used plenty of BTS code and I know both FTTW and RoM has code originally written for M:C.

This offer is a general one as inspiration and code sharing between mods is the way to go. Just tell me if you are interested, both because I might be able to say something useful and because I would like to know if my code spreads.
 
I GET A CTD HERE :


inline bool FVariableSystem::GetValue( const char * szVariable, int & iValue ) const
{
FVariable * pkVariable;
VSIteratorC iIterator;
iIterator = m_mapVariableMap.find ( szVariable );
if ( iIterator == m_mapVariableMap.end())
{
return false;
}
pkVariable = iIterator->second;
assert( pkVariable->m_eType == FVARTYPE_INT );
iValue = pkVariable->m_iValue;
return true;
}

ANYONE KNOWS WHY?
 
My guess is that you have a NULL pointer, which mean there are two candidates.
Code:
pkVariable = [B]iIterator->[/B]second;
assert( [B]pkVariable->[/B]m_eType == FVARTYPE_INT );
Both bold parts would CTD in case of the vars being NULL pointers and there is no check for them.

PHP:
iIterator = m_mapVariableMap.find ( szVariable );
That can be problematic too depending on content of szVariable. I imagine that could go wrong too if it is a NULL pointer.

Try add FAssert(var != NULL) on each line before it's used. If nothing else, it tells which one is the culprit. If possible, use the call stack to figure out where it calls with the wrong arguments.

FVariableSystem is poorly coded btw. It's full of warnings, which are hidden by compiler settings. GCC can't even compile them as it treats those warnings as errors because it actually use undefined behavior. It seems to work so far, which mean that's likely not the cause here, but you never know.
 
hard, its hard, i try to debug, i did had a success before, but this time , i cant understand on which file to look for which error,

frim what your saying - i could have inserted something with a null value ? maybe a >< in the xml?
or perhaps i inserted a char instead of a num?


exploring the "call stack" does not help since i see nothing familiar, no xml reference or a familiar terms, like buildings, units and such.

any more suggestions? its hard one for me to crack.
 
exploring the "call stack" does not help since i see nothing familiar, no xml reference or a familiar terms, like buildings, units and such.
I hate when that happens. I will try to debug this, hopefully within the next 48 hours. What do you do to make it crash? Something specific or is it completely random?

You said it asserts too. Maybe understanding those asserts is the key to understand what goes on here. There is some bogus data, which is prone to trigger asserts. Ignoring those can likely make the game feel like it's working until it suddenly crashes.
 
thanks man, im uploading the latest version again now.

ill attach a save game as well right before the crash - turn 212.

the game runs on auto ai,, for testing, so pressing on next turn will run the game - turn 213 is the ctd.

seems i recreated the crash on several trials so it is the same one each time.

some of the asserts, i know of, its some stuff from the python and some are due to the auto ai.


link: http://www.filedropper.com/mars-ctd

edit:
the sdk source files provided in the mod are the wrong ones, ill upload the current ones to correlate with the dll file in the mod.
and here it is http://www.filedropper.com/cvgamecoredll-2
 
sure no problem! your so kind yo update me on the matter !

i have been spending every minute i have in the past 2 days with vc2008 trying to debug with zero success....




****

edit:

see private messeges,
if you see this before -
link for the mod + save http://www.filedropper.com/mars-ctd ( i think you might have missed it, it was above)
link for the currect sdk - http://www.filedropper.com/cvgamecoredll-2 (which you already downloaded)
(see that the download link it the one in the middle, after click on the dl grey tab, you get a code you need to enter).
the reason for the separate sdk link, is because in the full mod link, theres a cvgamecoredll folder, which contains 1 version earlier then the actaull dll i used to get the ctd (thus - the second link).


i must say, that, right now, your my only hope for saving my mod, otherwise, i ll have to rebuild the mod from total scratch, which will take me ages........:(

thanks for any thing you may come up with.


**edit:
alternative links - http://www.filedropper.com/cvgamecoredll-2
https://www.mediafire.com/?lz2r0cj2nn7pozq
 
I found the cause of the crash.
CvCity.cpp line 2415
CvCity::canConstruct()
Inside the //Shqype Vicinity Bonus block
Code:
CvPlot* pLoopPlot = plotCity(getX_INLINE(), getY_INLINE(), iI);
if ([B]pLoopPlot != NULL &&[/B] pLoopPlot->getBonusType() == kBuilding.getPrereqVicinityBonus())
Add the bold part and not only will it avoid the crash, it will even work as intended.

The issue is plotCity(). It is used to loop all plots within reach of the city, and the code works for this purpose. However if the city is close to the edge of the map, it can loop through plots outside the map. If that happens, NULL is returned. However the code assumes the plot pointer not to be NULL. In the savegame, a city is too close to the edge, which generates a NULL pointer, which in turn crashes the game.

The fix is quite simple. C++ has lazy boolean checks. If (A && B) will only check A and if A is false, then the result is false regardless of B, meaning the call to B is skipped. That is quite useful knowledge for two purposes. Here we have if (A != NULL && A->crashIfNULL), which effectively avoids the crash as the crash condition can't be reached. The other is that if there is a slow and fast check, put the fast one first to avoid spending ages on a slow check, only to discover the fast one failed.

The gameplay result of this fix will make the code work as intended. The goal is a bool check to see if a specific type of bonus is within reach. By skipping NULL plots, it is assumed NO_BONUS on those plots.

General rule: always consider if a pointer can be NULL before using it!
If you think the pointer can't be null, make an assert check to see if you assume correctly.

Also I would recommend upgrading to Makefile 2.5. There you can make an assert build, which is nearly as optimized as release, but it triggers asserts like a debug build. That's quite useful for auto play to see if you get the game to run assert free. Also adapting that Makefile 1.0 to my system took me longer than it took me to find the bug once I managed to finish compiling the debug DLL. Makefile 2.5 should be a bit easier to move from one system to another.
 
Back
Top Bottom