Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

State transfer table

transfer_game() in SAVE.C transfers the following fields in order. Offsets are measured from the start of the SVE file. Near and far describe the source address space; both write the listed number of bytes.

The total length is 37,856 bytes (0x93e0).

OffsetBytesVariableTransferUse
0x00002turn_ticknearTurn number
0x00022civnownearActive player index
0x00042human_setnearCivilizations under human control
0x00062map_rng_statenearRNG seed
0x00082yearnearCalendar year
0x000a2cur_tiernearDifficulty level (0..4)
0x000c2playersnearLiving civilization bitmask
0x000e2selected_indexnearAdvance being researched by the player
0x0010112leader_namesnearLeader names (8 × 14)
0x008096civ_namesnearCivilization names (8 × 12)
0x00e088civ_adjectivesnearAdjectives (8 × 11)
0x013816moneynearGold reserves (8 × int16)
0x014816civ_research_tallynearResearch accumulated toward the next advance (8 × int16)
0x0158448forces_presentnearUnits in play per civilization and type (8 × 28 × int16)
0x0318448civ_units_orderednearCities building each unit type (8 × 28 × int16)
0x04d816tech_countnearAdvances known per civilization (8 × int16)
0x04e880advances_knownnearKnown-advance bitmasks (8 × 5 × int16)
0x053816civ_govnearGovernment type (8 × int16)
0x0548256civ_area_plannearAI policy per civilization and continent (8 × 16 × int16)
0x0648128treatiesnearBilateral relations matrix (8 × 8 × int16)
0x06c816city_countnearCities per civilization
0x06d816troops_totalnearNon-settler units per civilization
0x06e816civ_held_cellsnearCoarse 4 × 4 map cells holding own units or cities
0x06f816civ_settlers_nnearSettlers per civilization
0x070816citizensnearTotal city sizes per civilization
0x071816military_tablenearMilitary strength: attack plus defence of all units
0x072816nation_ratingsnearCivilization power ranking
0x073816civ_tollnearTax rate in tenths (8 × int16)
0x074816civ_ratingsnearHistorical victory score
0x075816last_met_turnnearTurn of the last audience with each civ (+16 after a refusal, -2 when destroyed)
0x076816x_capnearX of the capital; centres map views
0x077816civ_tribe_ofnearTribe template type
0x0788256defenders_islandnearDefence strength per civilization and continent
0x0888256civ_cont_attackersnearAttack strength per civilization and continent
0x0988256ai_continent_townsnearCities per civilization and continent
0x0a88256continent_spannearTiles per land region, then per sea region (2 × 64 × int16)
0x0b8832ai_zone_placesnearGood city sites per continent (16 × int16)
0x0ba81,200power_historyfarCivilization power history (150 samples × 8)
0x10581,200war_recordfarCivilizations each civ was at war with, sampled every 4 turns (150 × 8 masks)
0x15083,584townbufnearThe 128 City Records (128 × 28 bytes)
0x2308952utypesnearThe 28 Unit Types (28 × 34 bytes)
0x26c012,288armydatanearThe 1,024 Active Units (8 × 128 × 12 bytes)
0x56c04,000map_visible_tofarPer-civilization tile visibility bits (80 × 50)
0x6660128spot_classesnearAI site kind per civilization and slot
0x66e0128ai_camp_site_weightsnearAI site weight per slot
0x6760128camp_xposnearAI site X per slot
0x67e0128civ_lot_ynearAI site Y per slot
0x6860144advance_ownersfarFirst discoverer of each advance
0x68f0128killednearBilateral casualty counters (8 × 8 × int16)
0x69703,328place_namefarCity Name Pool (256 × 13 bytes null-padded)
0x76702replay_lengthnearBytes used in replay_log
0x76724,096replay_logfarReplay event log
0x867244marvel_sitenearThe 22 Wonders (22 × int16 city indices)
0x869e448unit_lossesfarUnits lost per civilization and type (8 × 28 × int16)
0x885e576adv_sourcefarTechnology discovery tracking
0x8a9e2pollutednearGlobal pollution tile counter
0x8aa02warm_levelsnearGlobal warming risk (0..99; warming strikes above 16)
0x8aa22warmingnearGlobal warming event stage
0x8aa42debugnearDebug cheat flag
0x8aa6260block_ground_waynearLand connectivity of coarse 4 × 4 map cells (20 × 13)
0x8baa2max_ratingnearAll-time highest score
0x8bac2advances_futurenearFuture Technology advances discovered
0x8bae2rule_optionsnearGame rule flags (all set at the start)
0x8bb016scinearScience slider rate (8 × int16)
0x8bc02next_event_turnnearScheduled historical event turn
0x8bc216history_ratingnearHistorian ranking points; [0] counts reports
0x8bd21,440spaceshipsfarSpaceship layouts (8 × 15 × 12)
0x91722game_flagsnearSpaceship flags: bits 0–7 launched, 8–15 built
0x91742ship_successnearHuman spaceship success chance, percent
0x91762ai_ship_successnearAI spaceship success chance, percent
0x917816spaceship_arrive_datesnearSpaceship arrival year (8 × int16, -1 none)
0x918824floors_palacenearPalace architectural room heights
0x91a024section_gradesnearPalace architectural styles (Classical, etc.)
0x91b8256city_site_xfarProposed city site X
0x92b8256city_site_yfarProposed city site Y
0x93b82palace_stagenearPalace upgrade completion stage
0x93ba2player_peace_runnearPeaceful turns since the last non-barbarian battle (counted in AD)
0x93bc2civ_totalnearTotal living civilizations count
0x93be16space_ship_habitationnearHabitation modules per civilization
0x93ce16liftoff_whennearSpaceship launch year per civilization
0x93de2civ_flags_bitsnearMaster civilization bitflags