Editing started scenarios?

Potamus Maximus

Chieftain
Joined
Feb 28, 2010
Messages
7
First post so please be gentle to the newbie if I'm posting this in the wrong area...LOL!

Here's my issue... I created a huge map scenario, 10 civs, modified rules, units, improvements, blah, blah. After playing it for about 27 hours I realized I goofed when I (somehow) managed to give my modified AEGIS Cruisers a +27 HP bonus. I've got absolutely no idea how I did it. :hammer2:

I created the scenario using the PC version CIV3Xedit with virtual PC, but am running the game on a 500mhz PPC G3 iMac with OSX 10.4.11. Is there anyway to edit this thing without having to start the game all over? I think I'd have to convert the game file into a .biq file or something like that but I'm clueless as the proper steps involved.

Again, thanks for being gentle on a poor fool! :spear:
 
The only way to do so is to manually edit the save game (.sav) file. This would be the case even if you were running Windows, so there's no easy fix in Virtual PC, either. Your only option to avoid starting over, and to fix the HP bonus mistake, is to use a hex editor to manually edit the file.

If you'd like, I can post the information you'll need to perform that edit yourself, and restore the AEGIS Cruiser to its proper hitpoints. However, if you'd prefer, you can e-mail me the .sav file, and I can edit it myself and send it back to you. It probably would be easier for me as I've used hex editors on Civ .sav and .biq files a good amount in the past year, and know what to change to get the intended change. I've sent you an e-mail via the e-mail system here, which should arrive at your e-mail inbox shortly, as you don't have enough posts for private messages yet. It ought to give you my e-mail address, to which you can send the file. Depending on when you send it, it may take me up to a day after you send it to get it sent back.
 
Thanks for the offer Quintillus, but I'm sort of a hands on guy so if you could send me the instructions I'd appreciate it. Besides, I'll probably make a similar bone-headed maneuver in the future so I'd better get used to doing stuff like that.
 
Okay. First off you'll need the hex editor. In a Google search for one, I found Hex Fiend, which seems to have good reviews and is open source, both good indications for it not having any malware. I can't say how good of a hex editor it is in practice, not having a Mac, but it has all the tools you'll need.

Second, you'll need the uncompressed version of the .sav file. On Windows, this means you'll need the auto-save. The distinguishing feature of the uncompressed version, before opening it with a hex editor, is the much larger file size. I can't guarantee that the Mac version also has uncompressed auto-saves. Hopefully it does; if not, you'll need to play one turn on Windows and use the auto-save that generates.

In the following section, I've added notations, which I'll explain in more detail below. So a stray "1" indicates a note with more detail follows, etc.

Third, you'll need some documentation of the .sav file. Fortunately, in this case, the change you'll need to make is in the well-documented part of the .sav file where the .biq file that it was created from is embedded. You can view that documentation here at fellow Civilization fansite Apolyton. The specific section you'll be needing is the unit section (PRTO), available here within the same page I linked earlier. You'll need to find the HP Bonus value within the PRTO section in that file, and calculate its offset (in bytes)1 from some easy-to-find threshold - I recommend the civilopedia entry, as it will be in plain text. Then, it your text editor, search for the Aegis Cruiser's Civilopedia entry (it should be PRTO_AEGIS_CRUISER) in the ASCII (plain-text) part of your text editor2. Then, starting from the first byte of the Civilopedia entry, move forward3 however many bytes it is that the HP Bonus is offset4. At that point, make sure your cursor is at exactly the correct offset and you are in the hex part of the editor (not ASCII). You want the next four bytes to all contain zero values, to show a hitpoint bonus of zero. To set those values, type "0" (without quotes) eight times in a row. You'll notice that each time you hit "0", the character below the cursor either changes to zero or stays the same (if it's already zero), and the cursor advances by half a byte (or at least, this is standard hex editor behavior). Once you've done this, save the file, load it up, and your AEGIS Cruisers should be back to normal.

Of course, you should make a backup of the file first. If you're off by even half a byte, you probably won't get the change you want, and you'll notice it quickly. But, assuming all goes well, all your AEGIS Cruisers in the game will have the standard number of hitpoints the next time you load the game.

Below are the extended notes. I've spoilered them to save space:

Spoiler Notes :
1 - The values in the left column of the document I've linked you to are the size in bytes of each section of the .biq file (or in this case, .sav file). From them, we can draw that the bombard strength field starts 32 bytes after the civilopedia entry field, and the bombard range field starts 4 bytes after the bombard strength field, for example.

2 - Most hex editors simultaneously display both the hexadecimal values of the file, and the ASCII values those correspond to. In the screenshot I've attached, you see the ASCII values on the right, the hexadecimal ones in the middle, and to the left, the offset of the line from the beginning of the file (which you won't be using here). To find the AEGIS Cruiser, make sure your cursor is in the ASCII part of the hex editor, and use its search function (you may have to specify that you are searching for text). If the hex editor I linked to doesn't have both ASCII and hexadecimal values visible at once, you probably want to try a different one.

3 - You can move forward one byte at a time with the right arrow in most hex editors. You can also move forward 16 bytes at a time with the down arrow in most hex editors. Note that if you move forward in the ASCII part, you simultaneously move forward in the hexadecimal part, and vice versa. Also note that in the hexadecimal part, each byte is equal to two hexadecimal characters (so "FF" represents one byte, as does "E3").

4 - This should be 124 bytes.


If this isn't working, or I left out some crucial information on how to do this, just post a reply and I'll try to clarify. Once you get the hang of it a bit you'll notice that you can alter all sorts of data in this manner - if you decided halfway through a game that you wanted the Industrial Ages to be called the Age of Steam instead, you could change that. Of course this can be used to exploit the AI if you like (or give it some help if it isn't proving challenging enough), but doubtless the most useful way to use it is to fix errors such as this.
 
To provide some Mac-specific input to Quintillus' excellent details above:

1. I use HexEdit on the Mac - just because I've always used it :) I'm sure Hex Fiend works as well, but I haven't tried it.

2. I can confirm that Mac Autosaves are uncompressed. You can also use my FileValet utility to uncompress a normal save.
 
Wow! Thanks for the info. I'm going to get going on this right now and let you know how I do.

FWIW, my nephew 'fessed up about messing with my game. He said it was the least he could do for me getting him addicted to civ. Kinda made me feel like a crack dealer...LØL!
 
UPDATE: Your advice worked like a charm. It was slow-going at first, but everything is as it should be now.

Again, thank you for your great help!
 
All right! Glad I could help and that everything's back to normal. Funny about your nephew - I'm sure there's plenty of other CivFanatics out there who occasionally wish they hadn't been introduced to Civ as well when they find themselves still playing halfway through the night before having to get up early.
 
Okay, It seems that my nephew has really been toying with me. The (not-so-) little brat made my rate of fire values for all my modern naval forces and my stealth bombers to 0. If my guess is correct, this means that regardless of bombard value, you're not doing any damages because it's making no bombard attempts (for lack of better phrasing).

Quintillus, your directions were awesome because I've NEVER used a hex editor before and now I (probably mistakenly) think I'm dangerous. Using the same directions you gave me for the HP bonus, I corrected the ROF for the Aegis cruiser, saved, tried the game and the ROF change showed up. The thing is, when I went ahead and did a similar edit to the other units, they didn't change. I also noticed that all the saved files produced this way all start "Potamus Maximus of t#61E019" or something like that.

Is there something I'm missing here?
 
The thing is, when I went ahead and did a similar edit to the other units, they didn't change
Are you sure you edited the other units correctly? The rate of fire value is shown as a LONG value, so it is 32 bits, or 4 x 8-bit bytes. The first byte is the least significant one, and is likely to be the one you need to change.

I also noticed that all the saved files produced this way all start "Potamus Maximus of t#61E019" or something like that.
The hex editor you are using probably can't handle long file names, and is creating a corrupt file name. Try changing the file name to something short. Some of this software was written back in the dark ages.
 
Okay, It seems that my nephew has really been toying with me. The (not-so-) little brat made my rate of fire values for all my modern naval forces and my stealth bombers to 0. If my guess is correct, this means that regardless of bombard value, you're not doing any damages because it's making no bombard attempts (for lack of better phrasing).

Quintillus, your directions were awesome because I've NEVER used a hex editor before and now I (probably mistakenly) think I'm dangerous. Using the same directions you gave me for the HP bonus, I corrected the ROF for the Aegis cruiser, saved, tried the game and the ROF change showed up. The thing is, when I went ahead and did a similar edit to the other units, they didn't change. I also noticed that all the saved files produced this way all start "Potamus Maximus of t#61E019" or something like that.

Is there something I'm missing here?

I'm not sure why the change wouldn't show up if you modified the correct bits and loaded the correct file. I'd check again that you modified the correct bits, and also make sure that you are loading the file that is the game after the rate-of-fire change - with names like "Potamus Maximus of t#61E019", it might be easy to select the wrong one. As for the odd names, AlanH's guess is better than mine. The good news is, the name of the file has nothing to do with the .biq format, so strange names don't indicate anything odd within the .biq.
 
Sorry for the delay in responding. You're guess was right AlanH, the file name was too long...as soon as I shortened it up everything worked fine.
 
Howdy folks! I hope all is well for all here.

So I'm playing another homemade campaign of death and general bedlam when I realize that I mistakenly allowed for a Space Race Victory...I don't really want that. My question is concerning the actual location of the particular bits I need to screw around with. Where!?

ALSO...am I even remotely correct that I should be searching for "GAME" in the ASCII section?

Again, my apologies for being the special-needs kid.:crazyeye:
 
Gramphos is the authority on this and all issues to do with scenario editing on Civ3. From his Apolyton thread on the BIQ format (my emphasis):

Code:
GAME SECTION

  4	char		"GAME"

  4	long		number of scenario properties (1)



  For each scenario property:

    4	long		length of scenario property

    4	long		default game rules (1=use, 0=don't use)

    4	long 		default victory consitions (1=use, 0=don't use)

    4	long		number of playable civs (0=all playable)

    for each playable civ

      4 long		id of playable civ

    4	long		victory conditions and rules set (binarry):

							00000000

			domination victory enabled	.......1

			[b]space race victory enabled	......1.[/b]

			diplomatic victory enabled	.....1..

			victory by conquest enabled	....1...

			cultural victory enabled	...1....

			civ specific abilities enabled	..1.....

			culturaly linked start		.1......

			restart players			1.......
 
Back
Top Bottom