Unofficial Patch for 3.19

The loading of the XML is handled in the SDK. I wonder if it would be possible to add something there.

That's a good point. What exactly does it mean to have an atlas? Keep in mind that I am not an artist, but I am a little familiar with graphics files and formats. Is there a tutorial that covers the format those comma-filled strings take and what each piece means?
 
The atlas files contain a ton of buttons all in one file. This is what Firaxis uses; since Warlords they haven't even made stand-alone buttons. For stand-alone buttons, the Button entry looks line this:

<Button>Art\path to file\Stand Alone Button.dds</Button>

When the atlas files are used:

<Button>,Art\path to file\Stand Alone Button (not used for anything).dds,Art\path to file\Atlas File.dds,x location in atlas,y location in atlas</Button>
 
I was wondering why some had a leading , like that. So if there's a leading , the first file is ignored. Very odd, but understandable.

So the problem is when someone uses

Art/Blah/Blah/Blah.dds,

with that trailing comma? Or does the crash happen when the atlas is specified correctly but doesn't exist or has the wrong path/name?
 
Something might happen then, but more common would be leading comma. This is where new modders can be tripped up, as it looks like you can just delete the atlas stuff at the end and not worry about the starting comma. This is compounded by the fact that some art entries will work like that and never cause a crash. In general, if you can build it in a city, it will care about the leading comma.
 
Another two bugs and their fixes:

The first one an be easily added to the unofficial patch if you want.
The second one is present in Civ4 from vanilla version. I found the problem and coded a quick fix, but I think it can be recoded in a easier way.
 
A behaviour that IMO could be tweaked is the liberation of cities. I started this thread and uploaded a savegame: http://forums.civfanatics.com/showthread.php?t=328189

It's related to the relocation of an AI capital when its former capital has been conquered. Sometimes, the new capital selected is the largest AI city, even if it is clearly better to select a smaller city placed on the continent where the largest number of AI cities are.
 
Wow, Arian... this may actually be a source of some CTD's I've had. Going through BBAI 0.75, there are 20 instances of seperate, and 30 instances of separate.

Great find! :)
 
pOldGroup->AI_seperateNonAI(UNITAI_ATTACK_CITY);

should be:

pOldGroup->AI_separateNonAI(UNITAI_ATTACK_CITY);

C++, Python, and most programming languages don't care what you name your variables and functions. If you misspell a word, it only matters that you misspell it when referring to the same function.

You can name a function AI_efhsehfuksekusefknuskfnu() for all the compiler cares. If you refer to it in some place as AI_efhsehfuksejusefknuskfnu(), the compiler will tell you that this second function doesn't exist and not produce a DLL.

Going through BBAI 0.75, there are 20 instances of seperate, and 30 instances of separate.

This would only matter if both of the above spellings were defined as functions in the same class. In that case, the compiler would use whichever one you named. However, I doubt this is the case.
 
There are four main functions dealing with separation, as I see it. They are:

Code:
void CvSelectionGroupAI::AI_separate()
void CvSelectionGroupAI::AI_seperateNonAI(UnitAITypes eUnitAI)
void CvSelectionGroupAI::AI_seperateAI(UnitAITypes eUnitAI)
void CvSelectionGroupAI::AI_seperateEmptyTransports()

They are used differently, of course, but some of code has Firaxis comments that "pointers could become invalid". This is besides the spelling issue, actually (which I no longer think is the culprit of the ctds I've had). How do invalid pointers affect program execution? And would there be a difference in behaviour from XP to Vista? I've had some strange crashes involving unit_ai's that have been extremely difficult to reproduce, but I do have older saves that reproduce ctds. The game setup is extremely simple: Duel maps, two civs not at war. Two AI units in a stack (horseman and catapult), and the game crashes if the catapult has UNITAI_ATTACK_CITY at the end of the AI's turn. Change the AI or remove the catapult, the crash doesn't happen...

Sorry for the OT, this probably really doesn't belong in the UP thread. :blush:
 
Say you have code like:

Code:
void CvUnitAI::AI_someFunction()
{
     CvSelectionGroupAI* pGroup = getGroup();
     pGroup->AI_seperateNonAI(UNITAI_ATTACK_CITY);
     
     a bunch of other stuff
}

After the call to AI_seperateNonAI, the group pointed to be pGroup may no longer be a valid group ... the group may have split, the leader could have been kicked out, etc, so the place that pGroup points to may no longer be a group at all. If your code used pGroup again in this function after the call to AI_seperateNonAI, you'd at best get occasional weird behavior and quite possibly a CTD.

There are quite a few examples of this, where functions create new objects and invalidate previous ones. CvPlayer::acquireCity( CvCity* pCity, ...) is one which springs to mind.
 
Two options: Like a mod, or by replacing the default files. You can check out the BBAI directions, works the same with slightly different names.

If you're using a mod, then things get more complicated. If the mod has a custom DLL, then there's nothing you can do (short of compiling a merged DLL yourself ...). If it doesn't have its own DLL, then you can follow the replacing BTS instructions and probably get most of the changes.

What you really need it to convince the mod maker to merge in the UP.
 
Team score is simple sum of the member player's score.
Player score consists of populations, lands, wonders and techs.

But team tech is shared by all members of the same team.
Therefore, team score counts only one tech more than one times.

A team which includes more than one player has a big advantage in time victory.
Is this a bug?
 
That's a good point denev, it does produce a bias towards teams with more players on them. That said, research costs do scale up based on how many players are on the team

Unfortunately, looking through the code I don't see a robust and easy way to fix this. The score calculation for each player is done in Python so that it's easily moddable. In the SDK function GvGame::updateScore where team scores are calculated, it simply isn't possible to get an accurate tech score number for each player as there are a number of adjustments on tweaks to CvPlayer::getTechScore in Python.

The only robust thing I can see to do is in CvPlayer::getTechScore divide the raw tech score by the number of players on the team. This will in turn cause the individual player scores for any team members to go down because their tech is no longer their own. However, the team score would then still be the sum of the player scores, which makes sense.

Anyone else want to weigh in on this?
 
Once I tried to fix this problem at FfH2 because Basium gived a lot amount of score bonus to host civilization.
This mini mod calls Python function from DLL.
I guess it may not be smart way, but I hope it serves as a reference.
 

Attachments

Another two bugs and their fixes:

The first one an be easily added to the unofficial patch if you want.
The second one is present in Civ4 from vanilla version. I found the problem and coded a quick fix, but I think it can be recoded in a easier way.
I reported the queued order bug over two years ago. It was introduced with Warlords, and did not exist in vanilla up to patch 1.61. I believe the bug was back-ported to vanilla with a later patch, but don't recall exactly.

I haven't played Civ4 in a while, and found this post while reading up on the latest UP for the latest OP. Kind of amusing that such a prominent bug is still there after all this time.
 
Back
Top Bottom