Don Hopkins ported SimCity to Unix in 1991. Today, he is putting the finishing touches on a GPL version of this classic computer game for the One Laptop Per Child project’s XO laptop.
In 1991, DUX Software licensed the rights to port Maxis Software’s SimCity to Unix. Don Hopkins, working then as a contractor for DUX, rewrote the Mac version of the game to run on numerous Unix platforms. More recently, John Gilmore, an advisor to the One Laptop Per Child (OLPC) initiative, suggested the idea to Hopkins of bringing the game to the OLPC’s XO laptop. Hopkins told SimCity creator Will Wright, who was enthusiastic about the idea and got the ball rolling at Electronic Arts, the current owner of Maxis.
Hopkins has done the majority of the additional programming needed for the XO port. He started with the TCL/Tk version of the game that he originally created for the Unix platforms. Gilmore has been helping in debugging and sorting out intellectual property issues in order to have the game, under the name Micropolis, released under the GPL for the XO.
We spoke with Hopkins, who described for us the technical nature of the work involved in this port.
What have been the major challenges in porting SimCity to the OLPC’s XO laptop?
Installing and building the early version of the OLPC development environment was a challenge, but the development process has gotten easier as more people have volunteered to work on the project, gone through the process, submitted bugs and fixed them.
The main programming tasks were converting SimCity to use one full-screen window, supporting sound, and integrating SimCity into the Sugar environment by making a Python adapter activity. The Etoys project provided a good example of how to do that.
Please describe what the porting process entailed.
Because the OLPC uses the X Window System, which SimCity already supported, the port was relatively easy. Most of the work involved re-designing the windows and dialogs to work with the full-screen window manager, making a splash screen, a new start-up screen, supporting sound, adjusting fonts, removing old dead code, fixing bugs, and making a simple Sugar wrapper written in Python that runs TCL/Tk SimCity in another process, and roughly integrates it with the OLPC Sugar user interface.
How would you describe the state of the SimCity code when you received it?
It had to be converted to ANSI C, reorganized and cleaned up a lot, in order to compile on the Sun C compiler. It was written with a lot of clever thought to simplification and efficient data representation. It doesn’t use complex or dynamic data structures, except for the “modern” user interface, of course. But it’s also very messy and informal in a lot of ways.
What’s your opinion about the way it was originally written?
It was designed by exploring a vast possibility space, playing around, experimenting, measuring, accreting features, accumulating small changes, adding multiple layers, with lots of tweaking and tuning to make [game play] fun—but not necessarily “realistic.”
It’s brilliant code to read and learn from, which is why I’m so happy to get it released as GPL Open Source code. People don’t usually write programs as simple and efficient as SimCity any more, but it’s still important to write code for the OLPC as small and fast as possible because of its limited memory and CPU power. The OLPC is an amazingly powerful machine, compared to home computers at the time SimCity was originally released. It’s several orders of magnitudes faster and more powerful than the Commodore 64 that SimCity was originally written on, so the OLPC [version of SimCity] can easily simulate more than a year [per] second.
What features from the game have been removed in order to have it run suitably on the XO?
I disabled the multi-player support, but it can be turned back on with a command line switch. It was too complicated for kids to use easily, because it required typing in an IP address and disabling X11 network security. We will develop a much better multi-player SimCity protocol based on the official Sugar libraries, instead of using the low-level X11 protocol.
Have any new features been created?
I simplified the user interface and added shortcuts, and tuned up the speed and timers to run smoothly on the OLPC hardware. I added a few cheat codes, that you’ll have to read the source code to find out about.
Will the kids be able to change or modify the rules behind the game play?
Absolutely! The goal is to open up SimCity so it can be scripted in Python, and kids can write plug-ins to extend or replace features and aspects of the simulation.
Alan Kay and I have been having a wonderful conversation about applying the lessons of the classic game Robot Odyssey to SimCity, in the form of a visual programming language kids can use to program and extend SimCity, without using Python directly. Robot Odyssey was a game about programming robots with logic modules and wires, which taught kids how to analyze and solve problems with logic and programming in a fun way! SimCity is a micro-world in which kids could experiment with their own political, economic and logistical simulations, and plug in programmable agents and modules, like their own robots, monsters, tornadoes, building tools, zones, disasters and miracles.
The plan is to rewrite SimCity in terms of general-purpose components—like a tile engine, a sprite engine, a sound engine, layers of numbers, symbols and drawings, graphics and data visualization views, etc.—which kids and adult game programmers can re-use to build their own games.
Are there any other plans for future versions of the XO SimCity?
In the near future, it would be great to update the current version of OLPC SimCity to support the latest version of TCL/Tk, and integrate it with the OLPC Sugar user interface and the XO-1 hardware better.
The OLPC uses the Python programming language, which is like PostScript, TCL or JavaScript, but much better. And it uses the Cairo graphics library, which is like PostScript, Tk Canvas or DHTML graphics, but much better.
In the long term, we will rewrite the user interface of SimCity in Python for the Sugar user interface environment, using Cairo graphics to draw the map and user interface. It will use the OLPC’s mesh networking hardware and high-level messaging libraries to implement multi-player collaboration and sharing, instead of using the low level X11 protocol, as the multi player TCL/Tk version does.
Do you have any advice for others who are interested in porting (or developing) games for the XO laptop?
Read the OLPC Wiki to learn what other people are doing, and write about what you’re doing, so everyone can collaborate and benefit from each other’s work.
Learning Python is essential, because the Sugar software environment is written in Python.




