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

OOS-Problems and interpreting MPLog.txt

Discussion in 'Civ4 - SDK/Python' started by Alrik2002, Dec 22, 2013.

  1. Alrik2002

    Alrik2002 Warlord

    Joined:
    May 24, 2012
    Messages:
    214
    Location:
    Berlin, Germany
    Hi,

    we run a game on a pitboss server and now we have several OOS. I´m using a modified Version of Gerike´s OOSLogger and it shows me, that the gamestats of the humans are the same but the pitboss differs in several points (f.e. tiles of units, buildings that the AI is working on).

    The OOS occur also, when only one player is logged in and ends the turn.

    So I´ve looked in fireaxis MPLog.txt. I´ve looked for first Rand which differs and which is not one of the ASYNC ones. Then I´ve seen, that only the order of the Rands are different like this:

    player:
    Code:
    Rand = 2136312025 on 16087895 (AI Best Building)
    Rand = 938709662 on 16087895 [COLOR="Red"](AI Best Building)[/COLOR]
    Rand = -1919565441 on 16087895 (AI Best Building)
    Rand = -789428916 on 16087895 (AI Best Building)
    Rand = -1391666795 on 16087895 (AI Best Building)
    Rand = -1224590678 on 16087895 (AI Best Building)
    Rand = 592377499 on 16087895 (AI Best Building)
    Rand = 782527032 on 16087895 [COLOR="Red"](Wonder Construction Rand)[/COLOR]
    pitboss-server:
    Code:
    Rand = 2136312025 on 16087895 (AI Best Building)
    Rand = 938709662 on 16087895 [COLOR="Red"](Wonder Construction Rand)[/COLOR]
    Rand = -1919565441 on 16087895 (AI Best Building)
    Rand = -789428916 on 16087895 (AI Best Building)
    Rand = -1391666795 on 16087895 (AI Best Building)
    Rand = -1224590678 on 16087895 (AI Best Building)
    Rand = 592377499 on 16087895 (AI Best Building)
    Rand = 782527032 on 16087895 [COLOR="Red"](AI Best Building)[/COLOR]
    There are many differents like this and I´ve no idea where this is coming from and how I can solve it.

    Later on in the logfiles, they differ more and more, as far as I can see it mostly the order of the rands is different.

    At another place I´ve different rand numbers although the numbers before and afterwards are the same. I thought the numbers have to be the same...:confused:

    player:
    Code:
    Rand = 2109463015 on 16087895 (AI Upgrade)
    Rand = [COLOR="Red"]1400470899[/COLOR] on 16087895 [COLOR="Red"](First Strike)[/COLOR]
    Rand = [COLOR="Red"]-924474320[/COLOR] on 16087895 [COLOR="Red"](First Strike)[/COLOR]
    Rand = -1360152407 on 16087895 [COLOR="Red"](Combat)[/COLOR]
    Rand = -1523495378 on 16087895 [COLOR="Red"](Combat)[/COLOR]
    Rand = -2124120625 on 16087895 [COLOR="Red"](Combat)[/COLOR]
    Rand = -1824992420 on 16087895[COLOR="Red"] (Combat)[/COLOR]
    Rand = -725600667 on 16087895[COLOR="Red"] (Combat)[/COLOR]
    Pitboss-Server:
    Code:
    Rand = 2109463015 on 16087895 (AI Upgrade)
    Rand = [COLOR="Red"]-183871084[/COLOR] on 16087895 [COLOR="Red"](AI Upgrade)[/COLOR]
    Rand = [COLOR="Red"]1496017981[/COLOR] on 16087895 [COLOR="Red"](AI Upgrade)[/COLOR]
    Rand = -1360152407 on 16087895 [COLOR="Red"](AI Explore)[/COLOR]
    Rand = -1523495378 on 16087895 [COLOR="Red"](AI Explore)[/COLOR]
    Rand = -2124120625 on 16087895 [COLOR="Red"](AI Explore)[/COLOR]
    Rand = -1824992420 on 16087895 [COLOR="Red"](AI Explore)[/COLOR]
    Rand = -725600667 on 16087895 [COLOR="Red"](AI Explore)[/COLOR]
    Now my questions:
    1. I know how I can find the points in the SDK where these rands are called, but why is the order different?
    2. How can I find and solve the problem?
    3. When the "rand number generator" makes the same list on every machine, which is used for the rands, how can it be, that two numbers differ when all the numbers above and below are the same?

    Thank you very much for your help.
     
  2. Alrik2002

    Alrik2002 Warlord

    Joined:
    May 24, 2012
    Messages:
    214
    Location:
    Berlin, Germany
    Ok. I tracked the OOS-error down to the following code in the GameUtils.py, where I´ve added a wonder of platyping. When it ends true the OOS occurs.

    Code:
    	def cannotConstruct(self,argsList):
    		pCity = argsList[0]
    		eBuilding = argsList[1]
    		bContinue = argsList[2]
    		bTestVisible = argsList[3]
    		bIgnoreCost = argsList[4]
    
    		iPlayer = pCity.getOwner()
    		pPlayer = gc.getPlayer(iPlayer)
    		pTeam = gc.getTeam(pPlayer.getTeam())
    ## Grand Canal Start ##
    [COLOR="Red"]		if eBuilding == gc.getInfoTypeForString("BUILDING_GRAND_CANAL"):
    			if CyMap().getLandPlots() * 100 /CyMap().numPlots() > 75:
    				return True
    			if pCity.isCoastal(10):
    				return True
    			if pCity.plot().isRiver():
    				return True[/COLOR]
    ## Platyping Wonders End ##
    		return False
    
    Has anyone an idea why the code results in an OOS? I assume the problem is in the DLL because I don´t see any problem in the python-code.

    What should I look for in the DLL? I´m using the K-Mod as a base for my Mod.

    Thx!
     

Share This Page