Thread Tools
Old July 8, 2001, 17:04   #1
shade
Civilization II Democracy Game
King
 
shade's Avatar
 
Local Time: 12:23
Local Date: October 31, 2010
Join Date: May 2001
Location: of bribery.
Posts: 2,196
how are maps saved?
The title says it all,is there anyone out here who knows how civ II(2.42) maps are saved?
Let me explain what I mean:
In my own mapeditor I save maps as binaries and the information is stored like this:
First line: map_x,map_y dimensions,kind of map(round(1) or flat(0))
rest:for each tile an 8-bit number(bit1=huts,bit2&3=special,bit4=river,bit5...8=number for terraintype)and the tiles are stored left to right,top to bottom
end.

I hope there is someone who can help with this problem.
(if so I will be supplying a new mapeditor that builds random-maps that give continents/islands when asked for,it could be a solution for generated worlds )

Shade
__________________
ex-president of Apolytonia former King of the Apolytonian Imperium
"I have not failed. I've just found 10,000 ways that won't work." --Thomas Alva Edison (1847-1931)
shameless plug to my site:home of Civ:Imperia(WIP)
shade is offline  
Old July 8, 2001, 22:18   #2
William Keenan
Scenario League / Civ2-Creation
Prince
 
William Keenan's Avatar
 
Local Time: 06:23
Local Date: October 31, 2010
Join Date: Sep 1999
Location: New Jersey, USA, Earth, Sol, Milky Way
Posts: 705
Quote:
Originally posted by Gothmog

MAP INFORMATION:

The map header is at a fixed location depending on file format.
Offset 3586 in FW and later
Offset 3478 in CIC and earlier

The map header is 14 bytes long
~ Map X dimension : integer (2 bytes).
~ Map Y dimension : integer (2 bytes). A 50 by 80 map will show up as 100 by 80 here.
~ Map Area: integer (2 bytes) or X times Y divided by 2.
~ Flat Earth Flag: integer (2 bytes). 1 = flat, 0 = round.
~ Map Seed: integer (2 bytes). I haven’t fooled around with this yet to see if it might change the resource pattern in an active game.
~ Locator Map X dimension : integer (2 bytes): equals ‘Map X’ divided by 4 rounded up.
~ Locator Map Y dimension : integer (2 bytes): equals ‘Map Y’ divided by 4 rounded up. The locator map is the small map in the corner.

THE MAP BLOCKS:
These begin immediately after the header.
~ Block 1 contains terrain improvement data, such as irrigation. This block is 7 times the ‘Map Area’ bytes long.
~ Block 2 Contains the basic terrain type data. This block is 6 times the ‘Map Area’ bytes long.
~ Block 3 is the locator map. It's stored in 2 pieces, each piece being ‘locator map x’ times ‘locator map y’ bytes long.
~ Note: Viewing the save file in graphical mode in the hex editor is what allowed me to figure out what these map blocks lengths were. When I oriented the hex editor to start viewing at the beginning of map block 3 and made the width of the display the same as the ‘locator map X dimension’, I could see two little maps! So when you’re looking around a save file, you might want try graphical mode to see the big picture.
I strongly suggest that you read Hex Editing by Allard Höfelt
William Keenan is offline  
Old July 9, 2001, 05:28   #3
shade
Civilization II Democracy Game
King
 
shade's Avatar
 
Local Time: 12:23
Local Date: October 31, 2010
Join Date: May 2001
Location: of bribery.
Posts: 2,196
thank you very much this is just what I needed.

shade
__________________
ex-president of Apolytonia former King of the Apolytonian Imperium
"I have not failed. I've just found 10,000 ways that won't work." --Thomas Alva Edison (1847-1931)
shameless plug to my site:home of Civ:Imperia(WIP)
shade is offline  
Old July 11, 2001, 15:23   #4
shade
Civilization II Democracy Game
King
 
shade's Avatar
 
Local Time: 12:23
Local Date: October 31, 2010
Join Date: May 2001
Location: of bribery.
Posts: 2,196
thx, it gives the same info as the link keenan provided
(something both forget to mention is that in the map the 4th integer(i think) the one that holds width/4 this is the width you use in the first integer(ie:width*2))(this crashed my computer 3 times before i figured it out)

btw those .mp files are a nightmare(try opening with word ,close,save changes(although you didn't do a thing) and voila your file just increased 25% in size and became worthless)
as you can see I had my fun

shade
__________________
ex-president of Apolytonia former King of the Apolytonian Imperium
"I have not failed. I've just found 10,000 ways that won't work." --Thomas Alva Edison (1847-1931)
shameless plug to my site:home of Civ:Imperia(WIP)
shade is offline  
Old July 11, 2001, 15:55   #5
Mercator
Scenario League / Civ2-Creation
Emperor
 
Mercator's Avatar
 
Local Time: 13:23
Local Date: October 31, 2010
Join Date: Dec 1969
Posts: 3,079
For maps you´d better have a look at some more recent info on this @ http://gene.wins.uva.nl/~jvermeir/savmaps.htm
It contains info about the encoding of maps in both map files and savegames.
Mercator is offline  
Old July 11, 2001, 18:33   #6
Mercator
Scenario League / Civ2-Creation
Emperor
 
Mercator's Avatar
 
Local Time: 13:23
Local Date: October 31, 2010
Join Date: Dec 1969
Posts: 3,079
Quote:
thx, it gives the same info as the link keenan provided
Well, most of it is the same, of course. I believe I made a few additions to the explanation of the encoding in savegames, though. Nothing short of Allard´s doc and William´s reference to it, of course.

Quote:
Originally posted by shade
btw those .mp files are a nightmare(try opening with word ,close,save changes(although you didn't do a thing) and voila your file just increased 25% in size and became worthless)
as you can see I had my fun
That´s because there are a lot of appearances of the hex code 0A, which is the code for either a line-feed or a carriage return. In Windows a return this is encoded with a combination of both 0D 0A (or was it the other way around?), so when Word opens the file, it finds all the invalid occurences of returns, and replaces them by the above mentioned combination.
But you knew this, right? Since you appear to be a programmer, or so I hope if you´re creating a game! .
But why use Word at all on binaries, you surely have some hex-editor?

I´m rather puzzled why your post seems to be posted half an hour before mine though. Not only that, it couldn´t even post for a while, always getting the you-can-only-post-once-every-30-seconds message.
Mercator is offline  
Old July 18, 2001, 18:26   #7
shade
Civilization II Democracy Game
King
 
shade's Avatar
 
Local Time: 12:23
Local Date: October 31, 2010
Join Date: May 2001
Location: of bribery.
Posts: 2,196
Mercator: I thought it would be something like that.
btw I 'm no real programmer in the sence I did study for it.It's just a hobby of mine.Yes, I am trying(and i really mean trying) to make my own Civ-game.(You can read all about it on my webpage)
Hex-editor
no don't have one(and don't need one for the moment)

Grtz Shade
__________________
ex-president of Apolytonia former King of the Apolytonian Imperium
"I have not failed. I've just found 10,000 ways that won't work." --Thomas Alva Edison (1847-1931)
shameless plug to my site:home of Civ:Imperia(WIP)
shade is offline  
Old July 19, 2001, 11:15   #8
Mercator
Scenario League / Civ2-Creation
Emperor
 
Mercator's Avatar
 
Local Time: 13:23
Local Date: October 31, 2010
Join Date: Dec 1969
Posts: 3,079
Well, good luck with creating that game
Mercator is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 07:23.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team