Announcement

Collapse
No announcement yet.

memory flags?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • memory flags?

    Hi, im learning how to read hex, and i wanna experiment with civilization 3 and create some cheats no one has made before. I want to make all building of roads, railroads, chopping trees, mines, irrigation, take 1 turn only. I also want to make it so your main city gets all resources and freezes it at 5 or something. I've looked at civilization3.exe with a decompiler and dont know where to start. Is there any guides on how to know what the memory flags do and commands? I know lots of people would frown apon this because it might hurt multiplayer, but i am doing it solely for my self in single player and i want to learn how to anyways. I'm also attempting to learn C++ and knowledge of how prossesses work is nessasary so this game is where ill start. Can someone point out some guides or something plz?

  • #2
    That information is stored in the save file once the game is started. You'll need to find out the compression scheme they used, Gramphos knows it I think. Theres some really old threads on the format of the save file around here somewhere, I'll try to find it.

    Comment


    • #3
      Hey Savegame-Editor-Programmers!

      I would like to have all available infos or sourcecode about accessing and manipulating the SAV-files, please.




      Gramphos
      ACS Civ III Files Manager
      Sweden

      Apr 2001

      17-12-2001 08:21



      What would you use it for?

      The reason why I haven't given anything out, other then to other programmers, is that there are competitive games, and the fact that most of what I have are really hard to understand.


      __________________
      Minister of Science - the Democracy Game
      I've my email back for the weekend, but I might lose it on Monday again.
      Ruotsi on maailman paras maa!
      ACS Civ III Files Manager



      hot-bandito
      Settler
      Eschweiler, Germany

      Dec 2001

      17-12-2001 09:01



      I want to know, if itīs possible to program a kind of email-multiplayer: Player1 saves the game, sends it to a friend (player2), player2 alters the savegame (switching the human-controlled civ), loads the savegame, makes the turn, saves the game and so on...




      Keygen
      King
      Athens, Hellas

      Jan 2000

      17-12-2001 09:24



      quote:

      Originally posted by hot-bandito
      I want to know, if itīs possible to program a kind of email-multiplayer: Player1 saves the game, sends it to a friend (player2), player2 alters the savegame (switching the human-controlled civ), loads the savegame, makes the turn, saves the game and so on...



      This might get implemented in a future patch by Firaxis, a feature called PBEM and already in use in Alpha Centauri and Call To Power.




      Gramphos
      ACS Civ III Files Manager
      Sweden

      Apr 2001

      17-12-2001 09:42



      Nothing of want I know could be used for this. (I don't know where it stores what civ is human controlled)


      __________________
      Minister of Science - the Democracy Game
      I've my email back for the weekend, but I might lose it on Monday again.
      Ruotsi on maailman paras maa!
      ACS Civ III Files Manager



      hot-bandito
      Settler
      Eschweiler, Germany

      Dec 2001

      17-12-2001 16:39



      quote:

      Originally posted by Gramphos
      What would you use it for?

      The reason why I haven't given anything out, other then to other programmers, is that there are competitive games, and the fact that most of what I have are really hard to understand.



      If itīs written in VB, I will understand. If itīs written in C, it will take some time...




      Merp
      Settler
      Brisbane, Australia

      Dec 2001

      17-12-2001 17:51



      It is reasonable to release the format of the file because then it is useful for any programming language: VB, C, C++, asm, Java, Pascal, Haskell, etc. Rather than wade through someone else's source, the format lays it all out and shows what we know and don't know.

      Release of source is always at the descretion of the author. Having said that I think cooperative enterprises like civ3 prosper more from opensource style arrangements.


      __________________
      Ut sementem feceris ita metes.
      ~ As you sow so will you reap.
      ----Cicero

      Last edited by Merp on 17-12-2001 at 18:03



      Gramphos
      ACS Civ III Files Manager
      Sweden

      Apr 2001

      18-12-2001 06:31



      Well, but I don't know very mush about the format, and it is mostly the source code that makes the job. If I ever get an understandable description of the format I might publish it. As far as source code I'm more restrictive, not that this is anything to protect, but there might be other code that I don't want to get out. And if something doesn't work properly I don't want to tell everyone what changes to make.

      So, you have to wait until I know more about the format myself.


      __________________
      Minister of Science - the Democracy Game
      I've my email back for the weekend, but I might lose it on Monday again.
      Ruotsi on maailman paras maa!
      ACS Civ III Files Manager



      Whoha
      Chieftain


      Dec 2001

      19-12-2001 10:55

      havent done alot of work into this but...

      heres what ive got

      In the file theres a string TILE that marks the beginning of each one

      then a long int of 28(havent seen this vary at all)

      then another long int which I do not know what it means

      The next long int is the resource one
      0-21 means the resources and ff ff ff ff means no resource
      (thats all the resources 0-7 strategic, 8-15 luxury,16-21 bonus)

      then 2 more long ints that i dont know about

      then the terrain and enhancement controllers long int
      The first one is a bitwise operator with each of the bits meaning
      road RR Mine irrigation fort goodie-hut pollution camp
      or lemme try out the other way of writing it i saw
      first byte 0 0 0 0 0 0 0 0
      road 1 0 0 0 0 0 0 0
      RailRoad 0 1 0 0 0 0 0 0
      Mine 0 0 1 0 0 0 0 0
      Irrigation 0 0 0 1 0 0 0 0
      Fort 0 0 0 0 1 0 0 0
      Goodie-Hut 0 0 0 0 0 1 0 0
      Pollution 0 0 0 0 0 0 1 0
      Barbarian Camp 0 0 0 0 0 0 0 1

      The second and third bytes arent bitwise as far as i can tell, they control terrain
      2nd byte 3rd byte value
      Desert
      0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

      Plains
      1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 17 0
      Grassland
      0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 34 0
      Grassland_Bonus
      0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 34 1
      Flood PLains
      0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 64 0
      Hills
      0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 82 0
      Mountains
      0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 98 0
      Forest_Grassland
      0 0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 114 0
      Jungle_Grassland
      0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 130 0
      Coast
      1 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 153 0
      Snow-Tipped Mountains
      0 1 0 0 0 1 1 0 0 0 0 0 1 0 0 0 98 16
      Pine Forests_Grassland
      0 0 1 0 1 1 1 0 0 0 0 0 0 1 0 0 114 32
      Ocean
      1 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 187 0
      Forest_Plains
      1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 97 0

      I dont know about the forest plains one, im just assuming thats what it is, also i havent checked what sea squares are yet.
      I also dont know what the 4th byte here means.

      Also I understand that the tiles are marked in this particular way:
      say you have a 4x4 map, heres the order in the file the tiles would appear the the isometeric nature of the map makes this alittle difficult to understand at first.

      1 2 3 4
      5 6 7 8
      9 10 11 12
      13 14 15 16

      Also tiles dont contain unit info, thats stored later under strings marked unit




      Whoha
      Chieftain


      Dec 2001

      19-12-2001 11:13

      doh cant edit it

      sorry about the spacing




      Gramphos
      ACS Civ III Files Manager
      Sweden

      Apr 2001

      19-12-2001 14:55



      Yes, that is the map format, the easiest thing in the SAVs. The first part of it is almost the same as the one in the BIC.

      However there is a few things that is in another way then you stated.:
      that first long int is the remaining length of the section.
      After that comes one byte of riverinfo. (I don't know exactly how it works yet)
      Then one byte with the ingame id of the civ that has that tile in its border (-1 = NO CIV)
      the two next bytes are unknown for me.

      then, as you said the Resource# and 2 unknown long values.

      For the terrain it is as you said first a bitwise byte of overlays.
      After that is however two nibbles with the terraininfo. The first nibble is the actual terrain, and the second nibble the base terrain (used with mountains and forests). After that there is a short int that is bitwise for the bonuses. I see the BIC-format for more info on what the meaning of the bits are.
      Then there are an unknown short (-1 = nothing, 75 = barbarian camp), an long, and then a short with the continent ID


      __________________
      Minister of Science - the Democracy Game
      I've my email back for the weekend, but I might lose it on Monday again.
      Ruotsi on maailman paras maa!
      ACS Civ III Files Manager



      hot-bandito
      Settler
      Eschweiler, Germany

      Dec 2001

      20-12-2001 06:18



      Here's some info from CTYSON on structures in the save files. While I start by searching for the "packet IDs", you can't rely on them alone because they are often repeated with different meanings...e.g. there are at least 3 "WRLD" packets, and each city has 5 "CITY" packets. Also, the save files are full of random junk data which sometimes imitates packet IDs.

      World...search for "WRLD"

      Pos Len
      0: 4: "WRLD" packet ID
      4: 4: data-length of packet (always $0002?)
      8: 2: unknown
      10: 4: "WRLD" packet ID (but I continue to count from the 1st)
      14: 4: data-length of packet
      22: 4: Y-size of world
      42: 4: X-size of world


      Players...search for "LEAD"

      Pos Len
      0: 4: "LEAD" packet ID
      4: 4: data-length of packet (always $1174?)
      8: 4: player number (range 0-31, in ascending order. 0 is
      always
      Barbarian; human is currently always 1)
      12: 4: race of player's civilization (range 0-16)
      232: 4: current research project


      Units...search for "UNIT"

      Pos Len
      0: 4: "UNIT" packet ID
      4: 4: data-length of packet (always $0121?)
      8: 4: unique unit number, in ascending order. First unit is 0
      12: 4: X-position
      16: 4: Y-position
      20: 4: previous X-position, -1 if unit never moved
      24: 4: previous Y-position
      28: 4: owner (by player number, NOT race number)
      40: 4: unit type (index into list of units)
      44: 4: level (0 = conscript, 1 = regular, etc.)
      52: 4: damage taken (0 = full strength)

      Cities...search for "CITY"

      Note there are several data packets labelled "CITY" for each city...
      I am oversimplifying by counting from the first.

      Pos Len
      0: 4: "CITY" packet ID
      4: 4: data-length of packet (always $0088?)
      8: 4: unique index number of city?
      12: 2: X-position
      14: 2: Y-position
      16: 1: owner (by player number)
      44: 4: shields collected for construction
      52: 4: what city is constructing (index into list of either
      units or buildings, see next entry)
      56: 4: type of construction ( 1 = building, 2 = unit)
      384: 28: city name

      After the city name there are several packets relating to population and citizens, followed by a "BINF" packet which relates to improvements:

      Pos Len
      0: 4: "BINF" packet ID
      4: 4: data-length of packet (always $0004?)
      8: 4: number of possible buildings

      This is followed by 12 bytes for each building. To discover which
      building is meant, you have to index into the building list:

      Pos Len
      0: 4: year of construction, 0 if not built
      4: 4: number of player who constructed building (?), -1 if
      not built
      8: 4: accumulated cultural value of building (??)




      Gramphos
      ACS Civ III Files Manager
      Sweden

      Apr 2001

      20-12-2001 08:40



      Good, as you have gotten started, I think that there is no need to keep what I know secret any longer.

      For the CITY sections:

      60: 4 year founded

      384: 24: city name
      408: 4 numbers of queue slots used
      412: 9 * 8 Build data (4 Index and 4 type) for each of the 9 slots


      The BITM section:
      0: BITM Section starter
      4: 4 length (40)
      8: 32 bitwise building info. One bit foe each building type
      40: 4 Number of bits used (74 with default rules)
      44: 4 Unknown


      For the UNITS:
      32: Nationality
      56: Movements used (stored in number of road movements used (default rules 3* movements))
      72: Loaded on (Ingame Unit ID of unit that holds this unit. (used with ships and armies))


      But remember that the hardest is to find the right Section. (If you make a tool)


      __________________
      Minister of Science - the Democracy Game
      I've my email back for the weekend, but I might lose it on Monday again.
      Ruotsi on maailman paras maa!
      ACS Civ III Files Manager



      Gramphos
      ACS Civ III Files Manager
      Sweden

      Apr 2001

      20-12-2001 08:51



      I'll remind everyone about that the X and Y value for cities only is the name, and where units from the city are created.

      The location on the map is stored among the TILE-sections. However there are to many places where the Citynumber appear to be able to tell what all mean.
      (Many of the unknown values are citynumbers. (some are for the city that work on that tile, others for the actual city.))

      I think I managed to create a tile that teleported you directly to a city once, but I don't remember how I did it .


      __________________
      Minister of Science - the Democracy Game
      I've my email back for the weekend, but I might lose it on Monday again.
      Ruotsi on maailman paras maa!
      ACS Civ III Files Manager



      hwinkels
      Settler


      Nov 2001

      21-12-2001 03:53



      Up

      ------------------------------------------------------------------------
      heres the text I saved, I have more info about tiles(enough to be able to swap civs around, the ai messes with it and I lost interest so no pbem for vanilla)

      Comment


      • #4
        Thats all for vanilla(back when the files weren't compressed), now there is probably a somewhat changed format and of course the compression.

        Comment


        • #5
          The BIC file settings are probably also in the save, they will apply to all races though.

          Comment


          • #6
            Thanks alot thats exactly what i wanted to know.

            Comment

            Working...
            X