How to run a city builder on 16 MHz
larstofus.com
larstofus.com
Not sure where that comes from. The original release box art [1] says it will work on any PC with 512KB of ram. So that's an 8088 running at just 4.77 MHz.
But that's far from the lowest spec port of the game. The Commodore 64 version might have been missing quite a few features (like stadiums, police/fire stations and railways), but the main city simulation loop was there in just 64KB of ram and a 1MHz 6502.
And the BBC Micro/Acorn Election port was even more impressive. Had basically all the features of the full Amiga/PC/Mac version, only missing Music/Sound/Animation. With a 2Mhz 6502 (or 1Mhz on the Election) and just 32KB of ram.
[1] https://images.launchbox-app.com/79861ce4-75ea-46dd-b46e-521...
Don’t know if that could be an explanation.
This was tricky enough that folks would pay my barely adult self a consultant's hourly rate to do this for them.
If memory serves me correctly the simulation ran like a super loop on a microcontroller every 50ms or 33ms. On each loop the dispatcher would run a selection of the core simulation functions some every loop, some at every 2nd, 4th or more loops. The system was called banding. The dispatch table was redone to optimize the needs of that particular simulator.
There were various optimization outside of the main cpu as the peripheral devices did computation as well. Also as the systems got faster there was time left over for the normal OS to run low priority function with non real-time requirements.
The technique was not new in my time and had been used on the previous generation of Xerox systems about a decade earlier.
First modern 32 bit CPU with MMU.
The author has some great in-depth docs about the design, and how they managed to make a fairly lively-seeming simulation fit into a machine with an 8 MHz 8-bit processor.
https://github.com/AntonioND/ucity/blob/master/docs/index.rs...
I eventually ported it to the GBA, this time in C. It's essentially the same game, but with code that is easier to read. It's much less impressive in this case, there's even a version of SimCity 2000 for GBA that is much better than my game.
It's ironic that modern programs often have latency and response times in the 10s and 100s of milliseconds. I know the reasons why, but it's still a bit ridiculous to think about it. Just the tons of layers of abstractions we introduce.
But there's no shortage of software developers who make today's computers slow. Just an idea: perhaps we should replace 'em with Real Programmers (tm)?
Even a text editor today written in javascript using Electron will take 1GB+ without considering the user could open multiple documents which can increase the RAM usage.
And that's why so many applications today are giant chonks of resource waste. For a long time now we've had it to spare.
Disregarding the moral debate about resource wasting of course. That's a different discussion. The why is: we have had the resources to burn, so they do. Resource usage is as tight as it has to be very generally speaking.
I ran it on 7 MHz 68k, and the PC port ran on an 8088 IIRC, slower still. Hell, the cover OP used for the post reads "XT/AT/PS2 compatibles".
I'm guessing a part of the confusion could be that there was also a rerelease called SimCity Classic. The Classic release also came as a Windows 3.x version which (unsurprisingly) had higher system requirements. The specified minimum for that was a 286, though, not a 386.
I have no idea how well a 286 would have coped, though; it's rare to see "real" games (bigger ones, not Solitaire) for Windows 3.x that didn't require a 386.
https://github.com/SimHacker/MicropolisCore/blob/main/packag...
Chaim Gingold wrote a book all about "Building SimCity":
https://mitpress.mit.edu/9780262547482/building-simcity/
He answered questions about it in this HN discussion:
https://news.ycombinator.com/item?id=40698442
For more detail than the article gives, Chaim Gingold drew the whole loop for his book "Building SimCity: How to Put the World in a Machine" (MIT Press, 2024), and kindly let us put his diagrams in the MicropolisCore repo.
Chaim Gingold's "SimCity Reverse Diagrams":
https://github.com/SimHacker/MicropolisCore/tree/main/images...
Simulation Loop (Simulate):
https://github.com/SimHacker/MicropolisCore/blob/main/images...
Map Data Flow:
https://github.com/SimHacker/MicropolisCore/blob/main/images...
Maps:
https://github.com/SimHacker/MicropolisCore/blob/main/images...
Map Scan:
https://github.com/SimHacker/MicropolisCore/blob/main/images...
Make Traffic:
https://github.com/SimHacker/MicropolisCore/blob/main/images...
Animation Characters:
https://github.com/SimHacker/MicropolisCore/blob/main/images...
From the micropolis repo README:
NOTE: Please See: MicropolisCore
https://github.com/SimHacker/MicropolisCore
This "micropolis" repo is mainly for historical purpose, and it's probably better to use the newer MicropolisCore repo for development.
I rebooted micropolis into the fresh new MicropolisCore repo, without all the old X11/TCL/Tk stuff.
MicropolisCore is a C++ rewrite/refactor/cleanup of the original C code into a simulation engine that's independent of the user interface.
The full lineage of the code is C64 => Mac => SunOS/NeWS/HyperLook => Unix/X11/TCL/Tk + multiplayer => Linux/X11/TCL/Tk + multiplayer => OLPC/X11/TCL/Tk (single player) => C++ MicropolisCore => C++/SWIG/Python/PyGTK => C++/SWIG/Python/TurboGears/AMF/Flash/OpenLaszlo => C++/Emscripten/Embind/TypeScript/SvelteKit.
Now it compiles with emscripten/embind into WASM, and it's possible to run it "headless" in node, or with any kind of user interface in the browser.
So if you're making something new, you should use MicropolisCore, but if you're into retrocomputing and want to renovate the TCL version, or even the old PyGTK or Python/TurboGears/AMF/Flash/OpenLaszlo version, then this repo's got what you need!
----
Work in progress live demo (I have't finished the UI yet, but the simulator and tile engine run):
Video demo:
https://www.youtube.com/watch?v=wlHGfNlE8Os
SimCity Micropolis Tile Sets Space Inventory Cellular Automata To Jerry Martin's Chill Resolve: