Announcement

Collapse
No announcement yet.

hex edit needed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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

    Comment


    • #3
      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

      Comment


      • #4

        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?
        El Aurens v2 Beta!

        Comment


        • #5
          Gimme.
          Blog | Civ2 Scenario League | leo.petr at gmail.com

          Comment


          • #6
            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 Files
            Tecumseh's Village, Home of Fine Civilization Scenarios

            www.tecumseh.150m.com

            Comment


            • #7
              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.
              El Aurens v2 Beta!

              Comment


              • #8
                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?
                El Aurens v2 Beta!

                Comment


                • #9
                  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 Files
                  Tecumseh's Village, Home of Fine Civilization Scenarios

                  www.tecumseh.150m.com

                  Comment


                  • #10
                    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 Files
                    Tecumseh's Village, Home of Fine Civilization Scenarios

                    www.tecumseh.150m.com

                    Comment


                    • #11
                      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 Files
                      Tecumseh's Village, Home of Fine Civilization Scenarios

                      www.tecumseh.150m.com

                      Comment


                      • #12
                        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 Files
                        Tecumseh's Village, Home of Fine Civilization Scenarios

                        www.tecumseh.150m.com

                        Comment


                        • #13
                          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 Files
                          Tecumseh's Village, Home of Fine Civilization Scenarios

                          www.tecumseh.150m.com

                          Comment


                          • #14


                            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)

                            Comment


                            • #15
                              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.
                              El Aurens v2 Beta!

                              Comment

                              Working...
                              X