EARTH starting positions

Gowron

Chieftain
Joined
May 21, 2007
Messages
62
Wow, a Civ1 forum that's still alive, I'm amazed :)

Recently I've been playing Civ1 again, and one problem for earth map games is tha imbalance of the default starting positions. Some of them are not suitable for the AI and keep the AI players from building settlers (grassland w/out shield is also bad as a starting position, since it slows down unit production at the start). Some civs (Chinese, Mongols...) have to be lucky and find an advanced tribe, while others (Russians, Zulus, Aztecs) usually dominate.

So I had a look at civ.exe.
Some stuff was relatively easy to find, but I think that people already know how to edit:
  • unit stats (domain, speed, fuel, attack, defense, cost, AI role, tech requirement, visibility, transport capacity)
  • tech tree
  • building stats (cost, maintenance, tech requirement)
  • terrain stats

After some more searching I finally found the starting positions.

They start at
position 0x27D4B

2 bytes per civ (1st byte: x-axis offset, 2nd byte: y-axis offset)
Civ order: Romans, Babylonians, Germans etc. (as in the civ selection screen)
2 empty bytes between Indians and Russians

Example: The Indians start at (0x39, 0x18), which means grassland w/out shield. If you change it to (0x3A, 0x19), then they'll be much faster.
Or change the Chinese starting point from (0x42, 0x13) to (0x44, 0x15) to make them build settlers and expand :)


Starting positions on ocean squares do not seem to crash the game, and when I tested it with the AI, the AI player did move to an adjacent land square and then moved its settler around for 9 more turns until it founded its capital.


I've also looked for the earth map itself, but did not find anything in civ.exe that looks even close to a terrain pattern. Maybe it's compressed? Does anybody know where it can be found?
 
Were I looking for a stored map I'd compare debugging of Earth vs. randomly generated planet. It might help to slow down emulation so that the map cannot be generated within one line of story text. However, it's been so long since I've dealt with DOS debugging that I don't remember if any of this is feasible.

So all I have to say is, "You will die slowly, Duras."
 
I've also looked for the earth map itself, but did not find anything in civ.exe that looks even close to a terrain pattern. Maybe it's compressed? Does anybody know where it can be found?

MAP.PIC see Attached Thumbnail

This file uses a different color for each terrain type. Unfortunately the format is unknown to me. I have look at the files a few time but have made little progress is deciphering the format.



See threads:
PIC and PAL files viewer?
PIC file format
 

Attachments

  • pic_086.png
    pic_086.png
    1.9 KB · Views: 450
Yeah, MAP.PIC... ^^

How long has this been known?
I just found out about it a few hours ago and was about to post this myself.

I also have the "PIC.EXE" program (has been lying around here for a few years ^^). It's strange that no one seems to know the actual file format.

Anyway, thank you very much :)
 
The one thing I have deduced is that the palette is stored in the PAL. I think that only the actual graphical data is in the PIC files. I don’t know where my research on the subject is a the moment but maybe I take another look at this. If someone could come up with the format, one could modify the Earth map

With you information one could assign different starting positions.
... one problem for earth map games is that imbalance of the default starting positions. ... After some more searching I finally found the starting positions.


On a similar topic; TerraForm has a feature Read Map Gen which reads in an external generated map. Unfortunately no one that I am aware of has ever developed a random map generating program for it.
 
The one thing I have deduced is that the palette is stored in the PAL. I think that only the actual graphical data is in the PIC files. I don’t know where my research on the subject is a the moment but maybe I take another look at this. If someone could come up with the format, one could modify the Earth map
I've looked at MAP.PIC with a hex editor, and it appears to be some sort of custom image file format, similar to GIF.

There's a small header at the start (6 bytes). After that, at position 0x06, the palette is stored (16 colors, 3 bytes per color, colors following this table, [register numbers 0-15]).

The colors in the palette don't seem to matter at all in this case, as this is just the earth map data.

The data part starts at position 0x306.

position 0x306: unknown (2 bytes)

position 0x308: total size of data section, counting from position 0x309

position 0x30A: image width (2 bytes)

position 0x30C: image heigth (2 bytes)

position 0x30E: pixel data (1064 bytes, compressed)

The pixel data seems to have been compressed several times with different algorithms. Thus it could be difficult to find out which methods have been used.


Btw, you didn't answer my question: How long has it been known that MAP.PIC contains the earth map data?
 
...How long has this been known?...

…Btw, you didn't answer my question: How long has it been known that MAP.PIC contains the earth map data?

I don’t know how long anyone else has known this, but I noticed it some time in June or July 2005.


Also look at this
Amiga ....And it was the only version that had an in-built *map editor* from the outset in 1991. All you needed to do was stick the earth.map file into any PAINT programme
 
Maybe the *.PIC and .*MAP files are not so different after all...

The file MAP.PIC uses 4-bit color and and merges two adjacent pixels into one byte.
For example, byte 0x30F contains the value 0x11, which means "blue, blue" (two ocean squares). There's another pattern "black, black" (two background pixels) stored inside bytes 0x312 and 0x131, using half of each byte.

However, there's also some kind of run-length encoding. Take byte 0x311, for example, with the value 0xA1. The "A" is a run length factor and makes the game repeat the "blue, blue" pattern 40 times. 40 times 2 pixels means one map row of ocean squares. Or have a look at byte 0x315. It contains the value 0x4F, with "F" (=15 [dec]) being a run length factor which makes the game repeat the "black, black" pattern 120 times. That's 240 black pixels - just enough to fill the rest of the first line.

Also, a dictionary-based encoding algorithm is used along with the RLE encoding. If you, for example, change the aforementioned "blue, blue" pattern to something else like "blue, green" (0x21), then you will find this new pattern all over the map. If the "black, black" pattern is changed, the result is even more clearly visible.


Dack, could you please tell me which encoding algorithm is used for the *.map files? It seems that the same, or at least a very similar, algorithm is also used for the data part of the image files and the earth map file.

Btw, you can even view *.map files with PIC.EXE. To do this, copy the whole *.map file with a hex editor and append it to the first 774 (dec) bytes of MAP.PIC (delete/overwrite the rest of MAP.PIC). Of course make a backup first ^^
 
On a similar topic; TerraForm has a feature Read Map Gen which reads in an external generated map. Unfortunately no one that I am aware of has ever developed a random map generating program for it.

There was that proof-of-concept one I did in simple html+javascript back in 2006. It generated interesting continents I thought. It didn't prevent the diagonal canals though and the continental interiors were pretty random (ie: messy spraypaintings of various terrain), and one did have to copy & paste the terraintext into notepad to save it.
 
Back
Top Bottom