• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Modmodding Q&A Thread

post deleting/editing is not something about ethics or mistakes done. it's just about an old (but necessary) convention because of how forums are visually designed.
in a simple messaging app for example, your post does not take too much space; but in a forum, triple post means your signature/avatar etc is copied and occupies triple space as well. it's just not nice to the eye when you read the forum.
Also the notification thing special to Civfanatics might be annoying for other users
 
There are also openly visible ways to redact previous statements, e.g. by putting them in spoiler boxes or strikethrough. But let's not talk about that any more now.
 
What areas of the code are most influential in the AI building military units? I can't seem to figure out how to get them to build military units. I've looked through my previous changes to CvCityAI but can't find which changes could have made the BC civs that I've been testing so intent on building Granaries, Monuments, Barracks, Wonders, and more to the point I haven't seen a single unit build during my testing with CMC.
 
Didn't you change how they emphasise workers? I would start there.
 
Didn't you change how they emphasise workers? I would start there.
Yes, but I just reverted that change for all but the first 10 turns and while it fixed the rampant building of workers, it was only replaced by a rampant building of buildings.
 
I'm at a loss then, AI code is fairly complex so who knows what else is influencing this behaviour.
 
I wouldn't know how, but LH personalities can influence the propensity to build units.
 
It seems that when the AI decides which unit to build in my modcomp, it always goes for a Worker, Settler or nothing. I'm currently poking around CvCityAI::AI_bestUnitAI to see if I can find a way to get the AI to build combat units. I'm taking the "Place in absurdly high or low numbers and see if anything changes" approach, because I've never been able to figure out how to log messages using DLL code.

I know I said I was taking a break, but I can't keep away from the code.
 
I've recently been annoyed how, because cities always yield at least 2 Food, it's a better idea to settle tiles with lower food yields. Does anyone know where this is set up in the code? I'd like to change it from being a strict City tiles always yield 2 Food to City tiles increase Food Yields by 2. It'd be a major buff to cities, but it's better than the current set up IMO.

EDIT: Found it: CvPlot.cpp::calculateYield line 7042, directly after "if (bCity)"
 
Last edited:
What would be the best way to increase the number of turns between two points in time? I would like to double the amount of time it takes to go from 3000 BC to 2000 BC, as I've been finding that there's not much time for Egypt to build the units necessary to conquer Lower Egypt or for Babylonia to conquer the Levant in the historical amount of time.

EDIT: Nevermind, I've decided to go a similar yet slightly different route
 
Last edited:
Okay. So I played like five minutes of 1.15, which is enough time for me to get bothered about every little petty thing I want changed, and has now motivated me to take up modmodding again. So I started Visual Studio aaaaaaaaaaaaaaaaaaand...

it appears the 1.15 release version doesn't have the source files for the DLL, huh. Is that intentional or an oversight? I guess I can still just get them from here, correct?
 
I trying to reconfigure 600AD scenario into an other date the catapult event seems to have been deactivated.
Is there something special I should be careful about? i.e. what does the code in RiseAndFall.py line 3085 do?
Code:
or iPlayer in range(iNumPlayers):
           if tBirth[iPlayer] > utils.getScenarioStartYear() and gc.getPlayer(iPlayer).isHuman():
               tCapital = Areas.getCapital(iPlayer)
               utils.makeUnit(iSettler, iPlayer, tCapital, 1)
               utils.makeUnit(iMilitia, iPlayer, tCapital, 1)
 
Okay. So I played like five minutes of 1.15, which is enough time for me to get bothered about every little petty thing I want changed, and has now motivated me to take up modmodding again. So I started Visual Studio aaaaaaaaaaaaaaaaaaand...

it appears the 1.15 release version doesn't have the source files for the DLL, huh. Is that intentional or an oversight? I guess I can still just get them from here, correct?
The release version deliberately does not include the source code, and you seem to have already found where it is.
 
Collapses wouldn't be so bad if respawns happened more quickly and consistently IMO, especially if the area is mostly/completely independent.

@AnyCoderThatWouldLikeToRespond Would it work if I changed this

Code:
    for iLoopCiv in utils.getSortedList(lPossibleResurrections, lambda x: data.players[x].iLastTurnAlive):
        if gc.getGame().getGameTurn() - data.players[iLoopCiv].iLastTurnAlive < utils.getTurns(15):
            continue
 
        for city in utils.getAreaCities(Areas.getRespawnArea(iLoopCiv)):
            if city.getOwner() not in [iIndependent, iIndependent2, iNative, iBarbarian]:
                break
        else:
            lCityList = getResurrectionCities(iLoopCiv)
            if lCityList:
                doResurrection(iLoopCiv, lCityList)
                return
for iLoopCiv in utils.getSortedList(lPossibleResurrections, lambda x: data.players[x].iLastTurnAlive):
       iMinNumCities = 2
 
       # special case Netherlands: need only one city to respawn (Amsterdam)
       if iLoopCiv == iNetherlands:
           iMinNumCities = 1
             
       iRespawnRoll = gc.getGame().getSorenRandNum(100, 'Respawn Roll')
       if iRespawnRoll - iNationalismModifier + 10 < tResurrectionProb[iLoopCiv]:
           #print 'Passed respawn roll'
           lCityList = getResurrectionCities(iLoopCiv)
           if len(lCityList) >= iMinNumCities:
               #print 'Enough cities -> doResurrection()'
               doResurrection(iLoopCiv, lCityList)
               return

To this?

Code:
for iLoopCiv in utils.getSortedList(lPossibleResurrections, lambda x: data.players[x].iLastTurnAlive):
        iAddRoll = 0
        if gc.getGame().getGameTurn() - data.players[iLoopCiv].iLastTurnAlive < utils.getTurns(15):
            continue
 
        for city in utils.getAreaCities(Areas.getRespawnArea(iLoopCiv)):
            if city.getOwner() in [iIndependent, iIndependent2, iNative, iBarbarian]:
                iAddRoll += 1

        iMaxCities = len(utils.getAreaCities(Areas.getRespawnArea(iLoopCiv)))

        if iAddRoll == iMaxCities:
            lCityList = getResurrectionCities(iLoopCiv)
            if lCityList:
                doResurrection(iLoopCiv, lCityList)
                return
        else:
            iAddRoll = iAddRoll * 100 / iMaxCities
    for iLoopCiv in utils.getSortedList(lPossibleResurrections, lambda x: data.players[x].iLastTurnAlive):
        iMinNumCities = 2
 
        # special case Netherlands: need only one city to respawn (Amsterdam)
        if iLoopCiv == iNetherlands:
            iMinNumCities = 1
           
        iRespawnRoll = gc.getGame().getSorenRandNum(100, 'Respawn Roll') - (iAddRoll / 2)
        if iRespawnRoll - iNationalismModifier + 10 < tResurrectionProb[iLoopCiv]:
            #print 'Passed respawn roll'
            lCityList = getResurrectionCities(iLoopCiv)
            if len(lCityList) >= iMinNumCities:
                #print 'Enough cities -> doResurrection()'
                doResurrection(iLoopCiv, lCityList)
                return
 
Last edited:
The Legends of Revolution installer has a checkmark (like here for Varietas Delectas module etc.) for whether or not it should also include the source files.
 
This mod is even better and has the entire history of all sources under source control!
 
I assume you forgot a tab before the first for loop and that both iLoopCiv-for-loops have the same indentation.

I don't think it will work, because the iAddRoll will reset with every iteration of the first iLoopCiv-for-loop.
 
I assume you forgot a tab before the first for loop and that both iLoopCiv-for-loops have the same indentation.

I don't think it will work, because the iAddRoll will reset with every iteration of the first iLoopCiv-for-loop.

What if I merged the two for loops?
 
Because of the first loop, areas with only barbarians, natives or independents are prioritized of being resurrected. You will lose that prioritization when you merge the loops.
 
Back
Top Bottom