1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Unofficial Patch for 3.19

Discussion in 'Civ4 - Unofficial Patches' started by jdog5000, Jun 12, 2009.

  1. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    The loading of the XML is handled in the SDK. I wonder if it would be possible to add something there.
     
  2. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    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?
     
  3. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    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>
     
  4. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    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?
     
  5. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    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.
     
  6. Pep

    Pep King

    Joined:
    May 28, 2002
    Messages:
    688
    Location:
    Spain
    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.
     
  7. Pep

    Pep King

    Joined:
    May 28, 2002
    Messages:
    688
    Location:
    Spain
    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.
     
  8. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    Thanks for the links Pep, will take a look.
     
  9. Arian

    Arian No more ghostbusting!!

    Joined:
    May 10, 2008
    Messages:
    2,088
    Location:
    The Netherlands
    I think I found a typo in CvUnitAI.cpp:

    In line 2139 IIRC:

    pOldGroup->AI_seperateNonAI(UNITAI_ATTACK_CITY);

    should be:

    pOldGroup->AI_separateNonAI(UNITAI_ATTACK_CITY);
     
  10. Ninja2

    Ninja2 Great Engineer

    Joined:
    Nov 17, 2005
    Messages:
    1,142
    Location:
    Denmarkia
    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! :)
     
  11. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    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.

    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.
     
  12. Ninja2

    Ninja2 Great Engineer

    Joined:
    Nov 17, 2005
    Messages:
    1,142
    Location:
    Denmarkia
    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:
     
  13. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    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.
     
  14. Malchar

    Malchar Prince

    Joined:
    Jun 28, 2009
    Messages:
    499
    Location:
    Saint Paul, Minnesota
    The patch looks great, but I have no idea how to install it. Also, I'm using a mod, so does that make a difference for how I install this?
     
  15. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    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.
     
  16. denev

    denev Warlord

    Joined:
    Jul 5, 2008
    Messages:
    208
    Location:
    Japan
    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?
     
  17. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    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?
     
  18. denev

    denev Warlord

    Joined:
    Jul 5, 2008
    Messages:
    208
    Location:
    Japan
    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.
     

    Attached Files:

  19. Pep

    Pep King

    Joined:
    May 28, 2002
    Messages:
    688
    Location:
    Spain
  20. Thanny

    Thanny Warlord

    Joined:
    Dec 10, 2006
    Messages:
    265
    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.
     

Share This Page