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

It's been that way ever since the 1 tile option was implemented, I've seen it happen hundreds of times,
I use RCS quite a bit and it's not done this in all my games Until the changes you made in Python just recently. So I do not agree with your assessment that it's happened hundreds of times. It has not been the case with using the 1City tile Start since I made it.

You did change a section of code in that python file, and not just a single line either.
 
I use RCS quite a bit and it's not done this in all my games Until the changes you made in Python just recently. So I do not agree with your assessment that it's happened hundreds of times. It has not been the case with using the 1City tile Start since I made it.

You did change a section of code in that python file, and not just a single line either.
I don't know how to reply to this...
No recent changes can possibly explain why this has never happened to you before.
 
Toffer I only play with 1 City tile Option On. I play a lot with RCS On too. And it did not happen in my games like you are saying. It's not like I only play with RCs once in a blue moon and did not notice this. I know that even in the late mid game in Ren and Industrial eras that a new city founded would only start with the 1 main tile and would not pop any (up to the max 8) Until the next Culture level above None was reached with or with out RCS on . (I think it's called fledgling or Poor I'd have to look to see it's name for usre). So what you are implying does not jive with what I have seen for the 2 years now that this Option has been in the game.

When you added that section of over 8 lines+ of New code in that Python file it changed. And it has Not been the same since. You have overlooked something in that new section of code.
 
I only play with 1 City tile Option On and have done so since you implemented it. I always use RCS.
I've seen what you described in each and every game I play.

Try updating (downdating?) to an older SVN version and test it out in game then.

This is the pthon code I added that runs when you settle a city with a tribe unit.
Code:
        iPop = 0
        iPlayer = CyCity.getOwner()
        CyPlayer = GC.getPlayer(iPlayer)
        iUnit = CyUnit.getUnitType()
        mapSettlerPop = {
            GC.getInfoTypeForString("UNIT_SETTLER")        : 1,
            GC.getInfoTypeForString("UNIT_COLONIST")    : 2,
            GC.getInfoTypeForString("UNIT_PIONEER")        : 4,
            GC.getInfoTypeForString("UNIT_AIRSETTLER")    : 7
        }
        if iUnit in mapSettlerPop: # Nope this is false.
            Something happens here if the settler unit was defined in the list above.
        if iPop: # Nope this is false (iPop = 0 == False).
            Something happens here if iPop is not 0.
There's no way that this code can cause what you are describing. It does absolutely nothing other than making two logical checks that fails, and since they fail nothing is done.
 
Last edited:
There is way more code than that. I have the Python/DancingHoskuld/Caveman2Cosmos.py open and the section you changed was huge.

So you are saying you could not have possibly made a mistake?

I'll play along. I will clear my cache and start another New game and see if this repeats or not. It will take me into tomorrow to get the new game to that point again. As I don't have the time tonight. Fair enough?
 
Updated to the SVN version from the download and still having the same CTD error I was having earlier as posted in the download version error thread, just crashes randomly during this turn.
 

Attachments

  • CTD_error.zip
    3.7 MB · Views: 40
There is way more code than that. I have the Python/DancingHoskuld/Caveman2Cosmos.py open and the section you changed was huge.

So you are saying you could not have possibly made a mistake?
This is all I changed except for removing whitespaces, renaming the global variable "gc" to "GC", and changing comments.

Spoiler From-To :
From:
Code:
def onCityBuilt(argsList):
    'City Built'
    pCity = argsList[0]
 
    if pCity == None:  # not a real city
        return
 
    BugUtil.debug("caveman2Cosmos - onCityBuilt.")
    iPlayer = pCity.getOwner()
    pPlayer = gc.getPlayer(iPlayer)
    if (pPlayer == None) or pPlayer.isNPC() or not pPlayer.isAlive():
        return

    # Give a free defender to the first city when it is built
    pNumCities = pPlayer.getNumCities()
    if pNumCities == 1:
        i_Defender = gc.getInfoTypeForString("UNIT_TRIBAL_GUARDIAN")
        if i_Defender > -1:
            pPlayer.initUnit(i_Defender, pCity.getX(), pCity.getY(), UnitAITypes.UNITAI_PROPERTY_CONTROL, DirectionTypes.DIRECTION_SOUTH)
  
    # Give extra population to new cities when built if the player has techs
    if gc.getTeam(pPlayer.getTeam()).isHasTech(gc.getInfoTypeForString("TECH_COLONIALISM")):
        pCity.changePopulation(1)

    if gc.getTeam(pPlayer.getTeam()).isHasTech(gc.getInfoTypeForString("TECH_STEAM_POWER")):
        pCity.changePopulation(1)
To:
Code:
def onCityBuilt(argsList):
    CyCity, CyUnit, = argsList

    if not CyCity:
        return # not a real city

    # Give extra population to new cities
    # The "Great Bath of M..." wonder is dealt with in another python file.
    # It should be transferred here imo.
    if CyUnit:
        iPop = 0
        iPlayer = CyCity.getOwner()
        CyPlayer = GC.getPlayer(iPlayer)
        iUnit = CyUnit.getUnitType()
        mapSettlerPop = {
            GC.getInfoTypeForString("UNIT_SETTLER")        : 1,
            GC.getInfoTypeForString("UNIT_COLONIST")    : 2,
            GC.getInfoTypeForString("UNIT_PIONEER")        : 4,
            GC.getInfoTypeForString("UNIT_AIRSETTLER")    : 7
        }
        if iUnit in mapSettlerPop:
            iPop += mapSettlerPop[iUnit]
        if iPop:
            CyCity.changePopulation(iPop)
            if CyGame().isOption(GameOptionTypes.GAMEOPTION_1_CITY_TILE_FOUNDING):
                CyCity.changeFood(CyCity.growthThreshold()/2)
            else:
                CyCity.changeFood(CyCity.growthThreshold()/4)

        # Give a free defender to the first city when it is built
        if iUnit == GC.getInfoTypeForString("UNIT_BAND"):
            i_Defender = GC.getInfoTypeForString("UNIT_TRIBAL_GUARDIAN")
            if i_Defender > -1:
                CyPlayer.initUnit(i_Defender, CyCity.getX(), CyCity.getY(), UnitAITypes.UNITAI_PROPERTY_CONTROL, DirectionTypes.DIRECTION_SOUTH)
Here's the only two python functions that can add cultural ownership to a plot:
CyPlot.setCulture(iPlayer, iNewValue, bUpdate)
CyPlot.changeCulture(iPlayer, iNewValue, bUpdate)​
CyPlot is one specific plot, iPlayer is the index of one specific player in the game.
There is no way that I added that function to the script by mistake, and I didn't sneak it in anywhere either.

P.S. You can configure most comparison programs to ignore whitespace changes.
 

Attachments

  • Untitled-1.jpg
    Untitled-1.jpg
    532.5 KB · Views: 27
Last edited:
There's a vague possibility that there could be some old rule in the dll that adds some culture if you get extra population but I would fully test again looking for any other possible explanation before I go looking for that. I can confirm that his code would not create any direct additional culture to the city now. It DOES add some food so that there wouldn't be immediate starvation, which hopefully is enough to avoid that fate usually. But if it still does grow out a rung right away then we'd have to look at other reasons it happens as a result of this change, which COULD come down to something else we aren't currently aware of.
 
Updated to the SVN version from the download and still having the same CTD error I was having earlier as posted in the download version error thread, just crashes randomly during this turn.
I found that the debug dll allowed me to run the turn all the way through. This is not actually surprising, as the DLL has some added processing intended to correct some bad gamestates that older games could enter into. I had not been able to directly solve how that took place but it does seem to not take place very often now so may have been solved by later corrections. All this Greek means that I was able to heal your game by running it through a round. Here is the save at that point.

It didn't look like you had finished the round. If you want, you could run the debug dll, finish the round out, then complete it. The debug dll takes a long time to process and you'll get a few popups you have to hit 'ignore always' when you see them. To run the debug dll, you just rename the CvGameCoreDLL.dll file in the Assets folder to add '.core', then rename the one that ends in '.debug' to remove that .debug portion. Then run the game. Reverse these steps after taking the turn and saving it and getting out.

If that sounds like a lot of fiddling about, just play this game turn as is from here.
 

Attachments

  • Dylan May 22, BC-4876.7z
    3 MB · Views: 52
I did a test game today. SVN 10316. I uploaded some screenshots about what is happening. I marked on some images the original tiles of the city and the extra tiles I get after I conquered it. Original tiles are marked with green stars, extra tiles marked with red circles. On one screenshot I marked 3 tiles with orange circles which represents the tiles I get after RCS starts working again.

So my problem is that with RCS enabled after the conquest I expect to get the same tiles as the original owner (marked by green stars). Instead I get big crosses. I stabilized the conquered city on turn 95. On turn 112 I already have a huge area around the city. I shouldn't have those tiles I marked with red circles.

It seems that it has nothing to do with the extra influence from the battles. See below.

You are talking about the IDW Enabled option on the RevDCM tab (last screenshot)? I reloaded my test game and I tried to disable it before I declared war on India and I got exactly the same results as before. So I think the problem lies elsewhere.
So I checked the code and I was wrong, sorta. There is a difference between the culture distance and culture level on a plot as I did explain. But an in-depth readthrough of the code shows that this whole phenomenon is completely intended... but only under fixed borders. If you wish for RCS to behave in a more 'original' manner, select the No Fixed Borders option.

What happens is if you have fixed borders, the city will claim any tile that the old city had cultural influence over and range to claim as long as no other city also has range to claim that tile. Apparently later on if you don't have enough cultural level, you won't own the tile until you do, but this premature claiming feature makes the growth behave the way you are dissatisfied with, much because of what I did explain before about some of the shortcuts in the code that would be very difficult to try to program around (and this is NOT worth that sort of effort and ensuing delays.)

So, would you be able to live with turning off fixed borders? Truth be told I don't even see it doing much anymore since it lost its teeth a number of years ago during some turmoils over the subject.
 
So what options are messing with One Tile City start?
Realistic Culture Spread?
Influence-Driven War (BUG option - can be changed in game trough BUG)?
Fixed Borders?

Or combination of all four means One Tile start can't work as it was intended (city having only one tile on beginning)?
I always play with those three options and One Tile start wasn't working properly for subsequent cities.
 
Last edited:
Promotion - City Raider 3 isn't available for mounted type units. City raider 2 and 4, 5 are available. I think it's a mistake. Either CR3 should be available for mounted, or CR4-5 unavailable.

Also, a request please - could button for completing trade mission (for trade merchants, caravans, carrack merchants etc. also for Rogue type units (for contraband)) be implemented in a way that when multiple units are selected it would apply for all selected when pressed. Currently when i move my stacks of caravans i have to manually press this button for every unit. Also if you could add hotkey to this button it would be really great.
 
Last edited:
There's a vague possibility that there could be some old rule in the dll that adds some culture if you get extra population but I would fully test again looking for any other possible explanation before I go looking for that. I can confirm that his code would not create any direct additional culture to the city now. It DOES add some food so that there wouldn't be immediate starvation, which hopefully is enough to avoid that fate usually. But if it still does grow out a rung right away then we'd have to look at other reasons it happens as a result of this change, which COULD come down to something else we aren't currently aware of.
Probably not as this is happening even though no food or extra population are added to the city.
That python code doesn't make a single change to any plot or city when settling a city with a tribe unit.
The new city only gets cultural border in the first ring plots that would have been claimed by another city if the game had been played without RCS.
 
Today I will start 2 new games, 1 with RCS and 1 w/o it. I stopped using Fixed Borders ages ago so it may not be a factor either.

But as I was watching the Football game last night thinking about this I began to wonder if some of the changes I made with the 1st set of Civic might be the source or at least a contributor to this problem. I did reduce some of the Early Culture penalties on a couple of the Starting Civics. This boost in culture could've reacted with RCS, or in and of itself been enough to cause more tiles than the Main city tile to pop when settling a city with a tribe. It should not have done so though. So somehow the tiles that did pop and several were Water tiles in the 2nd new city (from which I took he screenies) should not have reacted till the Main tile and City Culture had reached the Culture level Poor. So several tings to look into.

I will be testing that today as well.

Problem is though the 1st Culture ring is None and you will have to accrue X Culture points per turn based of how you set up your game and the Leader involved and other factors. One of my screenshots shows that. The 8 surrounding tiles Pop into existence once Culture level Poor is reached if RCS is Off. If RCS is On, then the low lying tiles around the Main City tile will pop 1st. And iirc Jungles, Hills, and Mountains will follow later when even more Culture that is needed is accrued for them by the RCS rules. and that can take some time to happen.

Several variables to consider as well as the coding.
 
Last edited:
So I checked the code and I was wrong, sorta. There is a difference between the culture distance and culture level on a plot as I did explain. But an in-depth readthrough of the code shows that this whole phenomenon is completely intended... but only under fixed borders. If you wish for RCS to behave in a more 'original' manner, select the No Fixed Borders option.

What happens is if you have fixed borders, the city will claim any tile that the old city had cultural influence over and range to claim as long as no other city also has range to claim that tile. Apparently later on if you don't have enough cultural level, you won't own the tile until you do, but this premature claiming feature makes the growth behave the way you are dissatisfied with, much because of what I did explain before about some of the shortcuts in the code that would be very difficult to try to program around (and this is NOT worth that sort of effort and ensuing delays.)

So, would you be able to live with turning off fixed borders? Truth be told I don't even see it doing much anymore since it lost its teeth a number of years ago during some turmoils over the subject.
I can live with anything if I have to. I was able to live without using RCS and still enjoy the game. I like both game mechanics but I like RCS more so if I have to sacrifice one option to another then the better solution to me to play without fixed borders.

It's very useful to me to know about this, thanks! I wrote it down so I won't forget.
 
So what options are messing with One Tile City start?
Realistic Culture Spread?
Influence-Driven War (BUG option - can be changed in game trough BUG)?
Fixed Borders?

Or combination of all four means One Tile start can't work as it was intended (city having only one tile on beginning)?
I always play with those three options and One Tile start wasn't working properly for subsequent cities.
My guess is the "minimum city border" option.
GAMEOPTION_MIN_CITY_BORDER
But as I was watching the Football game last night thinking about this I began to wonder if some of the changes I made with the 1st set of Civic might be the source or at least a contributor to this problem. I did reduce some of the Early Culture penalties on a couple of the Starting Civics. This boost in culture could've reacted with RCS, or in and of itself been enough to cause more tiles than the Main city tile to pop when settling a city with a tribe. It should not have done so though.
I can assure you that no civic XML could possibly cause this phenomena.
 
My guess is the "minimum city border" option.
GAMEOPTION_MIN_CITY_BORDER
Do you think it's coding is interfering even when this Option is turned Off? I know that 45* from AND2 had a lot of problems with that code and getting it right when I was part of the AND2 team years ago. And the C2C Team imported that code from AND2. Many things were shared back then.
 
@Thunderbrd
While looking through dll code I saw this in the initialization of city objects:
▬▬▬▬▬▬
~ ~ ~ Previous codelines
bool bFound = false;
if (GC.getGameINLINE().isOption(GAMEOPTION_PERSONALIZED_MAP) && GET_PLAYER(getOwnerINLINE()).isModderOption(MODDEROPTION_USE_LANDMARK_NAMES))
{

for (int iI = 0; iI < NUM_CITY_PLOTS_2; iI++)
{
CvPlot* pLoopPlot = getCityIndexPlot(iI);
if (!pLoopPlot->getLandmarkName().empty() && pLoopPlot->getLandmarkType() != NO_LANDMARK)
{

setName(pLoopPlot->getLandmarkName());
if (!getName().empty())
{

bFound = true;
break;
}
}
}
}
if (!bFound)
/************************************************************************************************/
/* Afforess END */
/************************************************************************************************/
setName(GET_PLAYER(getOwnerINLINE()).getNewCityName());
~ ~ ~ Following codelines
▬▬▬▬▬▬
The bold "if" statement has no content, is that even a legal line in dll?
Doing the same in python would cause some serious damage by breaking the entire function...
The bFound variable isn't used for anything further down in that function either, so allt the red code could be deleted as far as I can see.
The bold if statement has a one line content. This is it:
setName(GET_PLAYER(getOwnerINLINE()).getNewCityName());

It's just not in a block marked by braces.

If I'm not mistaken the red code names the player's city after a landmark on a personalized map if it founds one near the city. If not it names the city conventionally.
 
Do you think it's coding is interfering even when this Option is turned Off?
No, I can't remember if I play with it on or off, but if you don't have it on then it is not caused by that option.

I've been looking through the dll code today trying to find a cause, the minimum border part in code looked relevant to the problem at first glance.
Good to know that it is not relevant, don't need to look further into that part of the code.

Could you try changing FREE_CITY_ADJACENT_CULTURE from 1 to 0 in the global defines see if that helps.
The code for that also looks quite relevant.
 
The bold if statement has a one line content. This is it:
setName(GET_PLAYER(getOwnerINLINE()).getNewCityName());

It's just not in a block marked by braces.

If I'm not mistaken the red code names the player's city after a landmark on a personalized map if it founds one near the city. If not it names the city conventionally.
Ok, I didn't know c++ could have this syntax:
if A
B = A; // part of "if".
D = B; // not part of "if".​

Kinda confusing that there are no indents or any other markers to show that "D = B" is not inside the "if" statement.
This is how that would look in python:
if A: B = A
D = B​
or:
if A:
B = A​
D = B​
 
Last edited:
Top Bottom