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

Caveman 2 Cosmos

Discussion in 'Civ4 - Caveman 2 Cosmos' started by strategyonly, Aug 25, 2008.

  1. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,329
    Gender:
    Male
    Location:
    Las Vegas
    Without labeling the numbers more clearly I can't follow what you're tracking.
     
  2. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,329
    Gender:
    Male
    Location:
    Las Vegas
    It's on the SVN. There are still too many imperfections for a new version release at the moment.
     
  3. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,329
    Gender:
    Male
    Location:
    Las Vegas
    @raxo2222
    This is always going to be the case and should not be seen as something to correct. A given building should not be much more powerful than a potential civic or trait and so on but buildings are many. Those selections are few.
     
    raxo2222 likes this.
  4. raxo2222

    raxo2222 Time Traveller

    Joined:
    Jun 10, 2011
    Messages:
    6,317
    Location:
    Poland
    So how strong building and wonder modifiers influence should be compared to civic/trait/property pseudobuilding modifier influence?
    So if latter is +50% total, then former can be +200%?
     
  5. Anq

    Anq Prince

    Joined:
    Apr 14, 2019
    Messages:
    351
    Gender:
    Male
    Location:
    Anser (geese) HQ
    I mean the individual progress for each type of GP that can be accessed in WB. I learn from source code that it's a different thing that doesn't add up together as GP points.
     

    Attached Files:

  6. Niveras

    Niveras Prince

    Joined:
    Dec 28, 2006
    Messages:
    360
    Now that you mention it, I've noticed a similar thing. After my faulty report regarding the intersection of Divine Prophets and Limited Religions (Divine Prophets prevents the automatic founding of a religion upon researching the tech, while Limited Religions prevents you from receiving the free great prophet from Divine Prophets), I changed all the specialists in my cities (or at least the major ones that might produce a great person) to priests. But it seems stuck at 99% engineer, 1% prophet, and various 0% other things. The first time, I chalked it up to being too late with the switch and and that the contribution to Great Prophet progress didn't accumulate enough to alter the chance. Likewise with the next city (a different one) remained at 99% (despite about a dozen priest specialists) even though it took some turns before it spawned its great engineer. As it is now building progress toward a third Great Person, all cities remain at 99% engineer and 1% prophet, so I was starting to get suspicious.

    I think what he's saying is that a Great Doctor spawned, on the next turn - despite 0 doctor specialists in the city - he accumulated 1808 great doctor "progress" toward the next GP. Meanwhile, the same city having 30 priests, accumulated only 89 "progress" toward a great prophet. So the Great Doctor progress is vastly outpacing the Great Prophet progress, despite 0 doctors and 30 priests.

    I should double check whether any of my traits are contribution Great Engineer points.

    Edit: Yes, I have Industrious, which contributes +2 Great Engineer in each city, just as Ang's post has Medical, which contributes +2 Great Doctor, and later Spiritual, which is +2 Great Prophet. Seems likely that the great person points from Complex Traits is being multiplied or otherwise contributing more than it should.
     
    Last edited: May 2, 2019
  7. raxo2222

    raxo2222 Time Traveller

    Joined:
    Jun 10, 2011
    Messages:
    6,317
    Location:
    Poland
    I think some civics/wonders/buildings also produce GP points by themselves or give free specialists too.
     
  8. Niveras

    Niveras Prince

    Joined:
    Dec 28, 2006
    Messages:
    360
    But it is a recent problem, where as free specialists (and their GP) and GP from buildings have existed for a long time without overwhelming the great person pool. I wouldn't have suspected great points from traits necessarily, but it is also highly convenient that the excessive GP pool/balance (I don't think it is affecting actual GP rates) matches the GP gained from the traits. In addition, while I have received a few non-engineer GP in my game, and I bet they were all from before I adopted Industrious as a trait.
     
  9. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,329
    Gender:
    Male
    Location:
    Las Vegas
    I can't even imagine trying to establish an acceptable ratio. How many buildings can give a +% modifier to research? How many traits can a player have that would? How many civics? I'm sure you can get a lot more from buildings than you can from either civics or traits, partially because there is no limit to how many buildings you can build, outside of the limit of what has been made available to build.

    I think trying to compare the three is a pointless measurement to look at. It is much more important to look at making sure progressions on buildings are not only as gradual as they really can be, with some understanding for some buildings being intended to be impressive and thus curve breaking, constantly improving throughout tech advances, and not too abnormally overpowering.

    Balance each of those noted sources independently - they don't have to compare directly to each other but rather to the other options among their category. Civics should be balanced against other civics, traits against other traits, buildings against other buildings, with some expectation that with greater technology comes improvements over the earlier things.
     
  10. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,329
    Gender:
    Male
    Location:
    Las Vegas
    That's what it's sounding like. Not sure how that's taking place but I'll look for it. An extra source of +2 in each city should't be too overwhelming.
     
  11. Anq

    Anq Prince

    Joined:
    Apr 14, 2019
    Messages:
    351
    Gender:
    Male
    Location:
    Anser (geese) HQ
    @Niveras, @Thunderbrd,

    Two observations:
    1. Recalculating by Ctrl-Shift-T is helpful, it resets the great person rate for doctor back to 2.
    2. Triggering leader trait recalculation by Alt-Z switching leader and Shift-Alt-Z switching back does NOT help.

    I assume that cities store their great people rate for each type, and do only increments and decrements on them, thus when the stored values go wrong, a recalc helps.

    From reading the source code, I learn that recalculateModifiers() basically clears some cached data, resetting the GP rates for instance; then, cities recalculate the GP rates values from own buildings and specialists. I find two methods CvCity:: processBuilding and CvCity:: processSpecialist are the only ones to modify the GP rates property. These codes are never changed. And these two are rather simple, to just modify (add or subtract) the GP rate by the number defined for the building or specialist passed in as argument, nothing else. So it is either the data fed from XML got changed, or that other uses of these two "process" functions cause the problem.

    The XML data of buildings that modify great person rates are seldom changed, and my last game started in SVN 10564, which was the latest. So now I'm trying to spot the smoking gun among the many functions that call CvCity:: processBuilding and CvCity:: processSpecialist.
     
    Last edited: May 2, 2019
  12. Johnny Canuck

    Johnny Canuck Warlord

    Joined:
    Sep 23, 2010
    Messages:
    141
    For the Farm - Crop and Camp series of buildings, what if the +1 :gold: is replaced with another :food:? This would help reduce a bit of the gold in the game and the extra food would help with the slower growth curve.
     
  13. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,329
    Gender:
    Male
    Location:
    Las Vegas
    Good analysis. That's where I would look first as well and I'd be a little confused by finding what you have found.

    The data from the XML is very unlikely to have changed and the recalculation pulling on that to correct things suggests this is not suspect.
    Uses of the process function may not be the issue either.

    Found it - and fixed another small bug in the process that wouldn't allow no GP to be defined and still have an impact - I believe I programmed the XML to have a +GP pts without any GP type definition on one occasion somewhere.

    Here's the issue:
    Code:
    
    int CvCity::getGreatPeopleUnitRate(UnitTypes eIndex) const                                                                 
    {
        FAssertMsg(eIndex >= 0, "eIndex expected to be >= 0");
        FAssertMsg(eIndex < GC.getNumUnitInfos(), "eIndex expected to be < GC.getNumUnitInfos()");
        int iTotalGreatPeopleUnitRate = 0;
        iTotalGreatPeopleUnitRate += m_paiGreatPeopleUnitRate[eIndex];
        iTotalGreatPeopleUnitRate += GET_PLAYER(getOwnerINLINE()).getNationalGreatPeopleUnitRate(eIndex);
        return std::max(0, iTotalGreatPeopleUnitRate);
    }
    
    
    void CvCity::setGreatPeopleUnitRate(UnitTypes eIndex, int iNewValue)                                         
    {
        FAssertMsg(eIndex >= 0, "eIndex expected to be >= 0");
        FAssertMsg(eIndex < GC.getNumUnitInfos(), "eIndex expected to be < GC.getNumUnitInfos()");
        if (GC.getGameINLINE().isOption(GAMEOPTION_NO_ESPIONAGE) && GC.getUnitInfo(eIndex).getEspionagePoints() > 0)
        {
            return;
        }
    
        m_paiGreatPeopleUnitRate[eIndex] = iNewValue;
        FAssert(getGreatPeopleUnitRate(eIndex) >= 0);
    }
    
    
    void CvCity::changeGreatPeopleUnitRate(UnitTypes eIndex, int iChange)                                     
    {
        setGreatPeopleUnitRate(eIndex, (getGreatPeopleUnitRate(eIndex) + iChange));
    }
    This will be fixed on the SVN so I'm not explaining this to anyone to debug it for themselves but just for the sake of discussion.

    getGreatPeopleUnitRate adds both the city's native GP pt rate (accumulated by local effects like buildings and specialists) to the national level rate that applies to all cities (iTotalGreatPeopleUnitRate += GET_PLAYER(getOwnerINLINE()).getNationalGreatPeopleUnitRate(eIndex);)

    On it's face this seems fine BUT when the changeGreatPeopleUnitRate (which is often called whenever a specialist is assigned or unassigned or a building with a gp rate is added or removed) is called, it calls setGreatPeopleUnitRate, adding the change intended to the local rate to the total city rate. The TOTAL city rate, which also includes the National rate. Thus the national rate and flavoring gets added each time a change is made. The more the player adjusted things, the worse it got.

    The fix is to simply change this line in changeGreatPeopleUnitRate:
    setGreatPeopleUnitRate(eIndex, (getGreatPeopleUnitRate(eIndex) + iChange));
    to
    setGreatPeopleUnitRate(eIndex, (m_paiGreatPeopleUnitRate[eIndex] + iChange));

    Thereby only tallying into the local city variable local city sources and not continuously compiling in the additional player level amount with each change call.


    eek! That's a tough one to spot!
     
    Anq likes this.
  14. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,329
    Gender:
    Male
    Location:
    Las Vegas
    I would support that, particularly now that food is more challenging.

    @JosEPh_II

    I refer this comment to you because you're working on civics. You may want to consider how some civics represent the application of subsidies and we here in the States know well that a lot of budget goes towards farm subsidy programs. Do we have a tag that can adjust the output of a building by a civic selection? Could a farm subsidy make 'farm' buildings -1 gold but maybe an additional +1 food? If we can't do it directly, I bet an autobuilding generated by the civic for the capital could do it with some of the global tags that I know wonders use.

    There could be a lot of other ways to curb gold like this throughout the civic designs. Much of civics is about how and where things are being budgeted so it seems to be a good place to hit players with this stuff, and since civics also can represent improved ways to process wealth and be a big reason for gold suddenly being very forgiving, its another cause to find gold balancing measures from within civic structures - one civic may be strongly penalizing in gold but worthwhile if you've taken another one that opens up around the same time that makes it affordable to use.

    Just thoughts - trying to be helpful.
     
    Last edited: May 3, 2019
  15. Anq

    Anq Prince

    Joined:
    Apr 14, 2019
    Messages:
    351
    Gender:
    Male
    Location:
    Anser (geese) HQ
    Great find! Thanks for the explanation, so for instance, if I have national +2 from spiritual and call Change(Priest, +3), it brings up Set, and then Get, but the Get is no faithful representation of the variable, it mutates it in the process! The national modifier shouldn't have been counted toward a local city variable!

    Regarding the fix, I think your fix is very correct to the general get-set grammar. Here, I suppose the Get method be fixed too:
    Instead of spicing the return value, just do what a get means to do, fetch the variable.

    Then, the intended functionality can be added back in one line in CvCity:: doGreatPeople
    Search getGreatPeopleUnitRate, find it where it used to be -
    - and add the national modifier here: (The former code takes eIndex, here we adapt it to take iI.)
    And that's all done. :goodjob: Thanks again for sharing details and explaining!
     
    Last edited: May 3, 2019
  16. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,329
    Gender:
    Male
    Location:
    Canberra, Australia
    There are many buildings that give GP points but don't specify what GP they go to. This should be fine from the building perspective. It should just be possible to give general points without limiting them to a particular GP. They provide points towards the total needed but are not part of the equation when choosing which GP is generated. The specific GP points are used to randomly create a GP based on the percentages of specified GP points. After the GP is created the counts go back to zero.

    Hopefully this is not changing.
     
  17. Anq

    Anq Prince

    Joined:
    Apr 14, 2019
    Messages:
    351
    Gender:
    Male
    Location:
    Anser (geese) HQ
    The traits that don't specify a GP unit type are the Philosophical, and its opposite, the Populist.

    @Thunderbrd,

    For such a trait as Philosophical, which adds a plain GP point bonus but does not specify any GP unit class, the getGreatPeopleUnitClass() will return NO_UNITCLASS.
    The previous code seems to handle NO_UNITCLASS (but doesn't resolve.) As with the new code (rev. 10566), this guard is gone, but for Philosophical, it's simply passing NO_UNITCLASS into changeNationalGreatPeopleUnitRate(), which it doesn't expect to see.

    There needs to be a Base (general, gross) GP rate in CvPlayer, as in CvCity, to keep track of such modifier, and some more code to use it.

    But the real question is - on the extreme, one city in an early era may not have any specialist at all. Should a city start to accumulate GP points even though it doesn't mean to?

    Further, as we save just enough general GP progress to warrant one, how does it determine which GP we get, just randomly? On the other hand, it also possibly enables a crooked strategy: while the general GP points accumulate, we don't appoint a specialist or build particular buildings until we are about to max the gross GP progress. The next turn, we have exactly the type of GP we wanted.

    The solution is to, in addition to the general bonus, spread it out evenly, toward every type of GP, while we don't have to divide the bonus into 12 parts - every unit class still receives +2 or so and it's working as normal; more properly, even.

    But last question is, how about those later-era GPs, like great statesman, detective, and admiral? Do we want to promote every possible great person from the late game, as early as one can choose a Philosophical trait?

    @Dancing Hoskuld ,

    As per your opinion, which one is better -
    1. spread the points evenly to every great person type.
    2. add 0 instead, and if the pool is all zeroes when general GP progress max out, still choose randomly, probabilities equal.

    I can think of a case. We appoint a priest (+3) on the last turn before a GP is born. If it is the first way, the pool is already filled very deep and evenly, so a +3 does not bias the result to any degree. If it is the other, then we can effectively get a great prophet, hence the crooked strategy. Is it better to allow such strategy? Or we should tell the player, "reap what you sow."

    I read your post again and think that you agree with the first.

    ========

    I don't find any building with GP point that doesn't specify the GP type, so the issue with Philosophical may be new to C2C...
     
    Last edited: May 3, 2019
  18. raxo2222

    raxo2222 Time Traveller

    Joined:
    Jun 10, 2011
    Messages:
    6,317
    Location:
    Poland
    Well there are commerce modifiers in civics, that I changed but then reverted it since you were already taking care of it.
    Code:
    <BuildingCommerceModifiers>
                    <BuildingCommerceModifier>
                        <BuildingType>BUILDING_STATUE_OF_ZEUS</BuildingType>
                        <CommerceModifiers>
                            <iCommerce>0</iCommerce>
                            <iCommerce>20</iCommerce>
                            <iCommerce>0</iCommerce>
                            <iCommerce>0</iCommerce>
                        </CommerceModifiers>
                    </BuildingCommerceModifier>
    </BuildingCommerceModifiers>
    But there aren't building yield modifiers in civics.
    That is civics can't adjust :commerce::hammers::food: modifiers in buildings.
     
  19. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,329
    Gender:
    Male
    Location:
    Las Vegas
    The difference is about what the get is used in. When it is used in the city help screen parsing, it's easier to have the 'spicing' from the player level data included. Either solution is valid but your approach then adds another step in the text generation. I don't ascribe to the need for the get command to be equivalent to 'give me the local variable only'. Especially within the same document where you can simply call the local variable. The set command should never be calling the get function anyhow, but instead be referencing the local variable, since that is uncorruptable and legally accessible. Get can be then safely used for totals for whatever original purposes it was used for elsewhere in the code.
     
  20. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,329
    Gender:
    Male
    Location:
    Las Vegas
    Actually I was making another move in support of continued enabling of what you're saying. The offhanded 'bug' was that it was impossible in traits to set a GP pt change without specifying which type that change applied to and I removed that restriction. Without first qualifying with a 'type' definition, any amount used to change the GP rate would be ignored. This only applied to traits - didn't look into how it's set for buildings but that should be working properly there as well since I did look into making sure of that a while back iirc.
     

Share This Page