Flintlock
Emperor
- Joined
- Sep 25, 2004
- Messages
- 1,193
Behold what I've been working on for the past couple of months:
It's an editor for those special sound files with extension .amb that Civ 3 uses. (I don't know if I'll ever figure out what AMB stands for.) AMB files are pretty complex internally and needlessly so. When they're boiled down, all they do is play WAV files at certain times with two optional random effects applied.
Here's an example of using the editor to fix one of the broken AMBs included in Civ 3. The file in question is GalleyAttack.amb. You know how when galleys are in combat, all you hear from them is the sound of water splashing? The developers intended for there to be a peal of ballistas as well. The WAV files for that are in the Galley's art folder, named GalleyAttackArrow.wav and GalleyAttackBow.wav. However they are not played because the AMB file is broken. First let's load it up:
Only the water splash effect is shown in the table because the editor only creates rows for correctly specified WAV sounds. To see the internals of the AMB in more detail, select File -> View AMB Details:
"Bowg" in Kmap #1 is immediately suspicious, that seems like a typo. The var names from the Prgm sections are supposed to match with var names from the Kmap sections. Notice that one Prgm has a var name of "Bow" which does not match "Bowg" and another has the name "Arrow" which does not match "Arrow1". To fix this, we use Edit -> Add Row to create two new rows and fill them in with the parameters for the bow and arrow WAV sounds:
The params for the random effects come from the Prgm sections, the WAV file names come from the Kmap sections, and the times & durations come from the Midi tracks (not shown in the screenshot above). That's it, this AMB file is now fixed and we can listen to it by pressing "Play Preview" and save it to hear it in-game. If we were to look at the details again, we'd see two new sets of sound track + Prgm + Kmap, one for each of the new rows. The old broken data is still there, and it doesn't cause any problems, but we can delete it by selecting Edit -> Prune.
By the way, there aren't that many other broken AMBs in the game files. I've detected only four or five from among the 251 total AMB files. GalleyAttack.amb is the most seriously broken because you clearly hear that something is missing when it's played in-game. For the other broken files, either the missing sounds are subtle, or the needed WAV files were never included with the game, so fixing them is pointless or not possible. Fixing such files isn't the purpose of the editor, anyway, it's just as an example.
The AMB Editor is included with C3X starting in version 23. I considered making it a separate thing but it's small enough that I didn't bother. It adds only about 30 kB to the compressed size of the mod. The editor is a C script like the rest of C3X. That means it compiles itself when it's run like scripting languages such as Python typically do. Those .c files in the AMB Editor folder are the editor's source code, which I encourage you to have a look at if you're interested.
Download it here: https://github.com/maxpetul/C3X/releases/tag/Release_23_Preview_2
It's an editor for those special sound files with extension .amb that Civ 3 uses. (I don't know if I'll ever figure out what AMB stands for.) AMB files are pretty complex internally and needlessly so. When they're boiled down, all they do is play WAV files at certain times with two optional random effects applied.
Here's an example of using the editor to fix one of the broken AMBs included in Civ 3. The file in question is GalleyAttack.amb. You know how when galleys are in combat, all you hear from them is the sound of water splashing? The developers intended for there to be a peal of ballistas as well. The WAV files for that are in the Galley's art folder, named GalleyAttackArrow.wav and GalleyAttackBow.wav. However they are not played because the AMB file is broken. First let's load it up:
Only the water splash effect is shown in the table because the editor only creates rows for correctly specified WAV sounds. To see the internals of the AMB in more detail, select File -> View AMB Details:
"Bowg" in Kmap #1 is immediately suspicious, that seems like a typo. The var names from the Prgm sections are supposed to match with var names from the Kmap sections. Notice that one Prgm has a var name of "Bow" which does not match "Bowg" and another has the name "Arrow" which does not match "Arrow1". To fix this, we use Edit -> Add Row to create two new rows and fill them in with the parameters for the bow and arrow WAV sounds:
The params for the random effects come from the Prgm sections, the WAV file names come from the Kmap sections, and the times & durations come from the Midi tracks (not shown in the screenshot above). That's it, this AMB file is now fixed and we can listen to it by pressing "Play Preview" and save it to hear it in-game. If we were to look at the details again, we'd see two new sets of sound track + Prgm + Kmap, one for each of the new rows. The old broken data is still there, and it doesn't cause any problems, but we can delete it by selecting Edit -> Prune.
By the way, there aren't that many other broken AMBs in the game files. I've detected only four or five from among the 251 total AMB files. GalleyAttack.amb is the most seriously broken because you clearly hear that something is missing when it's played in-game. For the other broken files, either the missing sounds are subtle, or the needed WAV files were never included with the game, so fixing them is pointless or not possible. Fixing such files isn't the purpose of the editor, anyway, it's just as an example.
The AMB Editor is included with C3X starting in version 23. I considered making it a separate thing but it's small enough that I didn't bother. It adds only about 30 kB to the compressed size of the mod. The editor is a C script like the rest of C3X. That means it compiles itself when it's run like scripting languages such as Python typically do. Those .c files in the AMB Editor folder are the editor's source code, which I encourage you to have a look at if you're interested.
Download it here: https://github.com/maxpetul/C3X/releases/tag/Release_23_Preview_2
Last edited: