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

Missionary Limit Discussion

Discussion in 'Rise of Mankind: A New Dawn' started by os79, Aug 17, 2010.

?

Which limiting functions for missionaries would be most helpful to AI?

Poll closed Aug 21, 2010.
  1. Default RoM National limit of 3

    28.1%
  2. 5-7 National limit

    28.1%
  3. 10 National limit and 1:gold:/turn cost

    34.4%
  4. Other (please specify in a post below)

    9.4%
  1. os79

    os79 Deity

    Joined:
    Mar 14, 2009
    Messages:
    3,094
    Location:
    Eastern USA Coast
    To avoid cluttering up Bug Report and Feedback thread, I'm setting up a new thread to discuss how to limit missionaries.

    I have a poll above as well.

    Basically, you should vote whether:
    • Missionaries should be limited to default low # of 3 and no gold cost
    • Missionaries should be limited by 5-7
    • Missionaries should be limited by 10 with 1:gold:/turn cost
    • Other...

    If a vote is for Other, please explain yourself. Also, if overwhelming # of voters want Other, then you need to wait for Afforess' decision on that.
    Otherwise, other options can be tweaked by me into SVN for future patch.
     
  2. jfuesting

    jfuesting Chieftain

    Joined:
    May 30, 2004
    Messages:
    56
    I voted for the 10/+1, but if it's possible, the AI shouldn't build more missionaries than there are cities without that respective religion. Also, if it's automated missionaries are idling, it should be deleting them down to a small handful.
     
  3. volus

    volus Chieftain

    Joined:
    Aug 1, 2010
    Messages:
    6
    I voted for 10/+1 as the best choice, but my actual preference would be as-is with an AI correction.
     
  4. JosEPh_II

    JosEPh_II TBS WarLord

    Joined:
    Jun 20, 2007
    Messages:
    16,396
    Gender:
    Male
    Location:
    Western IL. cornfields
    I vote for returning to the RoM 3 limit and No gold cost.

    10 with 1 gold/turn means that the AI will build 10 missionaries costing it 10 gold a turn every turn because every time it uses a missionary it will build another to replace the used one. This is a major hindrance to the AI. Tack a 10 gold/turn onto your early game and see how hard it becomes for you to grow, defend, research etc. It's another AI Handcuff.

    AND already has way too many items that eat gold at a prodigious rate. It's become a "mantra" around here that having a healthy gold balance is "bad". But the AI is the one suffering/affected because of it.

    JosEPh
     
  5. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    The removal of the limit was because it doesn't scale well for map sizes. 10 missionaries sounds great on large maps, but floods small ones. 3 Missionaries are perfect for tiny maps, but useless for larger ones. The decision wasn't to hurt player's gold supplies, as Joseph implies; but because gold simply scales better, while still creating a soft-limit. If the AI is over-producing missionaries, it's an AI issue; not a limit issue. I'll curb the AI's overabundance of missionaries next patch.
     
  6. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,549
    Gender:
    Male
    Location:
    Canberra, Australia
    My problem is that I want to be able to get them out of the build queue so I build the limit and they no longer appear and the list of units is smaller! I do this with all the national units but at least I use the missionaries and CEOs. ;)

    Edit: It is a pity that national unit limits cant scale with map size and game speed. It would simplify things.

    Have you considered changing the whole way religions spread? EusebiusWorldReligion-Revival did it in Python. In that way missionaries become strategic units rather than tactical ones and the limit of 2 or 3 as in RoM was fine.

    Btw I suppose I will need to make a variation to AAranda's religions to fit with what ever you choose. I did notice that a couple of the religions missionary units are not behaving like the other missionary units eg you can't build them without the required building even if your chosen civics say you should.

    Edit 2: This is the basic algorithm used by Eusebius to determine if a religion spreads to a city that turn. Its a bit confused because I am in a hurry, sorry.

    1. religion can spread to any city in a civ. Spread occurs so that there can be one religion per 2 pop (+1)
    Code:
              if (countReligions(pCity) >= ((pCity.getPopulation() / 2) + 1)):
                   return False
    
    2. only religions already in the civ can spread to a city
    3. the probability that any religion spreads is based on religious civic

    Note. If the city pop 5 has one religion and the civ has 5 religions in it then try to spread each religion to the city until there are 5/2+1 = 3 religions in the city. I would suggest trying in the order based on spread rate.
     
  7. os79

    os79 Deity

    Joined:
    Mar 14, 2009
    Messages:
    3,094
    Location:
    Eastern USA Coast
    In that case, how do I close the poll earlier than the date stated? Since you have a better solution :D.
     
  8. JosEPh_II

    JosEPh_II TBS WarLord

    Joined:
    Jun 20, 2007
    Messages:
    16,396
    Gender:
    Male
    Location:
    Western IL. cornfields
    I Stated that it Hurt the AI.
    Nor is the Statement:
    an implication. It is the rationale behind many of the recent changes discussed here in the subforum. And is My observation. Sorry you don't like it.

    And finally:
    Is also a true and observable statement that has been voiced by more than just myself.

    If it's a simple AI fix then cool.

    JosEPh
     
  9. os79

    os79 Deity

    Joined:
    Mar 14, 2009
    Messages:
    3,094
    Location:
    Eastern USA Coast
    Look, Afforess had spent hundreds, if not thousands, of hours reading how AI work in the code. What he said potentially have a strong "expert-like" punch to it, OK? I'm not saying that he is perfect but saying that we should take his word with somewhat more confidence than you seem to show in him, OK?

    Continue analyzing and criticizing Afforess, we need that. However, please keep in mind that Afforess actually know what he is about as well :), is my advice.
     
  10. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,549
    Gender:
    Male
    Location:
    Canberra, Australia
    Except it may be the wrong solution to the problem ;).

    Even geniuses and experts make silly mistakes sometimes. Like the one who put two dog doors in, one for the small dog and one for the larger dog. Whereas the better solution was to put in one for the large dog which was light enough for the smaller dog to use.

    Actually thinking, is this change part of Better RoM or part of AND? If it is Better RoM then I may as well give up and say that AAranda's religions are not to be used with it.
     
  11. dudeSDCA

    dudeSDCA Prince

    Joined:
    May 21, 2009
    Messages:
    401
    Location:
    San Diego, CA
    Perfect -- Thx Afforess (and welcome back!)
     
  12. os79

    os79 Deity

    Joined:
    Mar 14, 2009
    Messages:
    3,094
    Location:
    Eastern USA Coast
    Did you even read the last sentence in my post? That answer your skepticism? :)
     
  13. Fuyu

    Fuyu Emperor

    Joined:
    Nov 5, 2009
    Messages:
    1,225
    Location:
    Austria
    I reported that issue long long time ago, Specific Bug Reports posts #439 and #443. Since the AI has troubles even if there is a limit of 3, please post fixes to Better AI forums too.

    My idea for a fix would have been: loop through all player cities, and check if there is already any missionary standing on a city plot doing nothing. If yes, don't buld any more.
    That would have worked (by limiting the number of excess missionaries to 1) for the situation I saw because all unneeded missionaries will simply stand inside the city they were built in.

    But the situation seems different in this mod, what exactly is the AI doing with these masses of missionaries?
    In the screenshot by Cyrusfan it doesn't look like the units stay inside cities doing nothing, they are actually moving around?
     
  14. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    It seems something like this would fix the issue:

    PHP:
    /************************************************************************************************/
    /* Afforess                      Start         08/18/10                                               */
    /*                                                                                              */
    /*  What about Civics that block religion spread and open borders?                               */
    /************************************************************************************************/
    /*
            iCount += ((pArea->getNumCities() * 2) - (pArea->countHasReligion(eReligion) * 3));
            iCount /= 8;

            iCount = std::max(0, iCount);

            if (AI_isPrimaryArea(pArea))
            {
                iCount++;
            }
    */
            
    int iLoop;
            for (
    int iPlayer 0iPlayer MAX_PLAYERS; ++iPlayer)
            {
                
    CvPlayerkLoopPlayer GET_PLAYER((PlayerTypes)iPlayer);
                if (
    kLoopPlayer.isAlive() && kLoopPlayer.getID() != getID())
                {
                    if (
    GET_TEAM(getTeam()).isHasMet(kLoopPlayer.getTeam()))
                    {
                        if (
    GET_TEAM(getTeam()).isOpenBorders(kLoopPlayer.getTeam()) || GET_TEAM(getTeam()).isLimitedBorders(kLoopPlayer.getTeam()))
                        {
                            if (!
    kLoopPlayer.isNoNonStateReligionSpread())
                            {
                                for (
    CvCitypLoopCity kLoopPlayer.firstCity(&iLoop); pLoopCity != NULLpLoopCity kLoopPlayer.nextCity(&iLoop))
                                {
                                    if (
    pLoopCity->area() == pArea)
                                    {
                                        if (!
    pLoopCity->isHasReligion(eReligion))
                                        {
                                            if (
    AI_plotTargetMissionAIs(pLoopCity->plot(), MISSIONAI_SPREADNULL) == 0)
                                            {
                                                
    iCount++;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
    /************************************************************************************************/
    /* Afforess                         END                                                            */
    /************************************************************************************************/
     
  15. JosEPh_II

    JosEPh_II TBS WarLord

    Joined:
    Jun 20, 2007
    Messages:
    16,396
    Gender:
    Male
    Location:
    Western IL. cornfields
    Please os79, I'm asking you nicely, stop. No More Public Defender! It has become, and is, tiresome and irksome, Please Stop it.

    Did you even read My last line?
    Ever since I posted objections to some of killtech's changes I've been portrayed as the Evil trouble maker to the AND kingdom. And you sir have continued the vilification at every turn. Please Stop.

    We all have good and bad days. And we will never completely agree to everything. I wouldn't be here if I were not trying to Help make AND and RoM better.

    Have a Nice evening.

    JosEPh :sad:
     
  16. Fuyu

    Fuyu Emperor

    Joined:
    Nov 5, 2009
    Messages:
    1,225
    Location:
    Austria
    Looks very expensive (AI_plotTargetMissionAIs loops over all player units)
    and it won't catch the cases like the one I discribed, where the civ has open borders with the target but not with the different civ inbetweeen, which blocks all paths.

    if (AI_plotTargetMissionAIs(pLoopCity->plot(), MISSIONAI_SPREAD, NULL) == 0) <- this will be false if any missionary goes there, you probably wanted it to only be false if an eReligion missionary is on its way.

    You are definitely on the right track though; just skip that plottargetmissionais check, instead subtract the number of eReligion's missionaries you have in that area in a seperate step. (Loop over player units, if (GC.getUnitInfo(eUnit).getReligionSpreads(eReligion) > 0) iCount--;)

    For the case where Open Borders is there but no path, the check for bored missionaries is still needed I think. Also long as they stay inside the city that built them, handling that case should be easy. Any coment on the missionary activities n Cyrusfan's screenshot?

    Also you skipped the division by 8 at the end. On purpose? Even for internal spread the number is divided by 2 if bHoly, 4 if not, so I suggest at least dividing by 4. Or 3 if going for some religion-based victory condition.
     
  17. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    I'm wondering if AI_neededMissionaries should be cached and recalculated each turn. Even without looping for all the selectiongroups, its going to be expensive, and it's called by cities several times a turn AND by AI_unitValue, which is called all over the place, frequently. Unfortuantly, I don't see a good way to cache it, except maybe by area...
     
  18. Fuyu

    Fuyu Emperor

    Joined:
    Nov 5, 2009
    Messages:
    1,225
    Location:
    Austria
    I'd store it on city level, everything else looks tedious.
    Area:
    int** m_ppaiPlayerMissionariesNeeded = new Array [MAX_PLAYERS][GC.getNumReligionInfos()];
    Looks fun too but idk ..

    thx, I checked it out. debug mod and CTRL+D it is. I should test that some day.
     
  19. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    Yuck. I'll test it out on some late-game games, and see what my profiling turns up, without caching. Maybe I worry too much...
     

Share This Page