Jump to content
araxestroy

sc2kfix - a bugfix and modding plugin for SimCity 2000 Special Edition

204 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

 lWEMFiT.gif

Hi everyone!

As many of us SC2K fans know, many of the game's animations only work in 256-color mode, which means on modern Windows systems the game generally don't have working power/water/transportation animations. The game's installer also doesn't run on 64-bit Windows, which makes installing the game a pain, and sometimes the Save dialog just crashes the game. I'm here to tell you that these bugs have all been fixed with a small DLL/plugin I wrote that works on both known versions of SimCity 2000 for Windows (the 1995 CD Collection version and the more common 1996 Special Edition version).

sc2kfix, as I've called it, is an open source DLL that, when put in the same folder as SimCity.EXE, does a few things:

  • Reproduces the functionality of the original installer if required
  • Fixes palette-based animations not working
  • Fixes all known save crashes
  • Improves compatibility with Wine on Linux

I'm also working on potentially fixing a few additional bugs in the game, through some reverse engineering I've been working on. I'd like to make the game's music pause and resume instead of stopping and re-shuffling when the game window loses focus -- this is something that's bugged me for decades! -- and potentially figure out the cause of the military base growth bug. I'm also working on fixing animations in SCURK, but this is proving to be a bit more challenging due to the way SCURK was rewritten for Windows 95.

Another potential long-term goal is to figure out how various parts of the simulation engine work and insert code diversions/hooks into them so they can be analyzed in real-time and potentially modified further with additional native C/C++ code or a scripting language like Lua.

You can download sc2kfix and check out the source code at https://github.com/sc2kfix/sc2kfix. A quick how-to guide for downloading and installing the plugin including how to "install" a fresh copy of SC2K using it is in the readme file that is shown at the bottom of the main page of the GitHub repository. For programmers who want to hack away at whatever my most recent experiment with it is, the source code is designed to build with Visual Studio 2022, but should build fine with 2015 or later (I don't think I'm using any C++20 or C++23 features yet).

If you have any issues with the plugin and need to report a bug with it, feel free to open a GitHub issue and/or post your issue in this thread. I'll set the thread to notify me on replies, which I would presume will send me an email if someone replies to it :) Also if anyone has any repositories of technical know-how on the internals of the simulation, I'd love to know more. Whatever helps speed up the reverse engineering process would be greatly appreciated.

Glad to see there's still a few people out there playing this game. I hope this plugin is of use to you all!

 

edit 2025-04-04: We have a Discord server now; you can join at https://sc2kfix.net/discord.

  • Like 8

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 
2 hours ago, araxestroy said:

Hi everyone!

Hiya! Welcome to Simtropolis. *:)

That sounds quite exciting for what you have going. We are happy to have you here and feel free to post updates in this thread even if no one else has replied since there are very few peeps still playing 2000 and it could take weeks or months for them to realize there's something new going on.

Ofc, a warning to everyone who wants to test drive @araxestroy's DLL:

ST doesn't endorse nor oppose the file. Use it at your own risk and it'd be good to check it with your virus scanner. *;) (I did run it thru VirusTotal.com and it scores a prefect 0/71.)

  • Like 4
  • Yes 1

Chance favors the prepared mind. ― Louis Pasteur  
Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

Are you new here? Check out the Introduction and Guide to Simtropolis.

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

This is really cool! :8)

5 hours ago, araxestroy said:

Glad to see there's still a few people out there playing this game. I hope this plugin is of use to you all!

I'll have to give this a shot sometime! I still occasionally play SimCity 2000, as it is one of my childhood favorite games (very nostalgic), and I really like the game a lot, so this will be cool to see! This one and SimCity 4 are the two that I've played the most. I usually either play the Windows 95 version on my Windows 98 machine or the inferior DOS version (the latter depending on which machine or device I'm using at the time), so it will be cool to see the game up and running on modern Windows without having to do any patching, etc. I grew up with the 95 version (on XP), so I prefer it the most (not to mention that it is the superior port, too).

5 hours ago, araxestroy said:

I'm also working on potentially fixing a few additional bugs in the game, through some reverse engineering I've been working on. I'd like to make the game's music pause and resume instead of stopping and re-shuffling when the game window loses focus -- this is something that's bugged me for decades! -- and potentially figure out the cause of the military base growth bug. I'm also working on fixing animations in SCURK, but this is proving to be a bit more challenging due to the way SCURK was rewritten for Windows 95.

Another potential long-term goal is to figure out how various parts of the simulation engine work and insert code diversions/hooks into them so they can be analyzed in real-time and potentially modified further with additional native C/C++ code or a scripting language like Lua.

This would be really cool to see! Do you plan on writing any technical write-ups and/or documentation about the simulation and other undocumented aspects? I know there is some documentation about various files and save game structure (I presume you've probably read/looked through them as well, like dfloer's SC2K Docs), and as someone who likes programming and reading through source code, documents, etc., I found those to be rather interesting. I'm hoping that we will see an OpenTTD-like project for this game one day, since I doubt EA will ever release the source code to this game like they did with the original SimCity.


I am really looking forward to seeing more! Count me in as intrigued! :D

  • Like 3

Once you play with NAM installed, one simply cannot go back!

I'm waiting for the day when someone makes a Faber College lot for SimCity 4  :lol:

IMG_3716.jpg.7fe0b78e164e258bac5afb32dc9f9588.jpg

 

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 
12 hours ago, araxestroy said:

I'd like to make the game's music pause and resume instead of stopping and re-shuffling when the game window loses focus -- this is something that's bugged me for decades!

lol, this is common across 2k, 3k, and 4. I think it just has to do with the game getting disrupted and it gets reset as a result. But, definitely looking forward to whatever you can find on it. I think (could be completely wrong on this though), that some of the code for all 3 games is shared. But, 2K is all 2D graphics meant to mimic 3D graphics, so there's going to be some distinct differences for sure.

5 hours ago, TogaMasterJohn said:

I'm hoping that we will see an OpenTTD-like project for this game one day, since I doubt EA will ever release the source code to this game like they did with the original SimCity.

there's supposed to be an Open SC2K project out there. Icr the status on it though, but I believe it's advancing faster than our current OpenSC4 one (but that makes sense given that 4 is 3D, and 2K is 2D meant to look 3D)

 

and, uh, idk if it's acceptable to say? but there's a program on github you can use if you wanna get better access to the game code. If you pop into either of the discords, I can give you a name and a link for sure, but idk if it's acceptable to bring it up here (even though it's NSA software xD)

  • Like 3

I'm the guy who leaves 5 page essays as comments >.<

"I thought of the tornado as a huge, eager, but destructive dog." ---Ocean Quigley

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 
1 hour ago, Ryuu Tenno said:

idk if it's acceptable to say?

I believe it's far enough removed from current games that EA's not going to care. If they do and let me know, we can always come back and remove the reference to it.

  • Like 1
  • Yes 1

Chance favors the prepared mind. ― Louis Pasteur  
Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

Are you new here? Check out the Introduction and Guide to Simtropolis.

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

gotcha

Well, the program's Ghidra, and was written by the NSA to decompile software back into it's source code. The program's completely open source and gets updated regularly. And the notifications on github actually drive me crazy a bit, cause I keep seeing things about the NSA and I'm like wtf they doin? lol

 

  • Like 1
  • Thanks 2

I'm the guy who leaves 5 page essays as comments >.<

"I thought of the tornado as a huge, eager, but destructive dog." ---Ocean Quigley

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    28 minutes ago, Ryuu Tenno said:

    gotcha

    Well, the program's Ghidra, and was written by the NSA to decompile software back into it's source code. The program's completely open source and gets updated regularly. And the notifications on github actually drive me crazy a bit, cause I keep seeing things about the NSA and I'm like wtf they doin? lol

      and, yes, that's the US National Security Agency (Reveal hidden contents)

     

    Haha, I've been a long-time IDA user so that's my preferred decompiler and what I've been using to piece things together. I might run it through Ghidra as well to see if there's anything that IDA's missed that Ghidra won't and vice versa though.

    9 hours ago, TogaMasterJohn said:

    This is really cool! :8)

    I'll have to give this a shot sometime! I still occasionally play SimCity 2000, as it is one of my childhood favorite games (very nostalgic), and I really like the game a lot, so this will be cool to see! This one and SimCity 4 are the two that I've played the most. I usually either play the Windows 95 version on my Windows 98 machine or the inferior DOS version (the latter depending on which machine or device I'm using at the time), so it will be cool to see the game up and running on modern Windows without having to do any patching, etc. I grew up with the 95 version (on XP), so I prefer it the most (not to mention that it is the superior port, too).

    Part of what inspired me to do this was getting tired of setting up a Windows 98 VM every time I wanted to play SimCity 2000, haha. As a bonus, the game already natively seems to support window sizes all the way up to 4K -- I haven't got a larger monitor so I haven't tried anything higher, but I've been playing it maximized at 1440p for a few weeks now and it's a blast!

    9 hours ago, TogaMasterJohn said:

    This would be really cool to see! Do you plan on writing any technical write-ups and/or documentation about the simulation and other undocumented aspects? I know there is some documentation about various files and save game structure (I presume you've probably read/looked through them as well, like dfloer's SC2K Docs), and as someone who likes programming and reading through source code, documents, etc., I found those to be rather interesting. I'm hoping that we will see an OpenTTD-like project for this game one day, since I doubt EA will ever release the source code to this game like they did with the original SimCity.


    I am really looking forward to seeing more! Count me in as intrigued! :D

    Yes, I've read through dfloer's documentation and it did actually help me piece together something already -- there's a half-implemented cheat for the game that seems to be the equivalent of the Windows 3.1 "mrsoleary" cheat, which causes a firestorm. The cheat entry system is incredibly obfuscated though, so I haven't figured out exactly why it doesn't work, but the switch/case for it in the game engine is there and does exactly what it should.

    I will definitely upload anything I figure out. The project will always be open source so even if whatever documentation I write isn't fully updated, it should be easy to figure out what does what via the source :)

    4 hours ago, Ryuu Tenno said:

    lol, this is common across 2k, 3k, and 4. I think it just has to do with the game getting disrupted and it gets reset as a result. But, definitely looking forward to whatever you can find on it. I think (could be completely wrong on this though), that some of the code for all 3 games is shared. But, 2K is all 2D graphics meant to mimic 3D graphics, so there's going to be some distinct differences for sure.

    At least in SC2K what happens is -- as far as I've managed to pull apart; I'm extremely rusty at MFC -- when the main game window loses focus, as part of the handler that responds to the WM_ACTIVATE,wParam=0 message it pauses the simulation state and issues an MCI_CLOSE to the sequencer device, effectively deleting the state of the MIDI being played. When focus is regained and it receives the WM_ACTIVATE,wParam=1 message, it calls a function that I've tentatively named MusicPlayNextRefocusSong which cycles through song ID 1, 4, 8, 1, and 18 each time it's called and then completely re-opens the sequencer device and plays the appropriate MIDI. I'm almost assuredly going to have to detour the calls in that code to new handlers in sc2kfix to sort that out.

    One of my biggest challenges so far has been that the Windows 95 version of SC2K is entirely built around the Microsoft Foundation Class framework, and the in-memory layout of a lot of core classes has changed significantly enough in the intervening three decades that trying to check the in-memory layout of eg. the base CWnd class in Visual Studio 2022 gives me completely different offsets than what the game is using.

    This is definitely going to be a long-term project.

    • Like 2
    • Thanks 1

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Does this also work on any of the patches to update the game from 1.0 to 1.2?  I don't remember if those patches applied to the Windows version, or only the DOS version.  

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    19 minutes ago, Kel9509 said:

    Does this also work on any of the patches to update the game from 1.0 to 1.2?  I don't remember if those patches applied to the Windows version, or only the DOS version.  

    Those are only for the DOS and Windows 3.1 versions, not the Windows 95 version. 1.1 for DOS fixed some crashes, and 1.2 for DOS/Mac/Win3.1 added the African Swallow speed setting, fixed a memory manager bug on DOS and Windows 3.1, and improved Mac compatibility on PowerPC. The Windows 95 version was functionally already at the "1.2" level.

    I haven't figured out exactly what the sum total of differences is between the 1995 CD Collection and 1966 Special Edition versions of the Windows 95 binary, but since the 1995 version is both a) a lot more rare than the 1996 version and b) built with a completely different memory layout for the simulation state, I'm inclined to say that the 1996 Special Edition is the most recent and "canonical" version of the game and will be the one I primarily support for extensibility and debugging going forward. Reverse engineering one game is hard enough.

    The Network Edition is not supported yet and I don't know if it ever will be. There is a compatibility patch for it that someone wrote, but it's not open source and seems to just be a bunch of binary patches in some bizarre format with no documentation, so reverse engineering that as well would be an entirely separate endeavour.

    • Like 3

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    4 minutes ago, araxestroy said:

    1966 Special Edition

    good to know that NASA was able to play SimCity before successfully sending people to the moon.  *:rofl:

     

    never realized that the 3.1 and 95 versions were so different. That's wild. I've played the 95 version on win10 before, and it worked out quite well, however I've discovered that even though it worked a few years ago, it doesn't now which means Microsoft's nerfed whatever compatibility thing going with it. Like, I think there's still some loose compatibility somewhere so you can kinda set it to work, but, it literally used to work incredibly well on it's own. So, buying it on EA and trying to play it one time actually ticked me off cause they were using the DOS version, lol.

    One thing I've noticed, is that DOS version seems to have a couple minor features that the Windows version doesn't have (most notable that I can remember is the weather icons). I know this particular project is a bug fix, but I'm curious if it's possible to be able to add that to the windows version later

    • Like 2

    I'm the guy who leaves 5 page essays as comments >.<

    "I thought of the tornado as a huge, eager, but destructive dog." ---Ocean Quigley

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    I'll have to fire up the DOS version and fiddle with it a bit to see where the weather icons are represented and see if they're easy to extract from the game files. I can think of how I'd handle that from a game logic perspective in the SE version but I'll have to try to remember how to inject new menu/dialog resources into the game. The Windows API is extremely late 80s in how components like menus and dialogs and subwindows are designed and how logic is applied to them.

    There were a few changes to how 256-colour mode compatibility changed in Windows 10, and iirc most of them had to do with a partial rewrite of the Desktop Window Manager. Until that rewrite the "run in 256 colours" option actually put the display into 256-colour mode, but the rewrite basically required that all displays are always in truecolour for performance reasons. The "solution" was to do a partial emulation of 256-colour mode which worked for most programs, but it didn't accurately emulate palette changes and any software that relied on palette swapping for animation (such as SimCity 2000) were affected.

    SCURK was also completely rewritten for the Windows 95 version, and in a way that makes it much harder for me to inject simple fixes like the palette animation one in. SimCity.EXE has a lot of padding to put important functions on cache line boundaries for performance, and that made it easy to just put new code into its own memory on the fly. SCURK isn't as performance-oriented and is a lot tighter on how code is laid out in memory, so I'll have to inject some detours and run the actual fix in sc2kfix's code segment. This isn't exactly hard per se, it's just that it means that I'll need to come up with a good way to inject detours like that into SCURK as well as into SC2K itself (which I will need to do in order to be able to hook internal game functions instead of just DLL imports).

    e: I'll also grab the Windows 3.1 version of the CD Collection while I'm at it and see if there's anything notable there. I don't think there will be but it's worth poking at just for completion's sake.

    e2: The "reticulating splines" audio clip in the DOS version is much higher quality than the one in the Windows 95 version. Dear Maxis: what

    e3: The sound quality in the DOS version is just generally better than the Windows versions. Unfortunately all the sounds appear to be baked into the EXE so extracting them is going to be a pain.

    • Like 3

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    I actually kind of prefer having the weather conditions named how Win95 does it instead of through icons, just because it's easier for me to remember names than icons.

    I'm also not sure if it's accurate to say that the sound is "better" in DOS than in Windows, if only because the computer's specific sound card was expected to do the heavy lifting for MIDI-based music. A collection of good sound fonts would breathe a whole lot of life into the experience, which isn't something that's properly represented in modern Windows by default.

    Cool thread regardless. Are you familiar with the SimCity-noinstall fix for this game? That's what I've been using lately, and I like being able to edit the Mayor Name through an ini file instead of it being locked into place through the installer.

    I'd be eager to see if you could actually figure out what's up with the bugs related to military base generation. It's like the one sticking point in the game that I can recall being a problem on Win95 (both Special Edition and CD-ROM Collection) but not on DOS. I sometimes load up a save in DOS just to properly generate a military base, then load it back up in Windows afterward.

    The only other major bug in the game that's bothered me for a long time (present in every PC/Mac version I've checked) is that it doesn't seem to properly handle rail/highway neighbor connections between sessions. You could build some rail connectors, then quit and reload, and the game wouldn't recognize any of your old connectors until you bulldozed one of them. It kind of forces you into always building seaports instead (which do properly persist between sessions), which is a pain if you didn't have the foresight to generate the proper terrain for that ahead of time.

    Anyway, I too have randomly been bitten by the bug to get back into the game recently and have spent a lot of time on and off over the past several months playing and documenting things for my own sake. I even posted a guide to GameFAQs for the first time in 20 years and wrote a novel on how the water system works, on the chance that any of it might be interesting to you.

    (One specific thing that I've discovered since my last update on either of those is that the thing that I called the "monthly weather bonus" for water pumps is just the monthly humidity value divided by 2, which can actually be retrieved from the in-game newspaper weather reports.)

    I logged a whole bunch of test data on a spreadsheet when I was putting that guide together if you want to take a look.

    Some things that I still want to try and figure out but haven't yet made much headway include:

    - The actual formula for determining the "correct" RCI ratios. To date I've just been setting taxes to 9% and tinkering with zone development bit by bit to see what kind of ranges I can use before RCI demand starts to drop off. Haven't really figured out anything precise yet. Best I can tell: (1) the proper R ratio is always roughly 48% regardless of total population, (2) at very low populations, the RCI ratios are approximately 48%, 11%, 41%, (3) at 120k population, the ratios are approximately 23-9-16. The next specific thing I was planning to check for was trying to find the exact population at which C and I demand precisely balances out, but I haven't gotten around to that yet.

    - The land value thresholds that dictate when RCI zones can actually develop into each of their density stages.

    - How disaster generation actually works. I've been operating under the assumption that police and fire coverage actually have a suppressing effect on specific types of disasters, but considering how undercooked other parts of the simulation actually are when you take a closer look at them (health, education, industry), I'm beginning to think that I shouldn't just assume that that's the case anymore.

    • Like 2

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    The sound quality issue I mentioned is specifically certain waveforms in the DOS version being a higher sample rate than their Windows equivalents. It's extremely noticeable in the "reticulating splines" clip, which is 11kHz 8-bit mono in the Windows version but 32 kHz 16-bit in the DOS version when played through a Sound Blaster 16. That's nearly six times the audio data. I have no idea why they would have compressed it so much for the Windows release.

    MIDI being MIDI, these days I use a virtual Sound Canvas SC-55, but having once upon a time played through a Gravis UltraSound, I agree there's definitely a significant difference in low versus high end MIDI synthesizers!

    I'm still working on getting a good decompilation going of the DOS version to try to figure out how some of the differences came about. I'm also trying to figure out how to inject new windows and menu items etc. into the Windows version but that's going to be a bit of a longer term thing I think.

    That's a really handy spreadsheet, thanks! As for the general weirdness of the simulation engine, I'm reading through "SimCity 2000 - Power, Politics, And Planning, Revised Edition" via a scanned copy on the Internet Archive and making notes as to what stands out enough that it should be easy to find markers for in the decompilation.

    • Like 2

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    29 minutes ago, araxestroy said:

    As for the general weirdness of the simulation engine, I'm reading through "SimCity 2000 - Power, Politics, And Planning, Revised Edition" via a scanned copy on the Internet Archive and making notes as to what stands out enough that it should be easy to find markers for in the decompilation.

    That's a great resource and starting point. Just don't weigh any of the specifics therein too heavily without testing them first. There's a whole lot of information in it where I'm pretty sure the designers told the authors how things were "intended" to work but don't actually bear out in practice.

    The information on the water system was full of this kind of stuff. Comments about how elevation above ground level supposedly affects water pump output except in "early versions" of the game when this wasn't implemented (it's actually not implemented in any version, afaik). Statements about how water treatment plants service "20,000 citizens" (they actually service 2000 tiles). And so on and so forth.

    The interview with Fred Haslam is great though.

    • Like 3

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Hi all,

    Release 5 of sc2kfix has been released. You can download it and see the full changelog here: https://github.com/araxestroy/sc2kfix/releases/tag/r5

    The most notable user-facing changes are that the animation fix now works on the 1996 Special Edition version of SCURK and that the plugin now logs informational output, any enabled debugging output, and errors to a log file named sc2kfix.log. This is also the first release with the debugging console available -- this is something that I've been using to help reverse engineer the game and can be enabled by passing the command-line argument -console to SimCity 2000.

    This is also the first release with the hook framework available and enabled by default. I'm looking forward to seeing if there are any bug reports from people playing the game with this release as while I've tested the game quite a bit, and haven't had any crashes while playing the game normally with Release 5, I only have a few different setups to test on.

    The console is fairly barebones at this point but it does let you take live debug logs and structure dumps of calls for sound and music commands sent by the game to the Windows Multimedia API. It also lets you inspect arbitrary memory -- just remember to actually pause the simulation before you start poking around as while the music stops when you alt-tab, the simulation will keep going in the background!

    This is starting to turn into a real reverse engineering project for me, so Release 6 will be focused on expanding the functionality of the console and optionally fixing various idiosyncrasies in the game. It's likely there will be some configurable options for what changes to make to the game in Release 6, in case people want to play the game as vanilla as possible.

    I usually don't take suggestions from the internet, as that's a good way to drive oneself nuts, but if anyone has anything they'd like me to take a look at that hasn't already been mentioned, by all means, just post! I haven't had this much fun on a programming project for years, not only because of the reverse engineering aspect, but because people on the net seem to be enjoying having this game be playable again hassle-free.

     

    • Like 1
    • Thanks 2

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    On 2/11/2025 at 12:27 PM, Sixfortyfive said:

    I'd be eager to see if you could actually figure out what's up with the bugs related to military base generation. It's like the one sticking point in the game that I can recall being a problem on Win95 (both Special Edition and CD-ROM Collection) but not on DOS. I sometimes load up a save in DOS just to properly generate a military base, then load it back up in Windows afterward.

    EDIT: This post was not entirely correct but it sent me down a rabbit hole to find the real problem causing military bases to never grow. See my next post for details on the issue.

    Okay, I'm not going to exactly sound the alarm on this one, but I think I might have figured out at least part of what's causing the military base growth bug.

    image.png.3ede611a723f35b16e0f383c58772339.png

    These are two different cities, both forced to spawn a military base. What I've tentatively named SimulationMaybeGrowSpecificZone takes four arguments, left to right: X coordinate, Y coordinate, tile ID, and zone type. Note that the X coordinate in both of these cases seems to be forced to 7, which is the same as ZONE_MILITARY. In reality, the air force base's zone in the second example has a top left coordinate of (53, 44). Since (7, 44) is not zone type 7 (ZONE_MILITARY), SimulationMaybeGrowSpecificZone just goes "lol nope" and goes back to the military zone growth with its hands in the air. MilitaryGrowthAirForce tries a few times to slap down a 4x1 runway before giving up.

    Something somewhere is clobbering the X coordinate being passed to the function that I think is supposed to grow a military base, so unless by extremely random chance your military base gets plopped near the farthest western edge of the map, it will just never grow.

    Also it looks like there's straight up no provision in the Windows 95 version for growing naval bases. I don't think I can fix that one.

    Anyways if you wondered what my development process looks like while I'm reverse engineering things, this is what I've been working on for the past couple hours.


      Edited by araxestroy  

    I was wrong, but it led me to actually be right eventually. See next post.
    • Like 2

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Disregard the previous post. I was clobbering my own registers there. The actual issue was even dumber than that.

    SimulationMilitaryGrowth SimulationGrowSpecialZones does does all the math to find a place to plop something down itself, and that works fantastic. It calls SimulationMaybeGrowSpecificZone SimulationGrowSpecificZone to make sure that the zone at the coordinates is actually correct and that it's not eg. the middle of the ocean. Once that's confirmed, it then calls SimulationPlaceBuilding with the same arguments to actually grow the specific building it wants at the specific coordinates. The problem is that this particular function would get the request to place a building on a military zone, which is something you as the player can't do, and instead of checking to see if it's a military zone building, it just threw back a "lol nope" at SimulationGrowSpecificZone, which then threw the same "lol nope" back at SimulationGrowSpecialZones.

    Since the Air Force base always needs to grow a runway first, and then additional buildings "latch onto" that runway similar to how RCI zones won't grow unless they're within three tiles of a transit tile, you would end up in two scenarios: Either the runway never grows because you've just gotten unlucky, or the runway grows and then SimulationPlaceBuilding will never iterate from that runway. Similarly, because the Army base never had anything to start with and was always trying to place "normal" buildings so to speak, SimulationPlaceBuilding would always fail to place them and Army bases would never grow.

    I've never seen a missile silo get placed so I don't know if it ever worked. And my previous assessment that naval bases can't be designated in the Windows version seems to be holding.

    Anyways, military bases grow now. I might fiddle with some of the code because it looks like army bases only build two types of buildings, and that's pretty dull.

    image.png.b4af5aa7b35552538b518904b3735450.png

    The worst thing is this kind of thing always seems to happen within a few hours of me making a release.

    • Like 3

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Very nice!

    2 hours ago, araxestroy said:

    Also it looks like there's straight up no provision in the Windows 95 version for growing naval bases. I don't think I can fix that one.

    Last I checked, you only ever get Air Force in Win95. I've pounded the gilmartin cheat over and over on a variety of different maps and have never received anything different.

    On other versions, Air Force bases spawn on mostly flat maps, Navy bases spawn on maps with coastlines, Army bases spawn on mountainous maps, and missile silos (supposedly) spawn on extremely mountainous maps. I dunno if I've ever bothered trying to spawn a missile silo.

    • Like 2

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    24 minutes ago, Sixfortyfive said:

    Very nice!

    Last I checked, you only ever get Air Force in Win95. I've pounded the gilmartin cheat over and over on a variety of different maps and have never received anything different.

    On other versions, Air Force bases spawn on mostly flat maps, Navy bases spawn on maps with coastlines, Army bases spawn on mountainous maps, and missile silos (supposedly) spawn on extremely mountainous maps. I dunno if I've ever bothered trying to spawn a missile silo.

    I've gotten the Army base to spawn a few times in a testing session I currently have open by spamming gilmartin in a 70% mountainous map... but a) it only ever grows two building types (the 1x1 military hangar that looks like Quonset huts and the 2x2 military parking lot) so it looks absolutely ridiculous and b) it still spawned Air Force bases on pretty much every single flat patch of ground it could first.

    I think I'm going to see if I can find a way to force the game to spawn a missile silo just so I can see what it looks like, and then see if I can force it to spawn naval bases after that.

    Also Release 6 will probably bring back the mrsoleary cheat from the Windows 3.1 version. Turns out it's still in the code, it's just badly implemented because it was renamed and the cheat processor doesn't know how to handle two cheats that start with the same letter.

     

    e: As an aside, there seems to be a cap on how many of what kinds of military buildings can spawn per city, so if you gilmartin a bunch, eventually you end up with Air Force bases with no runways!

    image.png.77d7a57a93d9ce9f5800c42a61774723.png


      Edited by araxestroy  
    • Like 2
    • Thanks 1

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Good morning everyone! Release 6 is out now with the military base fixes, some grammar and ambiguity fixes in a few strings, and a proper settings dialog! You can now opt into and out of features and change your mayor and organization names entirely in-game now. There's a big shiny new "sc2kfix Settings" button on the main menu as well as a menu item in the Options menu in-game that will open the settings dialog.

    Settings are stored in an sc2kfix subkey of the SimCity 2000 registry key to keep things organized. You shouldn't need to manually tweak anything in there as, in the event of Something Going Wrong, you can always launch the game with default settings (see the release notes for details on that) or change your settings from the main menu before the simulation engine is initialized.

    I think I've fixed most of the bugs I've wanted to at this point, so future releases are going to focus on improving quality of life features, restoring missing functionality, adding new gameplay features, and realigning some things to how they're mentioned in design and gameplay documentation. You can see an example of this as a greyed-out checkbox in the settings dialog; by all accounts military bases were supposed to increase revenue and commercial demand, but this was never actually implemented in any version of the game. A longer term goal is to be able to dynamically load additional mods, possibly as far as adding a scripting language like Lua to the game and exposing various components of the simulation engine to it. I'm making good progress on reverse engineering the simulation engine and I'm feeling confident about being able to add new bits to it in the future.

    I'm always open to suggestions on things to look into the possibility of adding, changing, documenting, fixing, et cetera. Please feel free to post any ideas you have, and I'll take a look and see how much effort they'd be and put them on the todo list if they're not under the "nigh impossible" category.

    As always, source and binary forms as well as the full list of changes are on GitHub: https://github.com/araxestroy/sc2kfix/releases/tag/r6

    FSVFsEk.png

    • Like 3

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    4 minutes ago, araxestroy said:

    Release 6 is out now

    Yay! I'm quite impressed with all you've accomplished. *:)

    • Like 1
    • Yes 1

    Chance favors the prepared mind. ― Louis Pasteur  
    Remember, a few hours of trial and error can save you several minutes of looking at the README. -- I Am Devloper (on Twitter)

    Clickable ---> The Best of Cori's Posts  (scroll down a wee bit there)    Something fun: MySimtropolis - Invitation to become a SimCity 4 MySim

    Are you new here? Check out the Introduction and Guide to Simtropolis.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    4 hours ago, araxestroy said:

    Good morning everyone! Release 6 is out now

    Cool! I plan on giving this a go here soon with Wine, so I can't wait to test it out and have fun! Long live SimCity 2000!
     

    4 hours ago, araxestroy said:

    I'm always open to suggestions on things to look into the possibility of adding, changing, documenting, fixing, et cetera. Please feel free to post any ideas you have, and I'll take a look and see how much effort they'd be and put them on the todo list if they're not under the "nigh impossible" category.

    There are some things that I can't help but wonder if they are possible to implement or not [my sincerest apologies if this is a long, complicated, and overwhelming list!]:

    1. Bigger map sizes
      - e.g., 256x256?
      - This is one thing that I've always dreamed of in SC2K since I was a kid (I was spoiled by the bigger map sizes in SC3K and SC4! *:lol:).
       
    2. Changing the background color in regular city view from brown to a different color (like from the game's color palette)
      - I thought about trying this via hex editing the executable long ago (assuming that the value is stored there), but I never did it; it may be easier via a DLL plugin [theoretical example: choose a color from the game's palette, write the number in hexadecimal or whatnot in an INI file, and have the DLL read that and then patch it in memory].
      - Or, possibly, utilize bitmaps for a picture background (like the PS1 version's golden tile background... or a SC4-esque blue grid background) [though if I had to guess, the picture's colors would probably need to match the game's color palette] [or implement a routine to draw out a background (like SC4-esque grid) instead of a bitmap, though that may be difficult to align with the city's grid itself].
       
    3. Adding more buildings to a tileset
      - That may require extensive modification to both SCURK and the game itself, though it would be cool to have more variety.
       
    4. A way to extract the DOS sounds and use those instead of the low quality sounds (that are in WAVE)
      - Either via another program or a method of some sort; the user would need to own the DOS version in order to do so.*
      -- I think the music and the user's selected tileset were stored in the main .DAT file, so it's weird that the sounds are stored in the EXE instead. Go figure!**
      -- However, since the 95 version (and I think the 3.1 version as well) stores the sounds in .WAV files, it may be easier to record each sound from the DOS version (either via real hardware or from a version of DOSBox), do some careful editing and whatnot to get everything right (time-wise), export each sound as in WAVE, and name each sound appropriately [I personally want to test this out and see how well it would work].
       
    5. Adding the ability to place subways through pipes
      - If I remember correctly, this feature was wanted by the developers but they couldn't implement it (either in-time for shipment or it was just technically impossible without a major rework of something or some things, so this might be difficult to implement (if even possible) [I think underground power lines were scrapped because of similar reasons during development, and that's why they weren't implemented (perhaps a SC3K-like approach to power distribution could be implemented?)].
       
    6. Adding new network types [like avenues, one-way roads, more types of bridges]
      - Probably a long way down the road (no pun intended, and assuming it's even possible).
       
    7. Adding agriculture to the game [semi-dependent on #3]
      - Same situation as above [#6].
      - Either via a new industry zone type or how it works in SC3K.
      - This seemed to have been an idea at one point in time during development, but it never came to be.
       
    8. A way to modify the ground colors, bedrock, roads, etc.
      - Same situation as #6 and #7, although this would be cool.
      - Especially the ground; while I'm nostalgic for and don't mind the tan and brown colors, it's always made me wonder if it would be possible [like via hex editing or another method; like #2].
       
    9. And lastly, as other fellow SC2K fans on here were briefly talking about earlier in this post: adding the weather graphics to go alongside the weather descriptions in game (probably in a new box within the game window, similar to the DOS version)
      - Assuming the extraction can be easily done (if not, one could theoretically replicate them), the weather data can easily be pulled and updated in real time, and a box for it could be created within the game window.
       

    Those are just some things that I can think of, and some of those I've wondered about for a long time.

    I can't wait to try out SCURK with the patches! I loved playing around with it when I was a kid, and I occasionally create new buildings for the game (mainly real-life retail). Apparently, the DOS version is superior, but I've never had any issues whatsoever with the 95 version of SCURK.

    Also, if you need an artist for a tileset or in-game graphics, let me know! I do enjoy making things in pixel art here and there (SC2K and SCURK are what got me into it when I was younger), so if necessary at some point, I'd be happy to help out in my spare time!
     

    * I never realized the sound difference between the two until you pointed it out! You'd think the DOS version would have been worse... but it's not the first time that a Windows port of a Sim title had some sort of an inferior issue; if I remember correctly, the Windows version of SimFarm only has a 16 color palette while the DOS version has a "full" 256 color palette! In this case, the DOS version is technically superior (I think the sound quality may be better in the DOS version, too!).
    ** Even though you are working on the Windows 95 version, I wonder if an extraction tool could be made for the DOS SC2000.DAT file (or for DAT files in general), as I've always wanted to hear (and see) the differences between all of the MIDIs (from what I've read online, in the SC2000.DAT file, there are multiple versions of each song that are optimized for the various sound cards that the DOS version supports).
     

    6 hours ago, araxestroy said:

    A longer term goal is to be able to dynamically load additional mods, possibly as far as adding a scripting language like Lua to the game and exposing various components of the simulation engine to it. I'm making good progress on reverse engineering the simulation engine and I'm feeling confident about being able to add new bits to it in the future.

    Yippee! :8)  Great job on the project so far! All of this work is very cool to see!

    • Like 1

    Once you play with NAM installed, one simply cannot go back!

    I'm waiting for the day when someone makes a Faber College lot for SimCity 4  :lol:

    IMG_3716.jpg.7fe0b78e164e258bac5afb32dc9f9588.jpg

     

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    For what it's worth, as cool as some of those things sound, I'm a whole lot more interested in more fundamental bug fixes (military bases, neighboring connections, etc.) and just demystifying how the simulation works than i am in an outright rebalancing. If I wanted to play a game with bigger maps, more zone variety, and education and health subsystems that are more consequential, for example, then I'd probably be playing a different game in the first place.

    Although while I am thinking about it, has anyone in here ever gotten a grip on how things like the mayor's "approval rating" and spontaneous parades work? I know you get a boost to that stuff when taxes are set lower, but is there anything else to it? Been more interested in min-maxing for that kind of stuff instead of total population whenever I've gone back to the game lately.

    • Like 2

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    I'm 100% for demystifying the simulation and quality of life improvements (bug fixes, unfinished things, etc.) as well. I believe that's a rather important part, and it's by far more important than my ideas right now. *:lol:

    A lot of the stuff that I mentioned would be cool but not necessarily "needed" (especially at the moment). I'm curious to see how far things can be extended or pushed within the game, but we're (most likely) not quite there yet. The possibility for more buildings and things like that would be better for "later on down the road" investigations.

    1 hour ago, Sixfortyfive said:

    Although while I am thinking about it, has anyone in here ever gotten a grip on how things like the mayor's "approval rating" and spontaneous parades work? I know you get a boost to that stuff when taxes are set lower, but is there anything else to it? Been more interested in min-maxing for that kind of stuff instead of total population whenever I've gone back to the game lately.

    That is a good question. I hadn't thought about how the approval rating and spontaneous parades work, but it definitely does make me wonder now. I've received the spontaneous parades thing numerous times throughout my years of playing it. Just about each time I've received one in the game, I usually get something from a newspaper (usually) right afterward. Perhaps it's a coincidence? I can't recall if the main headline was always a positive thing or not.

    Speaking of newspapers: the surveys. I wonder how the game calculates each of the percentages (crime, unemployment, traffic, etc.).
     

    On a quick side note, if I get the chance this weekend or early next week, I want to test out my sound effect replacement idea, as I am curious to see if there are any hard-coded limitations regarding sounds in the Special Edition Windows 95 version.

    • Like 1

    Once you play with NAM installed, one simply cannot go back!

    I'm waiting for the day when someone makes a Faber College lot for SimCity 4  :lol:

    IMG_3716.jpg.7fe0b78e164e258bac5afb32dc9f9588.jpg

     

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Still scrolling through everything and writing replies but I'd figure I'd address this first and rather quickly:

    1 hour ago, TogaMasterJohn said:

    On a quick side note, if I get the chance this weekend or early next week, I want to test out my sound effect replacement idea, as I am curious to see if there are any hard-coded limitations regarding sounds in the Special Edition Windows 95 version.

    As far as accepted sound formats go there aren't, but in the course of double-checking to see what the maximum sound file size in vanilla SC2K is I found not one but TWO buffer overflow vulnerabilities in the sound buffer loader :golly:

    • 504.wav (SOUND_EXPLODE) must be no bigger than 12,738 bytes.
    • 505.wav (SOUND_CLICK) must be no bigger than 2,426 bytes.
    • 512.wav (SOUND_BOOS) may be up to 32,768 bytes.
    • All other sounds must be no bigger than 27,302 bytes.

    Increasing these limits should be easy and seem to have only been put in place due to Maxis wanting to run the game and operating system in 8 megs of RAM. I'll put it on the to-do list for Release 7. 

    • Like 1
    • Thanks 1

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    This is quite something indeed, it's always been interesting regarding certain behavioural differences between the different ports of SC2K (the military base case was always a strange one especially after seeing the different type spawn normally under DOS, it's now very nice to be able to get fully populated bases in the Win95 version).

    Regarding sound: one particular quality of life case that comes to mind is to be able to control the volume for both the Music and Sound Effects playback individually (It is quite the surprise especially when the latter is played on full-blast, sometimes it's sadly necessary to disable the effects playback entirely).

    Greatly enjoying being able to easily play the game under later versions of Windows once more though with your library.

    EDIT: Upon looking at the referenced sound function call, that could be... interesting in itself.


      Edited by AF  
    • Like 2

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    PPP makes the occasional comment about how the city council may occasionally choose to enact ordinances on their own, and that this can be prevented by disabling disasters. I think the chapter on ordinances leads off with it.

    • Like 2

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Oh, here's a QoL feature that might be conceptually simple to implement:

    The simulation slows down several of its regular updates once you cross the 50k population threshold. For example, updates to the power and water grid are instantaneous when you're building a small city, but after the 50k mark, those updates seem to only happen once per month. Can you just throw out that behavior and keep the simulation updating at its initial rate the whole way?

    The devs were just making compromises for 1993 hardware that aren't terribly relevant anymore.

    • Like 2

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    2 hours ago, Sixfortyfive said:

    Oh, here's a QoL feature that might be conceptually simple to implement:

    The simulation slows down several of its regular updates once you cross the 50k population threshold. For example, updates to the power and water grid are instantaneous when you're building a small city, but after the 50k mark, those updates seem to only happen once per month. Can you just throw out that behavior and keep the simulation updating at its initial rate the whole way?

    The devs were just making compromises for 1993 hardware that aren't terribly relevant anymore.

    Sure, if it happens monthly after that threshold it should be easy to track down where in the month it happens and unwind where it originally happens from there.

    Currently working out the best and most balanced way to restore the unimplemented "military bases create revenue and increase commercial demand" functionality. I'm pretty sure it's going to need to scale with both population and base growth, but bases grow so quickly that I might want to find a way to scale base growth a bit. I also ought to take a look at the DOS version and see what the monthly rate of base growth looks like there, since in the existing growth code the whole base seems to get completely built up in the span of about three and a half months, even if you type "gilmartin" in at an empty city.

    Unrelated to actual development/RE progress, I really want to hook up timer to measure how fast African Swallow can truly be. It'll vary from computer to computer I kind of want to see how fast it is on my 7700X versus on a minimum-spec machine (a 486 with 4 megs of memory and a 512K SVGA card).

    • Like 2

    Share this post


    Link to post
    Share on other sites

    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections