[OLPC-Games] Micropolis source code release!
Don Hopkins
dhopkins at DonHopkins.com
Thu Jan 10 16:55:34 EST 2008
This holiday I got a lot of work done reworking Micropolis for Python
and Cairo!
The "MicropolisCore" project includes the latest Micropolis (S*mC*ty)
source code, cleaned up and recast into C++ classes, integrated into
Python, using the wonderful SWIG interface generator tool:
http://www.swig.org
It also includes a Cairo based TileEngine, and a cellular automata
machine CellEngine, which are independent but can be plugged together,
so the tile engine can display cellular automata cells as well as
SimCity tiles, or any other application's tiles.
This is what SJ was asking for at his keynote talk at last year's game
developer's conference: deconstruct games like SimCity into reusable
components for making other games!
I also wrote some example Python code that uses the TileEngine module to
make a scrolling zooming view of a live city with the Micropolis module,
and a scrolling zooming view of a cellular automata with the CellEngine
module.
The TileEngine comes with a Python TileWindow base class that implements
most of the plumbing, tile display and mouse tracking, so SimCity and
the CellEngine can easily subclass and customize to suit their needs.
You can pan with the mouse and arrow keys, and zoom in and out by
typeing "i" or "o", or "r" to reset the zoom.
The TileEngine supports zooming in and out, and has a lazy drawing
feature that calls back into Python to render and cache the scaled tiles
right before they're needed (so you can implement the tile caching
strategy in Python, while the rendering is in efficient C++ code calling
hardware accelerated Cairo -- and the Python code could easily render
tiles with pretty scaled SVG graphics).
The Micropolis engine can load a SimCity save file and run it, and use
the TileEngine to draw it, but you can't actually interact with it or
edit the map yet, since the user interface and other views haven't been
implemented, just a scrolling zooming view of its tiles.
I hope this code serves as a good example of how to use SWIG to
integrate C++ classes into Python and Cairo, in a portable cross
platform way that works on Linux and Windows.
-Don
http://www.DonHopkins.com/home/micropolis
Micropolis Downloads
This is the binary and source code for Micropolis (A.K.A. "S*mC*ty": see
the GPL License and additional terms, below
<http://www.donhopkins.com/home/micropolis/#license>), which is released
under the GPL.
Questions to dhopkins at DonHopkins.com <mailto:dhopkins at DonHopkins.com>.
* *micropolis.xo
<http://www.donhopkins.com/home/micropolis/micropolis.xo>*http://www.donhopkins.com/home/micropolis/micropolis.xo
Download this to TCL/Tk Micropolis install on the OLPC XO-1.
* *micropolis-activity.tgz
<http://www.donhopkins.com/home/micropolis/micropolis-activity.tgz>*
http://www.donhopkins.com/home/micropolis/micropolis-activity.tgz
Download this to install TCL/Tk Micropolis on x86 Linux systems.
* *micropolis-activity-source.tgz
<http://www.donhopkins.com/home/micropolis/micropolis-activity-source.tgz>*http://www.donhopkins.com/home/micropolis/micropolis-activity-source.tgz
Download this to build TCL/Tk Micropolis from source.
* *MicropolisCore.tgz
<http://www.donhopkins.com/home/micropolis/MicropolisCore.tgz>*http://www.donhopkins.com/home/micropolis/MicropolisCore.tgz
Download this to build the Python modules micropolis, cellengine
and tileengine.
o The micropolis module is the new version of Micropolis,
cleaned up and recast as a C++ class.
o The cellengine module is a cellular automate machine engine.
o The tileengine module is a Cairo based tile renderer, used
to display micropolis tiles and cellengine cells. It plugs
into micropolis and cellengine, but is independent of them
and useful for other applications.
o These modules require Python 2.5 and the Python modules
pygtk, pycairo and PIL to be installed. Probably some other
modules I can't think of off the top of my head, too.
o This code will compile on Windows or Linux. It is intended
to be used with the OLPC's Sugar user interface environemnt
(depending on Cairo and Pango for graphics and text
formatting), but layered so the core code is useful in other
contexts such as different scripting languages, web servers,
desktop applications, embedded devices, etc.
Micropolis GPL License Notice
Micropolis, Unix Version. 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 at laptop.org
<mailto:micropolis at 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 .
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.laptop.org/pipermail/games/attachments/20080110/08edacb3/attachment.htm
More information about the Games
mailing list