Catch up on stories from the past week (and beyond) at the Slashdot story archive


Forgot your password?
Programming IT Technology Entertainment Games

SimCity Source Code Is Now Open 360

Tolkien writes "Source code for SimCity has been released under the GPLv3. For legal reasons the open source version was renamed Micropolis, which was apparently the original working title. The OLPC will also be getting a SimCity branded version that has been QA'ed by Electronic Arts. Some very cool changes have been made by Don Hopkins, who updated and ported what is now Micropolis. (Here is an earlier Slashdot discussion kicked off by a submission Don made.) Among other things, it has been revamped from the original C to using C++ with Python. Here is the page linking all the various source code versions. Happy hacking!"
This discussion has been archived. No new comments can be posted.

SimCity Source Code Is Now Open

Comments Filter:
  • Re:Version? (Score:2, Informative)

    by ShadowMarth ( 870657 ) on Saturday January 12, 2008 @04:21PM (#22017756)
    Apologies for the unnecessary correction, but it's Sim City 4, not 4000. Just nitpicking, I'm afraid. Honestly, though, I thought 3000 was the best. Sim City 4 is just entirely unforgiving.
  • Re:Version? (Score:5, Informative)

    by X0563511 ( 793323 ) on Saturday January 12, 2008 @04:22PM (#22017772) Homepage Journal
    had you looked at the links, you would see this screenshot. []

    Looks a lot like Classic.
  • by Zombie Ryushu ( 803103 ) on Saturday January 12, 2008 @04:23PM (#22017790)
    It builds, but you get to the loading screen and then you can't actually start a game. It Freezes.
  • Re:Version? (Score:3, Informative)

    by X0563511 ( 793323 ) on Saturday January 12, 2008 @04:25PM (#22017818) Homepage Journal
    And, because is slow-as-hell, here is a direct link [].

    (there is a larger version on the website but I'm trying NOT to set fire to his provider's systems)
  • Re:Finally! (Score:5, Informative)

    by Anonymous Coward on Saturday January 12, 2008 @04:47PM (#22018004)
    Luckily we already have much more advanced [] clones on Linux than the old original whose code has been opened.

    Though their move is still good, and interesting just to dig into the code.

  • by jesterzog ( 189797 ) on Saturday January 12, 2008 @04:47PM (#22018012) Homepage Journal

    This is actually clearly explained in one of the linked articles []:

    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.

  • by jesterzog ( 189797 ) on Saturday January 12, 2008 @04:54PM (#22018064) Homepage Journal

    It actually states the history of where it's come from in one of the linked articles [] (emphasis added):

    • 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 me (Don Hopkins) to port SimCity to Unix, and I 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 me to rewrite the HyperLook user interface in TCL/Tk for X11, and I 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.

    So it looks as if it's some kind of mutated version of SimCity Classic which dates back to the C64 version.

  • No build on MacOS X (Score:5, Informative)

    by Midnight Thunder ( 17205 ) on Saturday January 12, 2008 @04:56PM (#22018086) Homepage Journal
    Because someone is likely to ask it, this does not yet build on MacOS X, even if you are willing to accept X11 as the interface. If anyone has any success it would be worth knowing.
  • Re:SNES version? (Score:3, Informative)

    by k_187 ( 61692 ) on Saturday January 12, 2008 @05:07PM (#22018198) Journal
    Yes it did. I believe it was in June or so of last year. Now the browser costs 500 points.
  • Re:Boo-hoo (Score:4, Informative)

    by Brobock ( 226116 ) on Saturday January 12, 2008 @05:15PM (#22018272) Homepage

    The plane crash disaster has been removed as a result of 9/11

    This is ridiculous.
    I hope fires have also been removed as a result of California fires, tornadoes as a result of the Indian ocean tsunami and the big monster invasion as a result of Cmdr Taco. Other wise it wouldn't be very respectful for the victims you know.
    Let us not forget:
    Nuclear meltdown because of Chernobyl.
    Earthquakes because of California, Kobe Japan, and Pakistan.
    Alien Invasion because of Orson Welles war of the worlds radio broadcast.
  • Re:Finally! (Score:3, Informative)

    by Realistic_Dragon ( 655151 ) on Saturday January 12, 2008 @05:27PM (#22018384) Homepage
    You have been able to make a Linux City for quite a while with Lincity, and in 3D with <a href="">Lincity NG</a> which is surprisingly addictive.
  • Re:No, its worse (Score:5, Informative)

    by SimHacker ( 180785 ) on Saturday January 12, 2008 @05:27PM (#22018388) Homepage Journal

    To clear up some confusion: The old version of SimCity/Micropolis uses TCL/Tk to implement the user interface. That is the version currently being distributed on the OLPC. The new version is rewritten in C++, and has all the TCL/Tk and user interface stuff ripped out of it. I converted it to C++ for the reasons I described in other posts (quoted above), so it is now modular and can be run through SWIG to integrate it with many different scripting languages.

    But the core simulator is independent of Python, and runs extremely fast (the TCL/Tk version can run more than a year a second on the relatively slow OLPC). The OLPC uses Python as its standard system wide programming language, and all of its important libraries (like Cairo and Pango) are integrated as Python modules. So it makes the most sense to use SWIG to cast Micropolis into a Python module, first. Of course SWIG also makes it easy to integrate it with any other scripting language.

    If it's not immediately obvious to you (or even if it is), why anyone would want to integrate SimCity with a scripting language, instead of just writing the whole thing in C, then you should read some of the discussions I've been having with Alan Key about that topic, on my blog [].


  • Re:Version? (Score:2, Informative)

    by __aawdrj2992 ( 996973 ) on Saturday January 12, 2008 @05:28PM (#22018390) Journal
    My gripe about SimCity 4 was money. It was really hard to have any sort of budget that profited money for projects and expansions. (And I've played my share of SimCity). This is something that worked much better in SimCity 3000. I did however love the regions, the way the transport systems built, the better graphics, and the ability to rotate the camera as I see fit. My $.02.
  • by SimHacker ( 180785 ) on Saturday January 12, 2008 @06:04PM (#22018776) Homepage Journal

    You can do anything in C you can do in C++, but it's a total pain in the ass. Why, you can even write a C++ compiler in C that compiles C++ into C, and call it CFront.

    If you want to see what happens when you try to simulate C++ interfaces in C, then look at Microsoft's COM header files, which do exactly that.

    The reasons I translated the C code to C++ were: 1) eliminate all global variables, so multiple simulators could exist simultaneously without interfering with each other, 2) define all interfaces in one place so it's easier to work with and evolve the code, 3) enable SWIG to automatically generate an object oriented wrapper for any of a large number of scripting languages, like Python, 4) Impose some sane programming conventions on the code, for reliability and readability's sake.

    I hate C++ as much as anyone else does, probably more than most []. But I know when it's better to use C++ than C, and this is one of those times.


    ``The more important question of whether or not systems like C++ and X-Windows cause actual permanent brain damage in humans, will have to wait for the autopsies of human brain doners. That won't be soon, since they're still only in the animal experimentation stages. But I think it's reprehensible how they're exposing all those poor innocent bunnies to shoddy static class libraries without garbage collection, and high doses of raw Motif.''
    [From comp.lang.functional, ``Re: Effect of programming languages on thought'', Don Hopkins]
  • by Animats ( 122034 ) on Saturday January 12, 2008 @06:19PM (#22018936) Homepage

    left of the city center

    Probably because they borrowed some of the code from SimAnt, which had less ant growth towards the upper left due to a processing order issue in the updating algorithm. It's one of those problems where step N+1 is computed incrementally from the current state, rather than from a frozen copy of step N.

  • Where's *my* pity? (Score:1, Informative)

    by Anonymous Coward on Saturday January 12, 2008 @06:39PM (#22019148)
    I'm a suicide bomber, you insensitive clod!
  • by SimHacker ( 180785 ) on Saturday January 12, 2008 @06:46PM (#22019222) Homepage Journal

    In order to modify a C program to use structures and function pointers instead of global variables, you have to meticulously modify almost every line of code. And that is simply far too much work to do, and would be extremely tedious and error prone.

    The one thing C++ is really great at, is taking a C program with global variables and global functions, and easily transforming it into a C++ class that encapsulates all the variables and functions, without disrupting every line of code. Because "this" is an implicit argument. Because member references don't have to explicitly go through "this".

    But if you did that kind of a transformation on C code by hand, you would have to rewrite every function signature to take an explicit "this" argument, and rewrite every variable or function reference to go through the "this" pointer.

    Actually, I really dislike GTK's Python binding mechanism. It's horribly complex, totally undocumented, and very brittle. It doesn't handle other languages, either. SWIG is a much more advanced, much easier to use tool. I also don't like GTK's "yet another object system". It accounts for most of the time spent by OLPC Sugar python applications initializing. It takes a horribly long time for GTK to initialize, and it's not Python's fault, it's GObject's fault. There's nothing worse than having several object systems, especially when some of them are slow, non-standard and difficult to work with.

    Have you ever looked at or used the COM macros for generating C++ vtable layouts? It's attrocious! Actually, I really like COM for what it is (I use XPCOM at work, since we use xulrunner to implement TomTom Home), but COM's C bindings are total crap. It's much easier to use from C++ with templates, ala ATL (ActiveX Template Library), WFC (Windows Foundation Classes), etc. The MFC COM and OLE stuff is much worse, but not as bad as the C stuff.

    C++ templates can't hold a candle to Common Lisp macros. C++ templates are a totally different animal, totally inferior to the macros that Lisp has had for many years. The arcane C++ syntax makes it impossible to support the kind of high level metaprogramming macros that Lisp so easily supports.


  • Re:Craptastic Code? (Score:4, Informative)

    by chgros ( 690878 ) < ...> on Saturday January 12, 2008 @07:00PM (#22019334) Homepage
    But from a quality-of-product point-of-view, very little could match (and can match) SimCity
    Well, except for the use after free bug that required a special case in Windows 95 so that the game would keep working.
    See e.g. here (look for SimCity): []
  • by rsmith-mac ( 639075 ) on Saturday January 12, 2008 @07:10PM (#22019432)
    Ditto to this. The original version of SimCity Classic for Windows technically runs, but besides not working under 64bit versions of Windows (no 16bit compatibility layer) it runs far too quickly on modern machines. It would be great to have it playable on Windows again.
  • Hide teh LUnix (Score:2, Informative)

    by tepples ( 727027 ) <tepples@gmail.BOHRcom minus physicist> on Saturday January 12, 2008 @09:39PM (#22020558) Homepage Journal

    What the hell is this Lunix thing that so many keep talking about?
    LUnix [] is a UNIX-clone operating system for Commodore 64 computers. SimCity was developed on a Commodore 64 [], but not in LUnix.
  • Re:iMicropolis (Score:3, Informative)

    by Constantine XVI ( 880691 ) <`trash.eighty+slashdot' `at' `'> on Saturday January 12, 2008 @10:22PM (#22020840)
    UNIX SimCity was actually the first multiplayer SimCity game, and Micropolis seems to hold on to this feature. Not sure how to work it though.
  • by redwoodtree ( 136298 ) * on Saturday January 12, 2008 @11:18PM (#22021226)
    Wow, thanks stargo!

    In regards to patching the files...

    Just download the source and unzip/untar it, put it in /tmp, download the patch that stargo put together, into the /micropolis-activity directory.

    Then execute the patch command, like this for example: patch < micropolis_mac-osx.patch. The the paths are off, it will ask you what file to patch, take a look at the "diff" line and simply supply the file name from there, for example (src/tclx/ossupp/makefile), or whatever the right path is for you to that file.

    Then run make from the src directory (assuming you have the developer tools installed of course).

    Then, assuming it compiled with no errors, run make install (you don't need to be root to do any of this by the way).

    Then launch X11 (assuming you have it installed of course) and from the top level directory run ./Micropolis.

    Works great so far!

  • Re:Craptastic Code? (Score:3, Informative)

    by jericho4.0 ( 565125 ) on Sunday January 13, 2008 @12:15AM (#22021530)
    Sorry, no link, and /. search is no help. He was talking about OpenGL and why it's worth supporting, IIRC.
  • Re:Craptastic Code? (Score:5, Informative)

    by jensend ( 71114 ) on Sunday January 13, 2008 @01:25AM (#22021998)
    That would be this [].

An elephant is a mouse with an operating system.