Single Player bugs and crashes v38 plus (SVN) - After the 20th of February 2018

Thanks:thumbsup:

The fist thing I noticed is that the AI has a problem with hunting. Somehow the AI can't or doesn't train UNITAI_HUNTER_ESCORT units to escort hunters until they can train Scouts that makes hunters unable to move.
The Wanderer would be the first unit here and the AI has to be able to train them because otherwise the hunters would move out to hunt unescorted. Somehow no Wanderer is built with UNITAI_HUNTER_ESCORT.

This used to work not that long ago but like the settler issue it doesn't now. It's not new either because we had these issues before and sadly they are back:mad::mad::mad::mad::mad::mad:
The effort that likely broke the structure works on one end (where the brokerage call identifies the units that can and can't be valid for the brokerage call) and apparently doesn't work so well on the other end, when it comes to the answering unit joining up with the group portion of the process. It was an honest bugfix being addressed and I just did something wrong that broke that part. To explain it, units that were very bad choices were answering brokerage calls that weren't meant for them in the slightest because the unitAI filter on the call wasn't applying itself properly. So any unit could basically answer any brokerage call if they were looking for work. That's obviously bad. The AI types a call asked for were not being enforced as a filter. So apparently when I went in to improve that I did something that ended up keeping any units from being able to join, even if they properly answered the brokerage call. I'm guessing the filter is flawed now and filtering out all units from the final check for accuracy before the command to join is made. This should be a super easy fix to spot and solve.

From the log snips you posted, it looks like they are training units for needed roles just fine, but not joining them to the groups. But if they aren't training wanderers as hunting escort units, then are wanderers assigned as hunting escort AI capable in the xml? Brutes would make good hunting escorts too for those barbs and neanderthals encountered out there. (And thus we'd also have to set clubmen and spiked clubmen and axes/spears as all hunting escort capable units - as a player, I do use them for that.)
 
Thanks:thumbsup:

The fist thing I noticed is that the AI has a problem with hunting. Somehow the AI can't or doesn't train UNITAI_HUNTER_ESCORT units to escort hunters until they can train Scouts that makes hunters unable to move.
The Wanderer would be the first unit here and the AI has to be able to train them because otherwise the hunters would move out to hunt unescorted. Somehow no Wanderer is built with UNITAI_HUNTER_ESCORT.

This used to work not that long ago but like the settler issue it doesn't now. It's not new either because we had these issues before and sadly they are back:mad::mad::mad::mad::mad::mad:

This doe not make sense. The Wanderer is your 1st Hunter and Explorer Unit. How can it be assigned to a Hunter? Assigned to another Wanderer???

The Wanderer is your 1st Hunter and Explorer Unit, then comes the Chaser and or Scout. And the Wanderer can upgrade to either one.

The Chaser is very short lived by tech research because the Tracker can be built within 1- 2 tech of getting the Chaser. All the while the Wanderer is No longer available to be built. It's now obsolete.

The Wanderer in the xml is listed as Unit_Explorer. For the Wanderer to be a Hunter Escort the Chaser would have to be available for it to pair up with. And Not be in the Upgrade path for the Wanderer. This means the Chaser should become available when the Wanderer becomes available, almost at game start. Or the wanderer pushed back to the Chaser giving Tech Persistent Hunting. Again you have the problem of the Tracker being available to replace the Chaser with in 1-2 techs researched.
 
Hi there. Burial traditions are pink and if I choose them the game crashes. I use raxo's modmod that disables limitations, Toffer's UI modmod, and Sparth's Civ Megapack. Please help or tell me how to fix! I've included the save. If not then I'll dig through xml and disable module myself when I have time... Also, thanks for such an amazing mod!! It's been my favorite game for at least 5 years now... Edit: Using latest SVN
When you updated to a version of the SVN, you did not copy the files in the assets/art folder across. Those buttons were moved from the BurialTraditions folder and put into the core art area in preperation for the whole folder being moved into the core game. It has not been moved yet because there are some missing buildings that should be in there to make Cave Burial as good as the other types.
 
My logs. Two AI civs researched tribalism about ten turns earlier
 

Attachments

The Wanderer is your 1st Hunter and Explorer Unit, then comes the Chaser and or Scout. And the Wanderer can upgrade to either one.
You just answered your own question. The escort would upgrade to a scout while the hunter would upgrade to a chaser or tracker. And so on. Until then, they have doubled up and will often be able to have the second finish off whatever took down the first. Though recon AIs aren't much for attacking usually.

UnitAI settings are not singularly exclusive to a unit type. One wanderer CAN be a UNITAI_HUNTER while another is UNITAI_EXPLORE (usually for recons), or rather, in this case a UNITAI_HUNTER_ESCORT.

The <DefaultUnitAI> tag assigns this AI to the unit when there's an ambiguous case, like the unit was just initiated without a call for what AI it should have, such as when human players train units. In many of these cases, it's not terribly important what AI the unit has because it's not going to be guided by its AI type. However, the types of AIs a unit should be able to take on are listed in the <UnitAIs> list tag.

Having a chance to look into it, the Wanderer has the following possible AIs. (Sometimes it can take on other types unless the NotUnitAI is in use specifying that AI as one it cannot operate under.)

Code:
           <UnitAIs>
               <UnitAI>
                   <UnitAIType>UNITAI_EXPLORE</UnitAIType>
                   <bUnitAI>1</bUnitAI>
               </UnitAI>
               <UnitAI>
                   <UnitAIType>UNITAI_PILLAGE</UnitAIType>
                   <bUnitAI>1</bUnitAI>
               </UnitAI>
               <UnitAI>
                   <UnitAIType>UNITAI_HUNTER</UnitAIType>
                   <bUnitAI>1</bUnitAI>
               </UnitAI>
               <UnitAI>
                   <UnitAIType>UNITAI_HUNTER_ESCORT</UnitAIType>
                   <bUnitAI>1</bUnitAI>
               </UnitAI>
           </UnitAIs>
So, indeed, the Wanderer should be able to be trained as a Hunter escort AI type and thus answer the call of a Hunter trained Wanderer, which won't deploy until he has an escort AI to accompany him.

I might now have a few hrs to address the flaw here, which is that units that are called to join other stacks to fulfill teamwork roles in that stack, are not joining the stacks they are made for and called to.

EDIT: I think I figured out where I screwed up the call logic. I've gotta test the new dll a bit but I should be able to have a fix on the SVN by tonight and hopefully this one works.

EDIT: Nope... it's a much deeper issue. I'm hardly seeing the AI train anything so I'm thinking it's a problem with broker calls even finding anything to train in the first place. If it's not that, then the AI is putting far too much priority on some buildings over any units. I suspect only the immediate train calls are getting responses.

This is going to take much longer to sort out.
 
Last edited:
10034 Tannery gives :hammers: but that isn't stated on the automatic text. It is only visible after the calculation is done to see its true amount.
 

Attachments

  • Tannery.png
    Tannery.png
    54.6 KB · Views: 69
  • Pedia.png
    Pedia.png
    121.2 KB · Views: 70
Last edited:
10034 Tannery gives :hammers: but that isn't stated on the automatic text. It is only visible after the calculation is done to see its true amount.
This happens with many buildings. It is to do with caching and keeping turns quick. The actual value isn't necessarily the actual value for that particular city either but for a generic city in the empire. That is why my attempt at "demand buildings" failed. For example Scarecrow replaces one of the pests but it does not display the change in disease value you get from removing that pest.
 
EDIT: Nope... it's a much deeper issue. I'm hardly seeing the AI train anything so I'm thinking it's a problem with broker calls even finding anything to train in the first place. If it's not that, then the AI is putting far too much priority on some buildings over any units. I suspect only the immediate train calls are getting responses.

This is going to take much longer to sort out.

@Thunderbrd and @Toffer90

You guys should check all the numbers and formulas which where changed during the last months. Because it seems that things got harder for the Ai and I seem to recall there where changes to the Ai handicap modifiers and how they are used as well.
 
@Thunderbrd and @Toffer90

You guys should check all the numbers and formulas which where changed during the last months. Because it seems that things got harder for the Ai and I seem to recall there where changes to the Ai handicap modifiers and how they are used as well.
Look what I found:
Code:
int CvTeam::getResearchCost(TechTypes eTech) const
{
    FAssertMsg(eTech != NO_TECH, "Tech is not assigned a valid value");

    //This whole function needs to be converted to an unsigned long long.  That's quite a task but should be possible and if it doesn, we should be able to make it to the end of the game with the base modified even at the extremest points.
    int iInitialCost = GC.getTechInfo(eTech).getResearchCost();
    if (iInitialCost < 0)
    {
        return -1;
    }

    unsigned long long iCost = (unsigned long long)iInitialCost;


    iCost *= 100;

    int iBeelineStingsTechCostModifier = 0;
    if (GC.getGame().isOption(GAMEOPTION_BEELINE_STINGS))
    {
        int iTechEra = GC.getTechInfo(eTech).getEra();
        int iPlayerEra;
        for (int iI = 0; iI < MAX_PLAYERS; iI++)
        {
            if (GET_PLAYER((PlayerTypes)iI).getTeam() == getID())
            {
                iPlayerEra = (int)GET_PLAYER((PlayerTypes)iI).getCurrentEra();
                break;
            }
        }
        if (iTechEra < iPlayerEra)
        {
            for (int iI = 0; iI < GC.getNumEraInfos(); iI++)
            {
                int iEvalEra = iI;
                EraTypes eEvalEra = (EraTypes)iI;
                if (iEvalEra >= iTechEra && iEvalEra < iPlayerEra)
                {
                    iBeelineStingsTechCostModifier += GC.getEraInfo(eEvalEra).getBeelineStingsTechCostModifier();
                    //just need to add the tag iBeelineStingsModifier to Era Infos.
                }
                else if (iEvalEra >= iPlayerEra)
                {
                    break;
                }
            }
        }
    }

    int iModifier = GC.getTECH_COST_MODIFIER();
    iCost *= iModifier;
    iCost /= 100;

    iModifier = GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getResearchPercent();
    iCost *= iModifier;
    iCost /= 100;

    iModifier = GC.getHandicapInfo(getHandicapType()).getResearchPercent();
    iCost *= iModifier;
    iCost /= 100;

    iModifier = GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getResearchPercent();
    iCost *= iModifier;
    iCost /= 100;

    iModifier = GC.getEraInfo((EraTypes)GC.getTechInfo(eTech).getEra()).getResearchPercent();
    iCost *= iModifier;
    iCost /= 100;

    iModifier = iBeelineStingsTechCostModifier + 100;
    iCost *= iModifier;
    iCost /= 100;

    iModifier = std::max(0, (GC.getDefineINT("TECH_COST_EXTRA_TEAM_MEMBER_MODIFIER") * getNumMembers()));
    iCost *= iModifier;
    iCost /= 100;

    if (!isHuman() && !isNPC())
    {
        iModifier =   GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIConstructPercent(); ---------------------------------CONSTRUCTpercent? Good job!
        iCost *= iModifier;
        iCost /= 100;
    }
 
    iCost /= 100;

    int iFinalCost = MAX_INT;
    if (iCost < MAX_INT)
    {
        iFinalCost = (int)iCost;
    }
    return std::max(1, iFinalCost);
}


Someone used Construct Percent for research cost for AI.....
No wonder Noriad never noticed change when he set ai tech cost to 44....

Old AI handicaps were below 100 above Noble.

This makes tech costs must lower for AI than defined.
And we all know lower production building cost/tech cost total modifier ratio is better.
Currently if we take final production cost modifier as baseline, then techs are ~3.5x more expensive than that on all pace settings and eras.
In old system it was 1 on standard/noble/normal and 9 on eternity/nightmare/gigantic.

On my Noble AI automated test AI seems to be too lazy to build units.
It shouldn't be too different than just clicking "end turn" repeatably.
They all were building lesser wealth.
 

Attachments

Last edited:
On my Noble AI automated test AI seems to be too lazy to build units.
It shouldn't be too different than just clicking "end turn" repeatably.
They all were building lesser wealth.

This is a problem yes and it didn't exist a few months ago.
But it could be caused by a problem in the Ai production code or the AI just can't handle the new setup or some Ai handicap modifiers are used wrong or the Ai used to have bigger bonuses before those changes began or some combination of all of those.
 
This is a problem yes and it didn't exist a few months ago.
But it could be caused by a problem in the Ai production code or the AI just can't handle the new setup or some Ai handicap modifiers are used wrong or the Ai used to have bigger bonuses before those changes began or some combination of all of those.
I noticed this little bug in tech cost calculator.
if (!isHuman() && !isNPC())
{
iModifier = GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIConstructPercent();
iCost *= iModifier;
iCost /= 100;
}
 
I noticed this little bug in tech cost calculator.
if (!isHuman() && !isNPC())
{
iModifier = GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIConstructPercent();
iCost *= iModifier;
iCost /= 100;
}

That error actually helps the AI a bit at the moment but there could be other handicap modifier issues which hurt the AI.
 
That error actually helps the AI a bit at the moment but there could be other handicap modifier issues which hurt the AI.
Well it built most of buildings that it could build but completely ignored units.
I'll turn off BUG unit stacking to see what happens.
I had this one already disabled.

Maybe code used by BUG option Minimize AI Turns got damaged....
I'll turn off this one to see what happens.
Still no difference - no hunters/explorers/workers/settlers created.
 
Last edited:
I really think it was a good idea to break the save game compatibility because it forced players to start new games and notice those issues.

It could be anything and i don't have my laptop with me today so i can't do anything.
 
So, indeed, the Wanderer should be able to be trained as a Hunter escort AI type and thus answer the call of a Hunter trained Wanderer, which won't deploy until he has an escort AI to accompany him.
So how does the AI differentiate which Wanderer is escort and which is Hunter? I think this would be hard to code right? Why not make the Brute or Stone Thrower the Escort instead? And simplify the code? Especially at game start. A bit later the Chaser/tracker could have the Scout as escort.

Maybe some of the problem is giving units multiple AI, even moreso when there are few to chose from.
 
So how does the AI differentiate which Wanderer is escort and which is Hunter? I think this would be hard to code right? Why not make the Brute or Stone Thrower the Escort instead? And simplify the code? Especially at game start. A bit later the Chaser/tracker could have the Scout as escort.

Maybe some of the problem is giving units multiple AI, even moreso when there are few to chose from.

The AI only cares about the UnitAI a unit has and lots of units have multiple valid UnitAIs defined. For the AI it doesn't matter how a unit is called or what color it's shoes have that is something only human players care about.

Anyways that hunting code used to work as well as the settler getting his escorts. But in C2C everything gets broken over and over.
 
After my game froze a few days ago I really tried a lot to get it running again. In the end I was successful (for now)! I went into worldbuilder and found that there was a barbarian village in the space (playing on the Alien Solar Map by Kation). I deleted that city and the game is not freezing anymore! Unfortunately I don´t know how to find out which kind of space tile that is but I have attached the savegame and a screenshot of worldbuilder. The village is in the space north of the extra earthlike planet, not yet discovered by me (I´m still in Ancient era).
I think it would be important that barbarian villages are not allowed on space terrain, especially if they create such big problems like in this game (reproducibly freezing after end of turn).

Barbarians_in_Space.JPG
 

Attachments

But in C2C everything gets broken over and over.
I think that is called, "Today's change is...". ;) Nothing stays the same for long.
 
After my game froze a few days ago I really tried a lot to get it running again. In the end I was successful (for now)! I went into worldbuilder and found that there was a barbarian village in the space (playing on the Alien Solar Map by Kation). I deleted that city and the game is not freezing anymore! Unfortunately I don´t know how to find out which kind of space tile that is but I have attached the savegame and a screenshot of worldbuilder. The village is in the space north of the extra earthlike planet, not yet discovered by me (I´m still in Ancient era).
I think it would be important that barbarian villages are not allowed on space terrain, especially if they create such big problems like in this game (reproducibly freezing after end of turn).

View attachment 492503
@Thunderbrd it appears they will blindly spawn at source of fresh water, ice feature in this case.
That is city spawning doesn't see, that some tiles aren't Earth tiles.

@Toffer90
Is it possible to make same resources not spawn at each other?
Spoiler :
gAUbQb6.jpg

This time I'm testing Noble/Standard/Blitz with 7 AIs, no barbarians on C2C World map on Archipelago land form.
Spoiler :
V7gy2bQ.jpg

I'm using my own no latitude restrictions and Toffer's modmod with 13/14/15/16/17 font.
 
Last edited:
After my game froze a few days ago I really tried a lot to get it running again. In the end I was successful (for now)! I went into worldbuilder and found that there was a barbarian village in the space (playing on the Alien Solar Map by Kation). I deleted that city and the game is not freezing anymore! Unfortunately I don´t know how to find out which kind of space tile that is but I have attached the savegame and a screenshot of worldbuilder. The village is in the space north of the extra earthlike planet, not yet discovered by me (I´m still in Ancient era).
I think it would be important that barbarian villages are not allowed on space terrain, especially if they create such big problems like in this game (reproducibly freezing after end of turn).

View attachment 492503
Wouldn't this be the map script by the map maker? How is the Main mod somehow responsible for Barbs in Space?
 
Back
Top Bottom