Very good, Allard! I was just talking about this document in another thread.

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.

Very good, Allard! I was just talking about this document in another thread.

BOOO!It crashes out Word '98 when I try to read it.
Any suggestions.

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
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

An astute discovery!
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

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.
I think there is an effect: techs are open (scenario) or one third is rotately made impossible (standard game).Originally posted in HEX-EDITING (hex-edit.rtf)
byte nr. 20
...1 .... cheat penalty/warning
.1.. .... scenario file (no effect really)
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?...
I thought you could allready eliminate all huts simply by using the cheat menu?
No Fighting here, this is the war room!
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.
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.Originally posted by Henrik
I thought you could allready eliminate all huts simply by using the cheat menu?
Civ2 "Great Library Index": direct download, Apolyton attachment
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.

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.
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 ); }

Yikes, I'm stupid.
![]()
![]()
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 ...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 ); }
(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
SCDARS, did you finish the program that removes huts?
Civ2 "Great Library Index": direct download, Apolyton attachment
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.
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?
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
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...
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
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
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
Only until they move. The move is seen, but then they are lost of sight completely.Originally posted by Hex-edit.rtf
Enemy ... units that are lost out of sight, will remain marked on their last seen location (?),
Nooo...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?
You confuse two different bytes. The sixth byte is the byte that controls huts:
But I don't know which values clear huts and which don't. 00H clears them, F0H don't, but others should be tested.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.
Civ2 "Great Library Index": direct download, Apolyton attachment

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.
Hm.So how do you set huts ON using the 5th byte?
Civ2 "Great Library Index": direct download, Apolyton attachment

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.
Bookmarks