LEX File Exchange
EA Support Files
SC4 Wikipedia
Network Addon Mod
Welcome to SimCity 4 Devotion. Please login or sign up.

September 30, 2022, 09:34:46 PM

Login with username, password and session length


SC4Parser - Library for loading data from SimCity 4 savegames

Started by B100D5H0T, February 25, 2021, 06:37:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


TLDR; I created an open source .NET library that you can use to easily load data and subfiles from SimCity 4 games. It's called SC4Parser, you can find the source code, documentation (with examples) and the pre-built library over on GitHub.

Hi, for the past few months I have been working a tool that creates pictures of maps from SimCity 4 save games. As part of the project I needed a way to load and read data and some subfiles from the SimCity 4 savegames. Unfortunately, dispite the format of SimCity 4 savegames being well documented, I could not find any libraries that did what I wanted and would work with C#. Additionally, most code that I did find also relied the same old C source file to decompress items within the save games, which was a pain to get working with .NET. So in the end I decided to use the excellent research and information on the SC4 Wikipedia to build a parsing library of my own, which may save some people some pain and time. It has the following features:

  • Find and load data/files from save game using TypeID or TypeGroupInstance (TGI)
  • Methods to load common subfiles from a save game (Zone, Building, Transport and Terrain files)
  • Automatic QFS decompression

As mentioned above, the library contains a few implementations of common subfiles found in SimCity 4 savegames, some of these implementations are fully complete and others are partially completed but can still be used:

  • Buildings Subfile (Fully Implemented) - Contains a list of all buildings in a city
  • TerrainMap Subfile (Fully Implemented) - Height map for a city
  • Network Subfile 1 (Fully Implemented) - Contains all ground level network tiles (roads, rail, streets etc)
  • Network Subfile 2 (Fully Implemented) - Contains all underground network tiles (subways etc)
  • Bridge Network Subfile (Partially Implemented) - Contains all bridge tiles in the game (decoded during development)
  • Lots Subfile (Partially Implemented) - Contains a list of zones in a city
  • RegionView Subfile (Partially Implemented) - Contains general city information

If you are interested, you can find more info about what is implemented, along with documentation and prebuilt versions of the library as well as the source code over on GitHub. I hope that this provides a useful framework for others to build small tools, scripts and other programs using data found in SimCity 4 savegames and even if you don't use C# I hope that you find the code useful for working out how SimCity 4 save games are put together. Pull requests, issues and features are always welcome. Enjoy.