Page 1 of 2 1 2 LastLast
Results 1 to 30 of 52

Thread: Everything about Hex-Editing - UPDATED

  1. #1
    Allard HS
    Chieftain Allard HS's Avatar
    Join Date
    31 Dec 1969
    Location
    NL
    Posts
    72
    Country
    This is Allard HS's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    07:06

    Post Everything about Hex-Editing - UPDATED

    My guide with everything about hex-editing from a while ago has just finished a great update. All forum posts about new discoveries since then have been added, the newest version of Jorrit's guide on map-hex-editing has been completely copied, and some very useful info on resource editing (for DLL and EXE files) has been added.

    Be sure especially not to miss that last thing. (It's in chapter A, near the end of the document).

    It's all written using Word XP, but I think you can also read it in older versions of Word.
    Attached Files Attached Files

  2. #2
    Jacobite1688
    Prince Jacobite1688's Avatar
    Join Date
    02 Jul 2001
    Location
    Chicago, IL U.S.A.
    Posts
    300
    Country
    This is Jacobite1688's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 24, 2014
    Local Time
    23:06
    Very good, Allard! I was just talking about this document in another thread.

  3. #3
    Jacobite1688
    Prince Jacobite1688's Avatar
    Join Date
    02 Jul 2001
    Location
    Chicago, IL U.S.A.
    Posts
    300
    Country
    This is Jacobite1688's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 24, 2014
    Local Time
    23:06
    BOOO! It crashes out Word '98 when I try to read it. Any suggestions.

  4. #4
    Mercator
    Emperor Mercator's Avatar
    Join Date
    31 Dec 1969
    Posts
    3,089
    Country
    This is Mercator's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    07:06
    Brilliant!

    Download the Microsoft Word Viewer from microsoft.com. That works fine for me (since I don't have Word at all):

    http://support.microsoft.com/default...;en-us;Q165908

  5. #5
    SlowThinker
    King SlowThinker's Avatar
    Join Date
    01 Jan 2000
    Location
    homeless, Praha, Czech Republic
    Posts
    2,625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    The 17th byte of the TECHNOLOGIES & MONEY part of each civ holds NumberOfAcquiredTechs+1 (starting techs are not included).

    (works with MGE)
    Civ2 "Great Library Index": direct download, Apolyton attachment

  6. #6
    Jacobite1688
    Prince Jacobite1688's Avatar
    Join Date
    02 Jul 2001
    Location
    Chicago, IL U.S.A.
    Posts
    300
    Country
    This is Jacobite1688's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 24, 2014
    Local Time
    23:06
    An astute discovery!

  7. #7
    yaroslav
    Emperor yaroslav's Avatar
    Join Date
    16 Jun 2001
    Location
    Madrid, Spain, Europe
    Posts
    7,795
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    Hello, great work Allard!

    I think that when you wrote:

    "byte 89-100 Technologies. B (11) bytes long.
    To explain how the bytes work, an example of the first technology byte:
    .... ...1 : 1st technology
    .... ..1. : 2nd "
    .... .1.. : 3rd "
    .... 1... : 4th "
    ...1 .... : 5th "
    ..1. .... : 6th "
    1... .... : 7th "
    In the next byte are the 8th-14th technology. Note that for some reason
    the .1.. .... is left out. This is not the case in each of these bytes, though.
    I don't know why. Though it's fun to know how it works, it is much much
    easier to set techs using the cheat menu.
    NOTE: This is very useful, however, for giving the Barbarians certain
    technologies. You might want to give them Guerrilla Warfare,
    for instance.
    NOTE: All techs are: FF FF FF FF FF FF FF FF FF FF FF FD. (Excluding
    user defined techs. Adding those makes it ...... FF instead of
    ...... FD)."

    It does not apply to MGE. In MGE I believe that bytes reach 102th and that all bits in all bytes have a mean (no .1...... exception)
    Trying to rehabilitateh and contribuing again to the civ-community

  8. #8
    Xin Yu
    King Xin Yu's Avatar
    Join Date
    31 Dec 1969
    Location
    Emeryville, CA, USA
    Posts
    1,658
    Country
    This is Xin Yu's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 24, 2014
    Local Time
    21:06
    Allard, there is a flag at the 6th byte of city block
    .... .1.. can build hydroplant

    Also, there should be a block right before wonder info for advances with regard to which civs discovered them. Each byte represents one tech. A 00 means no civ has this tech, a FF means every civ + barbarian have this tech.

  9. #9
    SlowThinker
    King SlowThinker's Avatar
    Join Date
    01 Jan 2000
    Location
    homeless, Praha, Czech Republic
    Posts
    2,625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    Originally posted in HEX-EDITING (hex-edit.rtf)
    byte nr. 20
    ...1 .... cheat penalty/warning
    .1.. .... scenario file (no effect really)
    I think there is an effect: techs are open (scenario) or one third is rotately made impossible (standard game).

  10. #10
    SCDARS
    Warlord
    Join Date
    18 Sep 1999
    Posts
    172
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    Do you think it would be easy to eliminate all huts by a program? Since all huts are set by the seed, it would seem likely to me that the status of all huts (tipped -or active) is collected in some part of the file and not attached to each of the map tiles' entries, right?...

  11. #11
    Henrik
    Emperor Henrik's Avatar
    Join Date
    26 Dec 2000
    Location
    The European Union, Sweden, Lund
    Posts
    3,684
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    07:06
    I thought you could allready eliminate all huts simply by using the cheat menu?
    No Fighting here, this is the war room!

  12. #12
    SCDARS
    Warlord
    Join Date
    18 Sep 1999
    Posts
    172
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    Of course you can, but I was asked by some people if there is an easier way to do this for multiplayer (having the host enabling the cheat menu is not what everybody likes). But the cheatmenu option should make it easy to find the location of those bytes.

  13. #13
    SlowThinker
    King SlowThinker's Avatar
    Join Date
    01 Jan 2000
    Location
    homeless, Praha, Czech Republic
    Posts
    2,625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    Originally posted by Henrik
    I thought you could allready eliminate all huts simply by using the cheat menu?
    Do you mean to go in the scenario mode, to turn huts off, then save into a .sav file? I tested it (for Early Landing Comparison Game #1 ), but if I remember correctly, I had a problem with that byte 20 (I think the cheat mode was left) and I had to hexedit it manually.
    Civ2 "Great Library Index": direct download, Apolyton attachment

  14. #14
    SCDARS
    Warlord
    Join Date
    18 Sep 1999
    Posts
    172
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    If you use "turn huts off", obviously in the 2nd data block of the map 0F is replaced by 00 in one entry each 6 bytes. My first uneducated guess is: All tiles are set to have been owned by the Barbarians and a hut is considered tipped if one civ owns its tile (in the 6th byte).
    Moving a roman warrior to one tile changes its respective value to 10, using a Babylonian unit switches it to 20 etc. -- which seems to support this theory.
    Can someone more experienced comfirm this?
    Last edited by SCDARS; February 23, 2003 at 10:30.

  15. #15
    Mercator
    Emperor Mercator's Avatar
    Join Date
    31 Dec 1969
    Posts
    3,089
    Country
    This is Mercator's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    07:06
    You are correct. Setting ownership to barbarian is how the goody huts are cleared.

    If you're interested in the details of the map structure, look here or in Allard's hex editing doc.

  16. #16
    SCDARS
    Warlord
    Join Date
    18 Sep 1999
    Posts
    172
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    Do you see any obvious mistakes in this part of code? (handle is a java RandomAccessFile-object). After some testing, at least it does remove the huts and it doesn't have any side-effects as obvious as turning the whole map into river (which was the result of my first attempt ).
    Code:
    int fertility;
    final int owner=0;//240 = no owner;  0 = barbarians;
    
    for(int i=0; i < SURFACE ; i++){
      handle.seek( OFFSET_MAP_BLOCK2+6*i+5 );
      fertility = handle.read() % 16;
      handle.seek( OFFSET_MAP_BLOCK2+6*i+5 );
     handle.write( owner + fertility );
    }

  17. #17
    klesh
    King klesh's Avatar
    Join Date
    01 Jan 2000
    Location
    Massachusetts, USA
    Posts
    2,057
    Country
    This is klesh's Country Flag
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    01:06

    Yikes, I'm stupid.


  18. #18
    yaroslav
    Emperor yaroslav's Avatar
    Join Date
    16 Jun 2001
    Location
    Madrid, Spain, Europe
    Posts
    7,795
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    Originally posted by SCDARS
    Do you see any obvious mistakes in this part of code? (handle is a java RandomAccessFile-object). After some testing, at least it does remove the huts and it doesn't have any side-effects as obvious as turning the whole map into river (which was the result of my first attempt ).
    Code:
    int fertility;
    final int owner=0;//240 = no owner;  0 = barbarians;
    
    for(int i=0; i < SURFACE ; i++){
      handle.seek( OFFSET_MAP_BLOCK2+6*i+5 );
      fertility = handle.read() % 16;
      handle.seek( OFFSET_MAP_BLOCK2+6*i+5 );
     handle.write( owner + fertility );
    }
    Hi! I'm also using Java for my Civ2 related utility, Civ2PBEM Diplomacy, and in the first version, I also used RandomAccessFile! If you are interested, we can share code or whatever you want ...

    (BTW, a good idea would be issue the handle.write when owner<0 && owner>7. This way, you can use this program in any turn of the game, without changing the civ's owner of the tile. For example, if there is a city, I think that your code put the owner city's tile to barbarian, and I'm not sure if that makes sense )
    Trying to rehabilitateh and contribuing again to the civ-community

  19. #19
    SlowThinker
    King SlowThinker's Avatar
    Join Date
    01 Jan 2000
    Location
    homeless, Praha, Czech Republic
    Posts
    2,625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    SCDARS, did you finish the program that removes huts?
    Civ2 "Great Library Index": direct download, Apolyton attachment

  20. #20
    SCDARS
    Warlord
    Join Date
    18 Sep 1999
    Posts
    172
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    You can get it here: http://www.civ2.de/pages/liga/misc2....tachmentid=581 Since I did not expect much interest, I have not written any documentation. It should be fairly easy to use, though. For installation (java required), simply unzip it into some new folder.
    For use, put your save into that folder, rename it to "save.net" and run the batch file.
    Last edited by SCDARS; November 22, 2003 at 07:47.

  21. #21
    SlowThinker
    King SlowThinker's Avatar
    Join Date
    01 Jan 2000
    Location
    homeless, Praha, Czech Republic
    Posts
    2,625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06

    Browsing cities

    You need to know number of units (to get the size of 'unit information block') and number of cities if you want to be able to browse cities by a program.
    I found nothing in the 'Hex-edit.rtf' document...
    Yaroslav, Xin Yu, you probably know it?

  22. #22
    yaroslav
    Emperor yaroslav's Avatar
    Join Date
    16 Jun 2001
    Location
    Madrid, Spain, Europe
    Posts
    7,795
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    It is even worse, becuase in order to reach the beginning of the 'city information block' you need not only to know the size of the 'unit information block' but also the size of the 'map information block'!

    You can get the number of units from the 58-59th bytes: multiply this number by 26 (or 32 in MGE) and you'll have the size in bytes of the 'unit information block'.

    The size (in bytes) of the 'map information block' is

    13 * short int starting in 0x0000358A [surface]
    + 2 * short int starting in 0x00003590 * short int starting in 0x00003592
    + 1024
    + 14

    starting to count from the map header (byte 0x00003586).

    So, you can say that, in MGE the 'city block information' starts in:

    0x00003586 + 13 * short int starting in 0x0000358A
    + 2 * short int starting in byte 0x00003590 * short int starting in 0x00003592
    + 1024
    + 14
    + 32 * short int starting in byte 58
    Trying to rehabilitateh and contribuing again to the civ-community

  23. #23
    SlowThinker
    King SlowThinker's Avatar
    Join Date
    01 Jan 2000
    Location
    homeless, Praha, Czech Republic
    Posts
    2,625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06

    work of Settlers

    Yaroslav, thank you very much.

    Another question:
    Does anybody know where is agglomerate work of settlers stored? I would like a utility that shows that...

  24. #24
    yaroslav
    Emperor yaroslav's Avatar
    Join Date
    16 Jun 2001
    Location
    Madrid, Spain, Europe
    Posts
    7,795
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    I don't know exactly. However, I will do a little research tomorrow/the next day and I will tell you what I founded
    Trying to rehabilitateh and contribuing again to the civ-community

  25. #25
    yaroslav
    Emperor yaroslav's Avatar
    Join Date
    16 Jun 2001
    Location
    Madrid, Spain, Europe
    Posts
    7,795
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    Research done.

    The agglomerate work of settlers is stored in the 15th byte of the unit (starting to count in 1). I believe that a 0 in the 15th stands for 0 turns of agglomerate work, 1 stands for 1 turn of agglomerate work and so on...

    With that info, the utility you were speaking about should be easy to programm

    I've done two others interesting discoverments that I'm gonna post in the SL-Scenario Creation Forum
    Trying to rehabilitateh and contribuing again to the civ-community

  26. #26
    SlowThinker
    King SlowThinker's Avatar
    Join Date
    01 Jan 2000
    Location
    homeless, Praha, Czech Republic
    Posts
    2,625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    Thank you, yaroslav.
    I am inclined to believe there are 'units of work' stored in that byte. So Settlers increase the value stored in this byte by 1 every turn of work, but Engineers by 2. Reason: a Leonardo upgrade don't double the aggregate work.
    I plan to incorporate aggregate work of settlers in 'Beakers counter'. After that I will confirm or deny my hypothesis.
    Civ2 "Great Library Index": direct download, Apolyton attachment

  27. #27
    SlowThinker
    King SlowThinker's Avatar
    Join Date
    01 Jan 2000
    Location
    homeless, Praha, Czech Republic
    Posts
    2,625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    Originally posted by Hex-edit.rtf
    Enemy ... units that are lost out of sight, will remain marked on their last seen location (?),
    Only until they move. The move is seen, but then they are lost of sight completely.

    Originally posted by SCDARS
    If you use "turn huts off", obviously in the 2nd data block of the map 0F is replaced by 00 in one entry each 6 bytes. My first uneducated guess is: All tiles are set to have been owned by the Barbarians and a hut is considered tipped if one civ owns its tile (in the 6th byte).
    Moving a roman warrior to one tile changes its respective value to 10, using a Babylonian unit switches it to 20 etc. -- which seems to support this theory.
    Can someone more experienced comfirm this?
    Nooo...
    You confuse two different bytes. The sixth byte is the byte that controls huts:

    Originally posted by Originally posted by Hex-edit.rtf
    The fifth byte represents "visibility", indicating which of the civilizations have explored
    that particular square. 00 means none of the civilizations (including the barbarians,
    who are the "0th" (red) civilization) have uncovered that square so far
    ...
    E.g. A square discovered by the Barbarians, Romans, Germans and Sioux will have the
    code:
    20 + 21 + 23 + 27 = 1 + 2 + 8 + 128 = 139 = 8B

    The sixth byte is generally F0, not always though. I strongly believe that this byte has
    to do with fertility. Normally all squares end with F0, except Plains and Grassland,
    which mostly (if not always) end with something else.
    But I don't know which values clear huts and which don't. 00H clears them, F0H don't, but others should be tested.
    Civ2 "Great Library Index": direct download, Apolyton attachment

  28. #28
    Mercator
    Emperor Mercator's Avatar
    Join Date
    31 Dec 1969
    Posts
    3,089
    Country
    This is Mercator's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    07:06
    I'm sorry, but SCDARS is right, and you're wrong.

    The 6th byte controls which civs see the tile, and tile fertility. As SCDARS said, the 5th byte controls ownership, and that's what's used to clear the huts.

  29. #29
    SlowThinker
    King SlowThinker's Avatar
    Join Date
    01 Jan 2000
    Location
    homeless, Praha, Czech Republic
    Posts
    2,625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    06:06
    Hm. So how do you set huts ON using the 5th byte?
    Civ2 "Great Library Index": direct download, Apolyton attachment

  30. #30
    Mercator
    Emperor Mercator's Avatar
    Join Date
    31 Dec 1969
    Posts
    3,089
    Country
    This is Mercator's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    July 25, 2014
    Local Time
    07:06
    You can't just turn them on. The hut pattern is fixed, just like the terrain resources.

    Terrain resources can only be hidden by the method Civ2 uses to hide them in mid-Ocean (and MapEdit can do that anywhere).

    Similarly, huts can only be hidden, not put in any place you want.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. BTS 3.17 - Where is the updated SDK?
    By albucc in forum Civilization IV Creation
    Replies: 1
    Last Post: June 27, 2008, 17:32
  2. Updated Civ
    By Sun_Ce in forum Civilization III
    Replies: 1
    Last Post: December 11, 2003, 01:34
  3. FOA, why isn't it updated?
    By Chris 62 in forum Apolyton/Community-Archive
    Replies: 7
    Last Post: May 10, 2002, 14:25
  4. What's New - Updated 12/28/01
    By cassembler in forum Civ3-General-Archive
    Replies: 4
    Last Post: January 22, 2002, 03:05
  5. CSC updated
    By Allard HS in forum Scenario League / Civ2-Creation -Archive
    Replies: 12
    Last Post: October 16, 2000, 14:45

Bookmarks

Posting Permissions