Balancing citystates: ignore/capture/alliance

You could try this... add a logger line in CiVUP_General.lua:

Code:
function MinorCivStartingDefenders(minorCiv)
    if Game.GetGameTurn() == 2 and minorCiv:IsMinorCiv() then
        logger:Error("MinorCivStartingDefenders "..minorCiv:GetName())
        local capitalCity = minorCiv:GetCapitalCity()
        if capitalCity then
            minorCiv:InitUnit( GameInfo.Units.UNIT_ARCHER.ID,  capitalCity:GetX(), capitalCity:GetY() );
            minorCiv:InitUnit( GameInfo.Units.UNIT_WARRIOR.ID, capitalCity:GetX(), capitalCity:GetY() );
            minorCiv:InitUnit( GameInfo.Units.UNIT_WARRIOR.ID, capitalCity:GetX(), capitalCity:GetY() );
        end
    end
end
Then...

  1. save the file
  2. start a game
  3. open the tuner
  4. end your turn until the text shows up
  5. copy-paste it here

To be clear, I pasted the above right after the

------------
------------

that follow the MapModData.TBC lines at the top of the page, and above "functionBalancePromotions."

I encountered a CS on my second turn, and it had zero units.

FireTuner is on "Main State," and the readings are "Users/etc/CiVUP - Civ V," all the way down the page. I didn't have these sorts of readings before, so apparently FireTuner is improperly set, but I don't know how to adjust it.
 
I couldn't highlight it in the block, but what I meant was to find the already-existing "MinorCivStartingDefenders" function and just add the "logger:Error" line, so it tells you whenever it runs. For example, here's what happens in my games, and should always occur:

Code:
\CiVUP - Event Registration: INFO   GiveDoFResearch(Catherine)
\CiVUP - Event Registration: INFO   GiveMinorCivAllianceRewards(Catherine)
\CiVUP - Event Registration: DEBUG  CheckNewBuildingStats(Moscow, Catherine)
\CiVUP - Event Registration: DEBUG  CheckNewBuildingStats(Edinburgh, Edinburgh)
\CiVUP - Event Registration: DEBUG  CheckNewBuildingStats(Cape Town, Cape Town)
\CiVUP - Event Registration: DEBUG  CheckNewBuildingStats(Oslo, Oslo)
\CiVUP - Event Registration: DEBUG  CheckNewBuildingStats(Sidon, Sidon)
\CiVUP - Event Registration: INFO   GiveDoFResearch(Catherine)
\CiVUP - Event Registration: INFO   GiveMinorCivAllianceRewards(Catherine)
\CiVUP - Event Registration: DEBUG  CheckNewBuildingStats(Moscow, Catherine)
\CiVUP - Event Registration: DEBUG  MinorCivStartingDefenders Edinburgh
\CiVUP - Event Registration: DEBUG  CheckNewBuildingStats(Edinburgh, Edinburgh)
\CiVUP - Event Registration: DEBUG  MinorCivStartingDefenders Cape Town
\CiVUP - Event Registration: DEBUG  CheckNewBuildingStats(Cape Town, Cape Town)
\CiVUP - Event Registration: DEBUG  MinorCivStartingDefenders Oslo
\CiVUP - Event Registration: DEBUG  CheckNewBuildingStats(Oslo, Oslo)
\CiVUP - Event Registration: DEBUG  MinorCivStartingDefenders Sidon
\CiVUP - Event Registration: DEBUG  CheckNewBuildingStats(Sidon, Sidon)
\CiVUP - Event Registration: INFO   GiveDoFResearch(Catherine)

attachment.php


MinorCivStartingDefenders runs once for each citystate, placing 2 warriors and 1 archer at the end of turn 2.
 

Attachments

  • CitystateDefenders.JPG
    CitystateDefenders.JPG
    84.1 KB · Views: 478
I couldn't highlight it in the block, but what I meant was to find the already-existing "MinorCivStartingDefenders" function and just add the "logger:Error" line, so it tells you whenever it runs.

I pasted in the "logger:Error" line, without the ("MinorCivStarting...) line you had in one of your posts, partly because that line was incomplete, and partly because I wasn't sure if you wanted me to use it.

The game started by not allowing me to choose a build or a tech. Here is the FireTuner readout on that:

Application: FireTuner2
User: Unkown (Not an in-house user.)
Time: Tuesday 3/22/2011 10:26:29 AM

Runtime: 64 bit
OS: Windows 2008 ()
Machine: CATIEDID-DTOP

Exception: System.FormatException
Source: mscorlib
Thread: Main Thread
Description: Input string was not in a correct format.

Stack Trace:
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)

at System.Number.ParseUInt32(String value, NumberStyles options, NumberFormatInfo numfmt)

at FireTuner2.LuaStateManager.OnLuaStatesRecieved(List`1 luaStateStrings)

at FireTuner2.Connection.RouteMessages()

at FireTuner2.frmMainForm.tmrProcessMessages_Tick(Object sender, EventArgs e)

at System.Windows.Forms.Timer.OnTick(EventArgs e)

at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
 
I tried it again with the logger error line including the stuff in parentheses, and the game functioned properly (although still having too many CS units, of course).

This time when I ran FireTuner, I once again received a page full of (Users/...., etc) lines.

Again, is there a way to set FireTuner so I get the desired results?
 
There's nothing to set, you just open the tuner and you're done. Did you try scrolling the screen to the right? It shows the full path for file names, so it's very wide.
 
There's nothing to set, you just open the tuner and you're done. Did you try scrolling the screen to the right? It shows the full path for file names, so it's very wide.

Yes, the information was all the way to the right. I played through 4 turns, so there's much more than you need here. Obviously let me know if you need more, or if I could edit this for you in the future.


\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Free Research Balance\DiscoverMission: Warning: cache not shared.
InfoAddictHistoricalData: INFO: loadPlayerDataTable() from 2 to 3 took 0.0020000000000095s to complete.
InfoAddictHistoricalData: INFO: Total time for DrawGraph(score): 0.00099999999997635s
InfoAddictCivRelations: INFO: Total time to build political view: 0.0029999999999859s
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveMinorCivAllianceRewards(Pachacuti)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Cusco, Pachacuti)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveMinorCivAllianceRewards(Harun al-Rashid)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Mecca, Harun al-Rashid)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveMinorCivAllianceRewards(Oda Nobunaga)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Kyoto, Oda Nobunaga)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveMinorCivAllianceRewards(Ramesses II)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Thebes, Ramesses II)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveMinorCivAllianceRewards(Hiawatha)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Onondaga, Hiawatha)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveMinorCivAllianceRewards(Genghis Khan)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Karakorum, Genghis Khan)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveMinorCivAllianceRewards(Suleiman)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Istanbul, Suleiman)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Brussels, Brussels)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Venice, Venice)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Kuala Lumpur, Kuala Lumpur)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Edinburgh, Edinburgh)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Seoul, Seoul)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Cape Town, Cape Town)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Almaty, Almaty)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Belgrade, Belgrade)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Oslo, Oslo)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Lhasa, Lhasa)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Budapest, Budapest)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Stockholm, Stockholm)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Geneva, Geneva)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Monaco, Monaco)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Dublin, Dublin)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Hanoi, Hanoi)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveMinorCivAllianceRewards(Washington)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: DEBUG CheckNewBuildingStats(Washington, Washington)
Runtime Error: [string "C:\Users\Catiedid\Documents\My Games\Sid Me..."]:37: attempt to index a nil value
Runtime Error: [string "C:\Users\Catiedid\Documents\My Games\Sid Me..."]:37: attempt to index a nil value
Runtime Error: [string "C:\Users\Catiedid\Documents\My Games\Sid Me..."]:37: attempt to index a nil value
Runtime Error: [string "C:\Users\Catiedid\Documents\My Games\Sid Me..."]:37: attempt to index a nil value
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveDoFResearch(Pachacuti)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveDoFResearch(Harun al-Rashid)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveDoFResearch(Oda Nobunaga)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveDoFResearch(Ramesses II)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveDoFResearch(Hiawatha)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveDoFResearch(Genghis Khan)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveDoFResearch(Suleiman)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Core\CiVUP - Event Registration: INFO GiveDoFResearch(Washington)
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Free Research Balance\DiscoverMission: Warning: cache not shared.
\Users\Catiedid\Documents\My Games\Sid Meier's Civilization 5\MODS\Unofficial Patch and Thals Balance (v 62)\CiVUP - Civ V Unofficial Patch\Free Research Balance\DiscoverMission: Warning: cache not shared.
InfoAddictHistoricalData: INFO: loadPlayerDataTable() from 3 to 4 took 0.0020000000000095s to complete.
 
Did you add the logger line? There's nothing from MinorCivStartingDefenders; what we're looking for is info similar to what I posted above. :)

Basically what I'm saying is to add this line:
logger:Error("MinorCivStartingDefenders "..minorCiv:GetName())

...to here:
MinorCivStartingDefenders

...then see how many times it prints. For me it runs 1 time for each citystate, producing 3 units per citystate. I want to check if for some reason it's running multiple times for you, and creating 6 or 9 units. I can't test this on my own system because the problem doesn't happen for me.
 
Did you add the logger line? There's nothing from MinorCivStartingDefenders; what we're looking for is info similar to what I posted above. :)

Basically what I'm saying is to add this line:
logger:Error("MinorCivStartingDefenders "..minorCiv:GetName())

...to here:
MinorCivStartingDefenders

...then see how many times it prints. For me it runs 1 time for each citystate, producing 3 units per citystate. I want to check if for some reason it's running multiple times for you, and creating 6 or 9 units. I can't test this on my own system because the problem doesn't happen for me.

I have it pasted in as below. Is this correct?
 
I tried a different tack. My girlfriend's game doesn't have this problem. So I had her download her Mod, Cache and ModUserdata folders, as well as her ini and config files, onto a flash drive, and then swapped them out with my own files. Now I'm getting only 3 units per CS. So whatever... problem solved.

By the way, were any of the files I swapped totally irrelevant?
 
A not-so-great follow-up: playing America on 6.2 with Info Addict, a Granary and Pioneer Fort (the latter just built) I went from size 10 in Washington with 9 turns to go for growth to size 13. This had happened as well in my earlier games where the CS also started at size 10.

The problem may well be the Pioneer Fort.

EDIT: or there is no problem, and the PF is capable of such explosive growth. It's happening in all my cities with a PF.

I reloaded to the turn before, turned on FireTuner, but it was disconnected. I then went into the config file and set it to "1," but it remains disconnected. Could this have anything to do with having swapped the files I mentioned in my prior post (unlikely) or the fact that I'm changing the setting on the fly mid-game?

Let me know if you want me to move this to a separate thread.
 
It does help to post each issue in its own thread on the bug & beta forum.

I doubt changing out the config and INI files would have anything to do with the citystate problem you encountered.

CheckNewBuildingStats in CiVUP_General.lua prints out how much food the pioneer fort gives a city each turn. If you set its logger to LOG_DEBUG you'll see that information in the tuner.

Did you restart Civilization after enabling the tuner in the config file? It only reads that file when the game starts. Changing settings mid-game is irrelevant because the tuner connects regardless of if we're in a game or at the main menu.
 
It does help to post each issue in its own thread on the bug & beta forum.

I doubt changing out the config and INI files would have anything to do with the citystate problem you encountered.

CheckNewBuildingStats in CiVUP_General.lua prints out how much food the pioneer fort gives a city each turn. If you set its logger to LOG_DEBUG you'll see that information in the tuner.

Did you restart Civilization after enabling the tuner in the config file? It only reads that file when the game starts. Changing settings mid-game is irrelevant because the tuner connects regardless of if we're in a game or at the main menu.

Thanks for the info on config and INI files. I didn't restart the game after enabling the tuner, but I'm in a new game now.

I'll try setting the logger as you described.

I'll start new posts.
 
Back
Top Bottom