Micropolis

From OLPC
Jump to navigation Jump to search

Micropolis is one of the oldest and grandest of city simulation games. A Linux port by Don Hopkins was released by Electronic Arts under the GPL for distribution on the XO. (See Don Hopkins' blog for more background.)


Installing Binaries

Screenshot from the game

Installing activity bundles can be simple or complex.

If you are running Build 623, Ship.1, Ship.2, or something similar, and you have never installed Micropolis before, it should be easy. On your XO, open the web browser, and go to this page. Click on the link for Micropolis-1.xo. As it starts to download, you should see the Frame pop up briefly around the edge of the screen, with a document icon along the upper left side of the frame. When the download is done, the browser and the journal will automatically install the Micropolis activity. You should be able to find it by going into the frame (with the upper right corner "frame key"; it has a rectangle on it). Use the (<) and (>) circles along the bottom of the screen, to see all the different activity icons. Click on the one for Micropolis (as shown at the top of this web page).

If you are running a different build, I'm not sure what to suggest.

Latest stable XO activity bundle: Micropolis-1.xo (coming soon).

Obtaining Sources

The source code of Micropolis is checked into "git" here.

The Micropolis source code release includes two different generations of code: old and new.

Old Generation: C TCL/Tk Micropolis

The old generation of the source code is the TCL/Tk version of Micropolis (based on SimCity for X11). It is written in C, and the user interface is scripted in TCL with extensions to the Tk user interface toolkit, which runs on X11. It uses an old version of TCL/Tk from 1993.

It currently doesn't support 24 and 32 bit screens, only 16 bit, 8 bit and 1 bit. (This bug may be fixed soon.)

New Generation: C++ Python Micropolis

The new generation of the source code is MicropolisCore. It is based on the TCL/Tk code, but all of the scripting language, user interface and operating system dependent code has been removed. It's been translated to C++, reorganized and cleaned up.

The SWIG interface generation tool was used to integrate Micropolis with Python as an extension module. It also includes a general purpose Cairo based TileEngine that renders the SimCity tiles, and a Cellular Automata Machine engine, which also uses the TileEngine to render the cells.

MicropolisCore is not yet a playable game, but it's the beginning of an engine that can be used in many different situations, like OLPC XO-1 laptops, desktop applications, embedded devices, and web servers.

Why Change a Good Thing?

Rewriting Micropolis in C++ is the first step towards rewriting it in other better languages, and necessary for integrating it with Python. There is only one thing worse than C++, and that's C. And it just happens to be quite easy to translate C to C++, without heavily modifying it or changing its meaning, because "this" is implicit.

The entire state of the simulation is encapsulated inside of a C++ object, instead of global variables and functions, so it's possible to have any number of them running in parallel without interfering with each other (for a web server, or a multi player game).

C++ also makes it very easy to use SWIG to integrate the code with many different scripting languages. SWIG opens Micropolis up to many different scripting languages, instead of locking it into one scripting language or user interface toolkit.

Eventually we can rewrite more and more of Micropolis in an easier to understand and maintain language like Python, and put a high-level kid-friendly visual programming language interface over it. But the first step is to clean up and rationalize the existing code base, and make the basic game playable.

Building Micropolis

The old generation code builds on Fedora 7. It doesn't depend on the sugar-jhbuild environment.

The new generation code builds and runs on Fedora 7 as well as Windows (with Microsoft Visual Studio 8). Other people will port it to other platforms like the Mac in the future.

Bil Simser has written a series of articles on his blog about building Micropolis on Windows: Building A City - The Series.

History and Future of Micropolis

  • The original version of SimCity was developed by Maxis on the C64, and ported to various platforms, including the Macintosh. Maxis licensed the Macintosh SimCity source code to DUX software, to port to Unix.
  • DUX Software contracted Don Hopkins to port SimCity to Unix, and he developed "SimCity HyperLook Edition", while working at the Turing Institute on HyperLook with Arthur van Hoff. The user interface was written in PostScript, which ran on the NeWS window system on Sun workstations, and it supported multiple zoomable views, pie menus, annotating and printing maps, and many user interface improvements.
  • After Sun canceled NeWS, DUX Software contracted Hopkins to rewrite the HyperLook user interface in TCL/Tk for X11, and he developed a multi-player networked user interface using the X11 protocol. The TCL/Tk version of SimCity has been ported to various Unix and non-Unix platforms, including SunOS, Solaris, Irix, HP/UX, OSF/1, Quarterdeck Desqview/X, NDC X Terminals, Warp, and Linux. The contract to sell SimCity for Unix expired after ten years, so the TCL/Tk version was no longer commercially available.
  • OLPC SimCity is based on the TCL/Tk version of SimCity. SimCity is a trademark of Electronic Arts. Don Hopkins adapted SimCity to the OLPC, thanks to the support of John Gilmore. OLPC SimCity will be shipped with the OLPC, and it has been run through EA's quality assurance process and reviewed for integrity. EA reserves the right to review and approve any version of the game distributed under the name SimCity.
  • "Micropolis" is the name of the current GPL open source code version of OLPC SimCity. That was the original working title of Will Wright's city simulation game. Since Micropolis is licensed under the GPL, anyone can do anything they want with it that conforms with the GPL, except they can't call it "SimCity" (and a few other limitations to protect EA's trademarks).
  • Other differently named projects can be forked from the Micropolis source code, as long as they're not called SimCity.
  • Improvements to the open source code base that merits EA's approval may be incorporated into the official "OLPC SimCity" source code, to be distributed with the OLPC under the trademarked name "OLPC SimCity", but only after it's been reviewed and approved by EA.
  • In the short term, the TCL/Tk version of Micropolis can be upgraded to support the latest version of TCL/Tk, fix bugs, improve the user interface and Sugar integration, etc. Once that is stable as well integrated into Sugar, it could be submitted to EA to become the official version of "OLPC SimCity" distributed on the XO laptop.
  • In the long term, Micropolis can be recast from C to C++ classes, so it's possible to define clean interfaces between software modules, and make multiple instances of the simulator that don't interfere with each other, as well as easily interfacing it to Python using the SWIG interface generator. That should be done in a language-neutral way, so you could plug the simulator engine into many different languages and programming systems. Then more work needs to be done to open it up, and make it re-vectorable (plug-ins, events, callbacks, hooks, aspect oriented programming, etc), so you can replace and extend the various modules with the host language(s), eventually re-implementing most if not all of SimCity in another language.

License

The bulk of the code and images in Micropolis are copyrighted by Electronic Arts Inc. The word SimCityTM and many others that begin with Sim are also trademarked by Electronic Arts. EA has released the game under the GNU General Public License, version 3. As permitted under the GPL, EA has licensed the code with some additional terms:

Micropolis!  This game was released for the Unix platform
in or about 1990 and has been modified for inclusion in the One Laptop
Per Child program.  Copyright (C) 1989 - 2007 Electronic Arts Inc.  If
you need assistance with this program, you may contact:
  http://wiki.laptop.org/go/Micropolis  or email  micropolis@laptop.org .

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.  You should have received a
copy of the GNU General Public License along with this program.  If
not, see http://www.gnu.org/licenses/ .

            ADDITIONAL TERMS per GNU GPL Section 7

No trademark or publicity rights are granted.  This license does NOT
give you any right, title or interest in the trademark SimCity or any
other Electronic Arts trademark.  You may not distribute any
modification of this program using the trademark SimCity or claim any
affliation or association with Electronic Arts Inc. or its employees.

Any propagation or conveyance of this program must include this
copyright notice and these terms.

If you convey this program (or any modifications of it) and assume
contractual liability for the program to recipients of it, you agree
to indemnify Electronic Arts for any liability that those contractual
assumptions impose on Electronic Arts.

You may not misrepresent the origins of this program; modified
versions of the program must be marked as such and not identified as
the original program.

This disclaimer supplements the one included in the General Public
License.  TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, THIS
PROGRAM IS PROVIDED TO YOU "AS IS," WITH ALL FAULTS, WITHOUT WARRANTY
OF ANY KIND, AND YOUR USE IS AT YOUR SOLE RISK.  THE ENTIRE RISK OF
SATISFACTORY QUALITY AND PERFORMANCE RESIDES WITH YOU.  ELECTRONIC ARTS
DISCLAIMS ANY AND ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES,
INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY,
FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT OF THIRD PARTY
RIGHTS, AND WARRANTIES (IF ANY) ARISING FROM A COURSE OF DEALING,
USAGE, OR TRADE PRACTICE.  ELECTRONIC ARTS DOES NOT WARRANT AGAINST
INTERFERENCE WITH YOUR ENJOYMENT OF THE PROGRAM; THAT THE PROGRAM WILL
MEET YOUR REQUIREMENTS; THAT OPERATION OF THE PROGRAM WILL BE
UNINTERRUPTED OR ERROR-FREE, OR THAT THE PROGRAM WILL BE COMPATIBLE
WITH THIRD PARTY SOFTWARE OR THAT ANY ERRORS IN THE PROGRAM WILL BE
CORRECTED.  NO ORAL OR WRITTEN ADVICE PROVIDED BY ELECTRONIC ARTS OR
ANY AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY.  SOME
JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF OR LIMITATIONS ON IMPLIED
WARRANTIES OR THE LIMITATIONS ON THE APPLICABLE STATUTORY RIGHTS OF A
CONSUMER, SO SOME OR ALL OF THE ABOVE EXCLUSIONS AND LIMITATIONS MAY
NOT APPLY TO YOU.

In case this confuses you, here is a simpler explanation. The Micropolis code is free software. But the code as released by EA used EA trademarks. We could not modify the code and distribute it unless we (1) made it clear to the player that we have modified it, and (2) removed all the EA trademarks from the game. (We also have to follow all the other rules in the GPLv3, the EA additional terms, and the copyrights of other contributors. This was just a very brief summary.)

A small team of people is working on Micropolis (which was Will Wright's original code name for the game as he was designing it). If you want to improve the game, come help!

History

Screenshot from the game

This Micropolis game came from the original SimCity, through a complex lineage.

Don Hopkins breaks it down like so:

I ported the Mac version of SimCity to SunOS Unix running the NeWS window system about 15 years ago, writing the user interface in PostScript. And a year or so later I ported it to various versions of Unix running X-Windows, using the TCL/Tk scripting language and gui toolkit. Several years later when Linux became viable, it was fairly straightforward to port that code to Linux, and then to port that to the OLPC. After removing all EA trademarks, we have... Micropolis!

More information

Ideas

"The goal is to enable the open source community to renovate SimCity and take it in new educational directions" [1]
  • Simutrans and Lincity graphics could be used to enhance Micropolis where appropriate.

Game examples

  • A Micropolis-based engine could be used for games along the lines of
    • Genius Politik: The player is a politician and has to mediate between different political currents and make decisions about city planning and urban management, following proper political procedure instead of a "point and click" decision-making process. (Citizenship education)
    • Genius - Task Force Biologie: The player is a biologist and works for the UN to restore lost biotopes around the world.

The player could be required to take care of the education of children (e.g. to co-finance schools, to address school issues and to buy OLPC laptops) and to participate in the education and upbringing of his or her own children in the game. (In a game like Task Force Biologie the player could, for instance, need the school to be able to employ qualified biologists later on) This would add a further level of complexity to the game: The player would have to decide whether to attend to private issues or issues of professional life. An in-game calendar application could frequently show conflicting appointments and allow the player to choose. The selection of appointments could also lead to a different social environment: The player would only be able to contact people he had previously met somewhere.

See also