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

Found Map Seed For Existing Saves! [HEX EDITING]

Discussion in 'Civ6 - Creation & Customization' started by OldManBrian, Oct 23, 2016.

  1. OldManBrian

    OldManBrian Chieftain

    Joined:
    Oct 23, 2016
    Messages:
    3
    Gender:
    Male
    You have to break out a Hex Editor to convert it.

    I figured out the MAP seed is always EXACTLY 197 bytes after 'StandardMaps', which is around 2bc0

    It's 4 bytes for the map seed, then another 4 bytes for something else, then the 9th byte is always '03' for some reason.

    Look for this:

    Map Seed Something
    ## ## ## ## ## ## ## ## 03


    The Game seed is always going to be the Map seed minus 1.


    It works for positive numbers, for negative numbers you have to subtract FF FF FF FF minus the Map seed you find in your save. You'll know it's a negative seed because it's decimal value is higher than 2147483647.

    Just do the math, (Windows Calculator in Program mode is great for this) and you'll get the Map Seed, then just subtract that minus 1 and you'll get the game seed.

    Viola!
     
  2. ArcaneWeapon

    ArcaneWeapon Chieftain

    Joined:
    Oct 24, 2016
    Messages:
    3
    Gender:
    Male
    This doesn't work.

    I made a map with a Map Seed of 1006544174 which in Hex is 3b fe a5 2e. This pattern isn't found anywhere in in the save file. If I go to the location you instruct I find the following 9 byte sequence: 2d a5 fe 3b 93 e5 23 06 03. Converting the 1st 4 bytes results in the decimal value of 765853243, not even remotely close to my original seed.

    EDIT: I noticed an odd pattern with the 9 byte sequence, specifically those first 4 bytes.

    2d a5 fe 3b

    My map seed was 3b fe a5 2e. That's reversed and off by one, meaning it's the Game Seed. I tested this out 2 more times and every time it was 100% accurate, but for the Game Seed, not the Map Seed.

    EDIT 2: So the above edit works fine for positive seeds, but not negative ones. You still need to read the first 4 bytes in reverse order, so if the file has "ef39 0cdc" then it's actually "dc0c 39ef". This is 3691788783 which is larger than 2147483647 so it's negative. If we do ffff ffff - dc0c 39ef we get 23f3c610 which in decimal is 603178512. My Game Seed was -603178513 meaning that the value we calculated is the Map Seed if you negate it.

    LONG STORY SHORT:
    Get the 4 byte seed value as described in the first post. Make sure to reverse it. (aabb ccdd is really ddcc bbaa). If the value is under 2147483647 then it is your positive GAME Seed. If the value is over 2147483647 then you need to subtract it from ffff ffff (ffff ffff - your seed). The result of that calculation is your NEGATIVE MAP Seed. By default the Map Seed is always 1 larger than the Game Seed, so once you have one you have the other.

    Hope this helps. Note: I have a few maps with a 4 byte seed of 0200 0000 which when revered is just 2. I'm not sure what's happened in these cases, but I have no idea how to get the correct seeds for those maps.

    FINAL EDIT: I figured out the 0200 0000 seed values. This means you've taken turns in the game, the above instructions only work if the game is on the very first turn. If you see a seed of 0200 0000 then you need to search for the 03 ending pattern of the 9 byte sequence. There should be 4 in a row, with the 0200 0000 as the first of the 4 sequences. The FINAL sequence has the 4 byte map value that still follows the above rules, it's just not 197 bytes after the StandardMaps line.
     
    Last edited: Oct 25, 2016
    Noble Zarkon and pegasus515 like this.
  3. chiuyf

    chiuyf Chieftain

    Joined:
    Oct 25, 2016
    Messages:
    1
    Gender:
    Male
    It seems the 4 bytes between the game seed and 03 is always 93 e5 23 06. If so, it could be easier to locate the game seed.
     
    pegasus515 likes this.
  4. Urz

    Urz Chieftain

    Joined:
    Oct 24, 2016
    Messages:
    2
    Gender:
    Male
    I think this has been nailed thx to ArcaneWeapon. What chiuyf says seems to be right as far as I can tell. I wrote a step by step guide that should help people with even a very basic intelligence find their seeds (Like myself). (Also deleted my question to stop it from confusing people.)

    Before you start:
    You need a Hex-Editor. (Personally, I use a NotePad++ plugin, but there may be better choices.)
    A basic understanding of Hexadecimal helps but is not needed.

    Step 1. Finding the 4 bytes that represent your seed.
    Open your save game in your Hex-Editor of choice and search for the 5-byte sequence '93 e5 23 06 03'
    In front of this sequence, there will be 4 bytes, so the whole 9-byte sequence becomes. '## ## ## ## 93 e5 23 06 03'. The first 4 bytes of the 9-byte sequence represents your seed.

    Example: We use the search function to find '93 e5 23 06 03'. We add the 4 bytes before the sequence to get our 9-byte sequence. A 9-byte sequence from one of my games was 'd6 36 1a 34 93 e5 23 06 03'. That means that 'd6 36 1a 34' represents my seed.

    Aditional Note:
    There is another method for finding the four bytes that represent your seed. If the save file is on turn 1, the 9-byte sequence will be located 197 bytes after "StandardMaps" in your savefile. If the save file is on any other turn you will instead find a sequence that goes something like 02 00 00 00 ## ## ## ## 03. In that case, you need to manually count down to the forth occurrence of 03, which will mark your 9-byte sequence where the first 4-bytes represents your seed.

    Step 2. Converting the 4 bytes.
    When you have your 4 bytes '11 22 33 44' you need to convert them. The seed is for some reason stored with the bytes in reverse. Therefore you need to reverse their order so
    '12 21 34 43' becomes '43 34 21 12'

    Example: 'd6 36 1a 34' represents my seed. I reverse them to '34 1a 36 d6'.

    Step 3. Deciding if the seed is positive or negative.
    Hexadecimal is simply another numeral system just like the normal decimal system we normally use, which means Hexadecimal can be converted to normal decimal. This has to be done to get your seed.

    The conversion can be done quickly with either "binaryhexconverter.com" or simply by putting Windows Calculator into Programmer mode.

    When you convert you will get a normal number like '1212121212'.

    If your number is lower than "2,147,483,647" this will be your game seed and you can jump to step 5 to get your map seed. If the number is higher than "2,147,483,647" your game seed was negative. This means we have to do another step.

    Example for positive seed: I convert '341a36d6' on "binaryhexconverter.com". I get '874133206'. Since this is lower than '2,147,483,647' i now have my seed and I can jump to step 5.

    Example for negative seed: I do the same as above but instead I get '2232819802'. This is higher than '2,147,483,647' which means my seed is negative and proceed to step 4.


    Step 4. Converting a negative seed
    To convert a negative seed we need to go back to step 2 and get our converted hex-number. '44 33 22 11'. Now we need to subtract this value from the hex-value 'FF FF FF FF'. The easiest way to do this is on Windows Calculator set to Programmer mode.

    Do the calculation "FFFFFFFF-44332211". You will get a new hex value "BBCCDDEE". Convert this value to decimal (either via. the website or simply by pressing 'dec' under 'hex' in windows calculator. The decimal value is the seed.

    Example: We got the value '2232819802' in step 3. The hex-value for '2232819802' is '8516205a'.

    We do the calculation "FFFFFFFF-8516205a" and get the new value '7ae9dfa5'. We convert this value to decimal and get '2062147493'. We put this number in negative (*-1) and get '-2062147493'. This is our seed and we proceed to step 5.


    Step 5. Game seed and Map seed.
    Civ 6 uses two seeds. A game seed and a Map seed. If the seed we have found already is a positive seed it is our Game seed. If the seed we have found already is a negative seed it is our map seed.

    To get our Map seed for the positive seed, we need to add +1 to our game seed. A game seed of '1212121212' has the corresponding Map seed '1212121213'.

    To get our Game seed for the positive seed, we need to subtract -1 to our game seed. A neagtive map seed of '-1212121212' has the corresponding Game seed '-1212121213'.

    Example:
    We find the map seed for our positive seed: (874133206 + 1 = 874133206). We now have both seeds.

    We find the game seed for our negative seed: (-2062147493-1 = -2062147494). We now have both seeds.


    All credit goes to
    OldManBrian
    ArcaneWeapon
    chiuyf
    They were the smart people who actually figured all this stuff out.
     
    Last edited: Oct 26, 2016
    Noble Zarkon and pegasus515 like this.
  5. ArcaneWeapon

    ArcaneWeapon Chieftain

    Joined:
    Oct 24, 2016
    Messages:
    3
    Gender:
    Male
    Thanks for the easier to read explanation Urz. I just wrote one up and put it on Reddit, but honestly I like yours much more. There's one small mistake however. If you had a positive seed then you have a game seed, you got that right, however, if your seed was a negative seed the result of the subtraction is actually the map seed and not the game seed. So in your example -2062147493 is actually the map seed and the game seed would be -2062147494.

    Step 1 could also include the fact that all of this only works on turn 1 game saves. Otherwise the seed will be 0200 0000 indicating that turns have been taken. In this case the actual seed value has moved to the 4th "93 e5 23 06 03" pattern after 197 bytes instead of the 1st.
     
    Last edited: Oct 25, 2016
  6. Urz

    Urz Chieftain

    Joined:
    Oct 24, 2016
    Messages:
    2
    Gender:
    Male
    The method of searching for the 5 bytes '93 e5 23 06 03' seems to work for me for both turn 1 saves and saves with turns on them. You might run into a situation with more than one occurrence of '93 e5 23 06 03' but i doubt its something that will ever be a serious problem. I will add it at step 1 tho, that there is another method.

    I will definitely add the thing about negative seeds being the map seed and not the game speed. Why they decided to do it like that is beyond me.

    Edit: I also uploaded it to Reddit some hours ago. They will probably survive having two uploads.
     
    Last edited: Oct 25, 2016
  7. Hyronymus

    Hyronymus Troop leader

    Joined:
    Nov 25, 2003
    Messages:
    1,865
    Gender:
    Male
  8. bbbt

    bbbt Deity

    Joined:
    Oct 21, 2013
    Messages:
    2,120
    This is the sort of thing that just mystifies me about Firaxis - they have the seeds on the advanced setup the only purpose I can imagine is being able to replay/share maps/games. And then they don't make it easy to find after that. So many good ideas that are like 85% there - but not quite.
     
  9. pegasus515

    pegasus515 Chieftain

    Joined:
    May 4, 2014
    Messages:
    14
    is there a chance that we will get the exact value as 2,147,483,647?:eek: just curious

    btw, there s a typo in that sentence. i think you were trying to say "To get our Game seed for the negative seed, we need to subtract -1 to our map seed. "
     
    Last edited: Nov 2, 2016
  10. ArcaneWeapon

    ArcaneWeapon Chieftain

    Joined:
    Oct 24, 2016
    Messages:
    3
    Gender:
    Male
    Yes, but it's still positive in that case. It's only negative if it's larger.
     
    pegasus515 likes this.
  11. Chaoskampf Studios

    Chaoskampf Studios Chieftain

    Joined:
    Nov 25, 2016
    Messages:
    12
    Thanks everyone for the detailed info. Finally looked into this a bit further myself.

    I wrote a simple program with a GUI that just loads your save file and extracts the Game Seed and Map Seed, no manual poking around in binary data and fiddling about with hex numbers.

    It also should work with both randomly-generated and custom-chosen seeds, so doesn't depend on the Game Seed and Map seed being sequential numbers like guides above. Yay!

    But so far it's Windows only and I've only tested it on my own saves. Could use your help trying it out on your own games. The initial test release is posted in the download section here.
     
  12. Hyronymus

    Hyronymus Troop leader

    Joined:
    Nov 25, 2003
    Messages:
    1,865
    Gender:
    Male
    I just stumbled upon this and it works for the game seed, even with saved games from the latest patch. However, the map seed keeps returning a value 24.
     
  13. ray111

    ray111 Chieftain

    Joined:
    Mar 4, 2014
    Messages:
    79
    I guess it should be noted that seeds don't quite matter if you won't choose the same starting options. (which is a massive drag, as the stupid engine doesn't remember what you chose in the previous game)

    For example... my mistakes:
    1) I didn't save my game where I got a great map until like turn 100
    2) I chose RANDOM AIs and don't even remember their number

    Because of that, even if I use the seed from saved game, it places me somewhere ELSE on that map. Which is really damn bothersome, as I started on a nice, small, round continent I had for myself, with place for 4 coastal cities as Australia. Now when I start the same seed, it places me on some stupid snake-ish, river-less continent 4 tiles from a city state. I tried using the seed with THE SAME OPTIONS/AIs, it placed me in the exact same spot (just couple of resources nearby were different)
     
  14. Magma_Dragoon

    Magma_Dragoon Reploid

    Joined:
    May 10, 2008
    Messages:
    2,354
    Do you have new mods installed since then? I think that will change things. The met player icons at the top may be in slot order (never manually chosen players so idk). If not maybe you can use firetuner to see which slot each player is in.
     
  15. ray111

    ray111 Chieftain

    Joined:
    Mar 4, 2014
    Messages:
    79
    well, I was actually quite stupid, I later FOUND the save from that game, on turn 1. It's just.. that continent was so randomly good, that I hit Medieval with 5 cities (each 10+ pop, capital 17 pop) while all the rest of civs were struggling in mid-classical. With all these mods adding new buildings (and AI being stupid about them apparently, only dishing out units), I should play on immortal or deity. King makes me... well... king, around turn 100, and I only gain larger advantage since. Not to mention Australia's absurdly high production bonus for war (not to mention my continent had lots of desert and floodplains, which with modified Lady of Reeds belief added a lot of production). I dished out 10 units and several buildings in my cities because Peter declared war on me, despite only having ONE ship he could get over to my continent lol.
     

Share This Page