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

Shared AND/C2C Debug codes

Discussion in 'Bugs and Crashes' started by Thunderbrd, May 5, 2014.

  1. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
  2. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,094
    Gender:
    Male
    Location:
    Las Vegas
  3. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    I added a new struct, CvLandmarkData to store the 3 landmark fields in CvPlot with the goal of saving 8 bytes per CvPlot instance, but I have issues retaining save compatibility with the changes. I tried to read the data into fields with the same names as the old fields but I am clearly doing something wrong, because the data mismatches and is not loaded.

    Here is a diff of my changes: https://dl.dropboxusercontent.com/u/49805/CvLandmark.patch
     
  4. alberts2

    alberts2 Chieftain

    Joined:
    Aug 16, 2012
    Messages:
    1,939
    Gender:
    Male
    Location:
    Germany
    I have to look at that later after work.
     
  5. alberts2

    alberts2 Chieftain

    Joined:
    Aug 16, 2012
    Messages:
    1,939
    Gender:
    Male
    Location:
    Germany
    Sorry for the late answer, i changed the three marked lines and it's working.


    Code:
    	[B][COLOR="Red"]CvWString m_szLandmarkMessage;
    	CvWString m_szLandmarkName;[/COLOR][/B]
    	if (GC.getLoadedInitCore().getGameSaveSvnRev() <= 782)
    	{
    		WRAPPER_READ_STRING(wrapper, "CvPlot", m_szLandmarkMessage);
    		WRAPPER_READ_STRING(wrapper, "CvPlot", m_szLandmarkName);
    	}
    
    	WRAPPER_READ(wrapper, "CvPlot", &m_eClaimingOwner);
    	if (GC.getLoadedInitCore().getGameSaveSvnRev() <= 782)
    	{
    		[B][COLOR="Red"]LandmarkTypes m_eLandmarkType = NO_LANDMARK;[/COLOR][/B]
    		WRAPPER_READ(wrapper, "CvPlot", (int*)&m_eLandmarkType);
    
    		m_pLandmark = NULL;
    		if (m_eLandmarkType != NO_LANDMARK)
    		{
    			m_pLandmark = new CvLandmarkData;
    			m_pLandmark->eLandmark = m_eLandmarkType;
    			m_pLandmark->szLandmarkMessage = m_szLandmarkMessage;
    			m_pLandmark->szLandmarkName = m_szLandmarkName;
    		}
    	}
     
  6. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
  7. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,094
    Gender:
    Male
    Location:
    Las Vegas
    Well done Afforess! We'll have to adapt that in as soon as we can find the time to do so. Excellent work :D
     
  8. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    On further reflection since last night, I am leaning towards suggesting altering the zobrist plot cache to be serialized in game saves in addition to the async change. If the cache is created in an async manner, it may cause clients to go OOS because it will break the deterministic nature of the game (each client will have a separate and distinct and unique cache, and the interactions of their game state and the cache may cause slight differences in game behavior over the course of the game, which will create a *very* hard to debug OOS). It seems easier to sidestep this entire possibility by serializing the cache to saves, and by extension, MP sessions. This eliminates the possibility of future OOS issues from cache differences.

    When I write this up, I will create a diff for you.
     
  9. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    26,094
    Gender:
    Male
    Location:
    Las Vegas
  10. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas

Share This Page