Flintlock
Emperor
- Joined
- Sep 25, 2004
- Messages
- 1,178
Update July 21 '22: This mod started as a fix for the submarine bug and since then has evolved into much, much more. See the full feature list on the resource page here: https://forums.civfanatics.com/resources/c3x.28759/
For the past month or so I've been working at reverse engineering Civ 3. So far I've tackled and solved the submarine bug, and I might look into other bugs like the broken science age, but what I'd really like to do is implement some new features to make the game less tedious.
For the sub bug fix, it's implemented as a C script that compiles itself, launches Civ 3, then patches the code in memory. More specifically it only changes one bit, a boolean argument to a function. For some background on the sub bug, see https://forums.civfanatics.com/threads/submarine-bug-investigation.526635/. My patch changes the boolean argument in a call to the function Antal1987 named f_Get_Tile_OccupantID. I'm not 100% confident in my fix as I haven't fully understood the code that I'm patching, instead I took a more empirical approach. But I have verified the patch works in a few different scenarios so I'm pretty confident in it.
To launch Civ 3 with the patch applied, extract sub_bug_fix to the Conquests folder and run "RUNME.bat". Unlike other EXE mods floating around, this one doesn't replace or even make any permanent changes to the EXE. This has some advantages like no installation and no copyright infringement but also has the big disadvantage that you have to launch Civ through the script instead of through Steam or a shortcut. Maybe later versions will alter the EXE on disk instead of in memory. The only supported versions of Civ 3 are the Steam and GOG versions of Complete, although other versions might work if they use the same executable as GOG. Lastly this mod is open source, so check out "ep.c" if you're curious.
For my next trick, I intend to implement stack bombard. I've already implemented a system to compile and inject C code into the executable (shipping the mod as a C script is neat but the real reason to have TCC handy is to make this possible) and used it to make a prototype. What's left to do is make stack bombard behave smarter, make sure it doesn't break at the edges, add a button to the interface, and port the whole thing to the Steam executable.
After that there's one more feature I definitely want to implement, a warning that pops up when you try to end the turn with cities that will fall into disorder, and a few more I have in mind like:
- AIs propose he most favorable trade they'll accept instead of making the player work for it
- Cash rush costs are pre-exploited, i.e., you only pay double for shields up to the cost of the cheapest thing you could rush
- Cities do not unassign citizens from polluted tiles (arguably not convenient since you're potentially losing the specialist yield)
I am open to suggestions! Based on what I've read, a lot of people are playing with the NoRaze mod so I'll look into integrating that at some point (and if someone could tell me exactly what it patches that would save me a lot of time re-implementing it). Also I've seen many requests for an increase to the 31 civ limit. This would be maybe not an impossible task but at least a herculean one since the limit is baked so deeply into the program. I doubt I'll ever manage to do it, but that fact that it's so difficult makes it tempting.
Long Live Civ 3!
For the past month or so I've been working at reverse engineering Civ 3. So far I've tackled and solved the submarine bug, and I might look into other bugs like the broken science age, but what I'd really like to do is implement some new features to make the game less tedious.
For the sub bug fix, it's implemented as a C script that compiles itself, launches Civ 3, then patches the code in memory. More specifically it only changes one bit, a boolean argument to a function. For some background on the sub bug, see https://forums.civfanatics.com/threads/submarine-bug-investigation.526635/. My patch changes the boolean argument in a call to the function Antal1987 named f_Get_Tile_OccupantID. I'm not 100% confident in my fix as I haven't fully understood the code that I'm patching, instead I took a more empirical approach. But I have verified the patch works in a few different scenarios so I'm pretty confident in it.
To launch Civ 3 with the patch applied, extract sub_bug_fix to the Conquests folder and run "RUNME.bat". Unlike other EXE mods floating around, this one doesn't replace or even make any permanent changes to the EXE. This has some advantages like no installation and no copyright infringement but also has the big disadvantage that you have to launch Civ through the script instead of through Steam or a shortcut. Maybe later versions will alter the EXE on disk instead of in memory. The only supported versions of Civ 3 are the Steam and GOG versions of Complete, although other versions might work if they use the same executable as GOG. Lastly this mod is open source, so check out "ep.c" if you're curious.
For my next trick, I intend to implement stack bombard. I've already implemented a system to compile and inject C code into the executable (shipping the mod as a C script is neat but the real reason to have TCC handy is to make this possible) and used it to make a prototype. What's left to do is make stack bombard behave smarter, make sure it doesn't break at the edges, add a button to the interface, and port the whole thing to the Steam executable.
After that there's one more feature I definitely want to implement, a warning that pops up when you try to end the turn with cities that will fall into disorder, and a few more I have in mind like:
- AIs propose he most favorable trade they'll accept instead of making the player work for it
- Cash rush costs are pre-exploited, i.e., you only pay double for shields up to the cost of the cheapest thing you could rush
- Cities do not unassign citizens from polluted tiles (arguably not convenient since you're potentially losing the specialist yield)
I am open to suggestions! Based on what I've read, a lot of people are playing with the NoRaze mod so I'll look into integrating that at some point (and if someone could tell me exactly what it patches that would save me a lot of time re-implementing it). Also I've seen many requests for an increase to the 31 civ limit. This would be maybe not an impossible task but at least a herculean one since the limit is baked so deeply into the program. I doubt I'll ever manage to do it, but that fact that it's so difficult makes it tempting.
Long Live Civ 3!
Last edited: