A DLL Plugin for SimCity 4 that experiments with adding a new ordinance to the game. The game's ordinance simulator is one of the few systems that allows a DLL to add new code for the game to use in its simulations.
The plugin will show up in the ordinances list as New ordinance test1
. The ordinance is an expense ordinance with the same monthly cost as the Power Conservation ordinance (
The plugin currently sends the following effects to the game: Mayor Rating, Commercial Demand Effect, Travel Strategy Modifier and Air Effect by zone type. All of those effects are using the default values from Ingred.ini, so the shouldn't have any in-game effect.
This mod is experimental, you probably should not test it in a city you care about.
- Adds a new ordinance into the game that does not replace any of the built-in ones.
- Allows the ordinance to have a custom monthly cost calculation or availability conditions (e.g. starting year or specific buildings that must be in the city).
- The game persists the ordinance's state to the city save file.
- The available ordinance effects are restricted to the ones that Maxis already included in the game.
- These effects are hard-coded into the various game systems, e.g. the Travel Strategy Modifier behavior is hard-coded into the traffic simulator.
Windows 10 or later.
The plugin can be downloaded from the Releases tab: https://github.com/0xC0000054/sc4-add-new-ordinances/releases
- Close SimCity 4.
- Copy
SC4AddNewOrdinance.dll
into the Plugins folder in the SimCity 4 installation directory. - Start SimCity 4.
This project is licensed under the terms of the MIT License.
See LICENSE.txt for more information.
gzcom-dll Located in the vendor folder, MIT License.
- Visual Studio 2022
- Open the solution in the
src
folder - Update the post build events to copy the build output to you SimCity 4 application plugins folder.
- Build the solution
Visual Studio can be configured to launch SimCity 4 on the Debugging page of the project properties.
I configured the debugger to launch the game in a window with the following command line:
-intro:off -CPUcount:1 -w -CustomResolution:enabled -r1920x1080x32
You may need to adjust the resolution for your screen.
cGZNewOrdinanceTest.cpp is the main plugin file. It handles the setup that SC4 requires to load a DLL, setting the ordinance effects, and adding the ordinance into the game.
TestOrdinance.h configures the ordinance costs and whether it is an income or expense. Note that there are other methods that can be overridden to customize the ordinance logic, see OrdinanceBase.h. For example:
GetCurrentMonthlyIncome
could be overridden to use a custom monthly cost calculation, built-in examples include theLegalized Gambling
andTourism Promotion Program
ordinances.CheckConditions
could be overridden to set custom conditions for the ordinance to become available, built-in examples include theNeighborhood Watch
andTrash Presort Requirement
ordinances. Note that you do not need to overrideCheckConditions
to set the in-game year that the ordinance becomes available, for that you override theGetYearFirstAvailable
method that is inherited fromOrdinanceBase
.
OrdinanceBase.cpp is the base class for TestOrdinance
. It handles the common logic and provides a default implementation for GetCurrentMonthlyIncome
.
The default monthly cost calculation is used by a number of ordinances, e.g. the Community CPR Training Program
, Clean Air
, etc.
OrdinancePropertyHolder.cpp provides the game with a list of effects that should be applied when the ordinance is enabled. The effects can include Mayor Rating boosts, Demand boosts, etc.