Thread Tools
Old April 3, 2003, 11:52   #1
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 17:03
Local Date: November 1, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
hex edit needed
Does anyone know how to hex edit to place cities right next to each other? I need a quick adjustment to a save file for ToT. Thanks.
__________________
Tecumseh's Village, Home of Fine Civilization Scenarios

www.tecumseh.150m.com
techumseh is offline  
Old April 4, 2003, 19:33   #2
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 17:03
Local Date: November 1, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
Are all the computer science students on spring break?
I've looked at Allard's and Mercator's papers and downloaded a hex editor. I've figured out how to change the location of a city, but I can't find the additional byte needed to make it visible. Can anyone help?
__________________
Tecumseh's Village, Home of Fine Civilization Scenarios

www.tecumseh.150m.com
techumseh is offline  
Old April 5, 2003, 02:49   #3
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 17:03
Local Date: November 1, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
Never mind! I've figured it out. It took a bit of detective work, but with the excellent guides by Allard and Mercator, I was able to find the correct bytes in the save file to create multiple cities.

If any one wants to add multiple cities to their scenario, I might be persuaded to write a tip. It looks like it will add a lot to a scenario. Baghdad is so big....
__________________
Tecumseh's Village, Home of Fine Civilization Scenarios

www.tecumseh.150m.com
techumseh is offline  
Old April 5, 2003, 19:36   #4
Boco
Scenario League / Civ2-Creation
King
 
Boco's Avatar
 
Local Time: 18:03
Local Date: November 1, 2010
Join Date: Jan 2001
Location: of underdogs
Posts: 1,774

Good work Sherlock. Yes, I'd love to be able to edit city coordinates. It would be nice to easily create the odd-even cities that Henrik promotes. A label on the map saves a lot of readme explanations.

Baghdad! Isn't that a little far afield for a Bismarck's Germany?

Last edited by Boco; April 5, 2003 at 21:43.
Boco is offline  
Old April 5, 2003, 21:05   #5
St Leo
Scenario League / Civ2-CreationApolytoners Hall of Fame
 
St Leo's Avatar
 
Local Time: 19:03
Local Date: November 1, 2010
Join Date: Jul 2005
Location: In search of pants
Posts: 5,085
Gimme.
__________________
Blog | Civ2 Scenario League | leo.petr at gmail.com
St Leo is offline  
Old April 6, 2003, 03:18   #6
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 17:03
Local Date: November 1, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
OK, I'll give it a go. Boco, I shelved the Franco-Prussian war scenario because of play balance problems. I'm sure I'll finish it, but I need a break due to mounting frustration. Actually I'm supposed to be trying to finish 'Global War' with Magyar Crusader right now. I just couldn't resist making a map of Iraq as I was following the course of the war. I took a section of your middle east gigamap and modified it from there. It's perfect. I hope you don't mind.

In order to make multi-square cities, you'll first need to download a hex editor. Fortunately, they're mostly freeware. I just picked this one at random - there may be better ones: http://www.hhdsoftware.com/hexeditor.html

Now checkout two guides at Mercator's site: http://www.civgaming.net/mercator/guides.htm The paper by Allard is a comprehensive guide to hex editing (FW) civ files. The paper by Jorrit (Mercator) deals with hex editing the map portion of a sav. file. Both assume a knowledge of hex editing. Read them anyway. Lots will make more sense as we work through the process.


On William Keenan's Cradle Of Civilization site, have a look at the 2nd tip on flags and masks. Not for the ToT events language, but because at the end it explains how to convert decimal numbers into hexadecimal numbers using the built-in Windows calculator: http://coc.apolyton.net/guides/flags_masks.shtml

Let's start by backing up our save file. Baghdad has a population of 5,605,000 people, and we want each increment in city size to equal to 100 thousand people. So it would be a size 56 size city - far too big. And in far too small in area for our map. So let's say we want Baghdad to be a 5 square city, each averaging about 11 in size.

Bagdad starts as a normal, one square city located at 59,41 on our map. Let's find it in the sav. file using the hex editor. This is pretty easy, since in the right hand column, the names of cities are printed (highlighted in yellow). The corresponding hexidecimal code for 'Baghdad' is also highlighted in the centre portion. This section is the actual contents of the sav. file, consisting of many, many rows of 16 pairs of numbers, mostly empty (00). The left hand column is the 'offsets' referred to in Allard's and Mercators's papers. This is just the index to allow you locate which row you're looking for, counting in hexidecimal numbers.

Now, how do we find the coordinates of Baghdad amoung all these pairs of numbers? Well, if we look for the numbers 59 and 41, we won't find them. So let's refer to William Keenan's ToT tip and use the calculator to convert these into hexidecimal numbers: 3b,29. There they are, highlighted in pink. By changing these numbers (in hexidecimal) we can move Bagdad or any other city. But it's not that simple. More....
Attached Thumbnails:
Click image for larger version

Name:	hex1.gif
Views:	60
Size:	11.3 KB
ID:	41786  
__________________
Tecumseh's Village, Home of Fine Civilization Scenarios

www.tecumseh.150m.com
techumseh is offline  
Old April 6, 2003, 09:43   #7
Boco
Scenario League / Civ2-Creation
King
 
Boco's Avatar
 
Local Time: 18:03
Local Date: November 1, 2010
Join Date: Jan 2001
Location: of underdogs
Posts: 1,774
Thanks! Must've been pretty weak beer. I'll give it a shot after I finish my annual agony with the IRS.

Glad the map was of some use. I had forgotten about that larger version. Just be careful about the placement those swamps. They came from 1915-7 maps. Hussein has drained many of them, allegedly to punish the Shiites.
Boco is offline  
Old April 6, 2003, 10:12   #8
Boco
Scenario League / Civ2-Creation
King
 
Boco's Avatar
 
Local Time: 18:03
Local Date: November 1, 2010
Join Date: Jan 2001
Location: of underdogs
Posts: 1,774
I hate taxes. Okay I installed a hex editor, found a bin->hex calculator, and can follow you to this point. So now I need to change the city-present toggle of the old and new city sites?
Boco is offline  
Old April 6, 2003, 12:37   #9
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 17:03
Local Date: November 1, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
OK, OK! Start by creating the suburb city on the map at some convenient location, in this case at 79,35. We want to move Suburb1 to 75,43 (where the cursor is).

Let's convert these locations into hexadecimal:

79,35 becomes 4f,23

75,43 becomes 4b,2b

Now we use our hex editor to find Suburb1 and it's current location:
Attached Thumbnails:
Click image for larger version

Name:	illustration1.gif
Views:	52
Size:	124.6 KB
ID:	41811  
__________________
Tecumseh's Village, Home of Fine Civilization Scenarios

www.tecumseh.150m.com
techumseh is offline  
Old April 6, 2003, 12:45   #10
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 17:03
Local Date: November 1, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
Now we use our hex editor to replace the old location with the new one, and voila, Suburb1 has moved to a location immediately south of Baghdad!

Except you can't actually see the new suburb, just read it's name. It's there - sort of. Finding the bytes which make it visible is the hard part. More....
Attached Thumbnails:
Click image for larger version

Name:	illustration2.gif
Views:	52
Size:	107.2 KB
ID:	41812  
__________________
Tecumseh's Village, Home of Fine Civilization Scenarios

www.tecumseh.150m.com
techumseh is offline  
Old April 6, 2003, 18:32   #11
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 17:03
Local Date: November 1, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
Here's where the detective work comes in. For the moment, let's restore Suburb1 to it's original spot, by replacing the original hexadecimal coordinates. Now make an exact copy of the save file. Let's call them backup1 and backup2. Open backup2 and add irrigation to the square where we want to move Suburb1, at 75,43. Save.

Now open your hex editor. Load both files. Now go to edit and select 'Compare'. A little box will appear, with 2 spots for the two files you want to compare. Select both files. Hit the start button. The hex editor will go to the first set of pairs that are different.

According to Mercator's paper, the presence of irrigation will be represented by 04 in the save file. So the compare function will show you where there is irrigation in backup2, but not in backup1. You are looking for places where backup2 has 04, but backup1 has 00. (If a road is also present it will be 10 and 14.)

Mercator says that the presence of a city is indicated by 02, so just change 04 to 02 in each place where this diference exists. There may be as few as 2 or as many as 8 places where this must be done. Ignore any other differences between the files.
Attached Thumbnails:
Click image for larger version

Name:	hex4.gif
Views:	45
Size:	21.2 KB
ID:	41842  
__________________
Tecumseh's Village, Home of Fine Civilization Scenarios

www.tecumseh.150m.com
techumseh is offline  
Old April 6, 2003, 18:36   #12
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 17:03
Local Date: November 1, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
Now go back to the first step and change the coordinates of Suburb1 to 75,43. You have now changed the location, and found the bytes which indicate the presence of the city at it's new location, rendering it visible. Repeat for each city you want to move.
Attached Thumbnails:
Click image for larger version

Name:	illustration3.gif
Views:	44
Size:	108.7 KB
ID:	41844  
__________________
Tecumseh's Village, Home of Fine Civilization Scenarios

www.tecumseh.150m.com
techumseh is offline  
Old April 6, 2003, 18:39   #13
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 17:03
Local Date: November 1, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
And here's a shot of the entire city. I gave each suburb a name of one inconspicuous punctuation mark, so only the name Baghdad would be noticable, but events could be triggered by the capture of any of the suburbs as well.
Attached Thumbnails:
Click image for larger version

Name:	illustration4.gif
Views:	45
Size:	166.0 KB
ID:	41845  
__________________
Tecumseh's Village, Home of Fine Civilization Scenarios

www.tecumseh.150m.com
techumseh is offline  
Old April 7, 2003, 15:06   #14
Mercator
Scenario League / Civ2-Creation
Emperor
 
Mercator's Avatar
 
Local Time: 01:03
Local Date: November 2, 2010
Join Date: Dec 1969
Posts: 3,079


You can make the city names disappear altogether, if necessary...

You can give a city no name at all, or a name consisting of spaces only. In case of the latter, you must start the city name with alt+0160 (numeric pad).

As long as you start the city name with alt+0160, any combination of spaces and alt+0160 will be invisible (and you'll be able to get plenty of combinations if you have lots of nameless cities that need events)...

Distinguishing al those "spaced-out" cities in your events will be a pain though.

Was it "     " or was it "     "?
__________________
Civilization II: maps, guides, links, scenarios, patches and utilities (+ Civ2Tech and CivEngineer)
Mercator is offline  
Old April 7, 2003, 16:53   #15
Boco
Scenario League / Civ2-Creation
King
 
Boco's Avatar
 
Local Time: 18:03
Local Date: November 1, 2010
Join Date: Jan 2001
Location: of underdogs
Posts: 1,774
Thanks, Tech, Merc, and Allard. I'll read Merc's paper to see why you need to change 2-8 instances per city.

If you need two cities with a visible but practically identical name, you can use the elipsis (Alt-0133). I've named a pair of cities EEF...Base (3 x ".") and EEF…Base (1 x Alt-0133). In the game the names are displayed in a proportional font, and it's hard to tell from a unit which one is its home city. In my Events file editor, WordPad, they look like EEF...Base and EEF…Base, and are easily distinguished.
Boco is offline  
Old April 7, 2003, 17:55   #16
techumseh
Civilization II PBEMScenario League / Civ2-Creation
Emperor
 
techumseh's Avatar
 
Local Time: 17:03
Local Date: November 1, 2010
Join Date: Apr 1999
Location: of the frozen North.
Posts: 4,197
I don't know why it may take more than 1 edit to make the city visible. It wasn't anything in the papers I read, just that I found a variable number of instances where irrigation appeared in one file, but not the other. So I changed them all. Perhaps it has to do with the different map views of the various civilizations?
__________________
Tecumseh's Village, Home of Fine Civilization Scenarios

www.tecumseh.150m.com
techumseh is offline  
Old April 8, 2003, 16:20   #17
Mercator
Scenario League / Civ2-Creation
Emperor
 
Mercator's Avatar
 
Local Time: 01:03
Local Date: November 2, 2010
Join Date: Dec 1969
Posts: 3,079
Aargh... I can't seem to be able to make up my mind about what exactly your "1 edit" is. I've been rewriting this post over and over (before actually submitting it).

There would be at most 9 places where you'd need to make changes:
  • First of all, of course the city coordinates in the cities section in the savegame.
  • Secondly, to make sure the square is recognised as a city square (so the city graphic will show up, and the square gets food and road bonuses), you must add the "city present" flag in the 2nd map data block.
  • Finally, the map views of the civs you were talking about, which is the 1st block of the map data. For this case, it's the same thing that happens with the CivFort thing I made a while ago. If you use visible fortress graphics, you'll see the problem. You can't see them yet except within range of your units/cities. The map will update as you move along.

    Make sure you only update the views for the civs that should actually see the city.
__________________
Civilization II: maps, guides, links, scenarios, patches and utilities (+ Civ2Tech and CivEngineer)
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 19:03.


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