Some of the above user interface code is tricky because it supports multiple views, and each view must maintain its own independent track state.
Make sure you call toolDrag on the initial and final mouse coordinate on mouse down and up, don't just call toolDrag on mouse move events (or animation ticks), or you might miss the initial source or final destination when the user draws quickly!įor extra credit, make sure the drawing tools work smoothly and reliably with auto-scroll! That makes drawing long roads and railroads easy. Looks like the old TCL/Tk/X11 version even let you hold down the control key to constrain the road/rail to vertical or horizontal lines - that's a nice feature I totally forgot about: Python Micropolis Session handleMessage_drawToolStart/Move/Stop: Here's the Python code for the MicropolisTool class that calls it (via SWIG), in the PyGTK user interface:Īnd here's the client/server version (OpenLaszlo/Flash client, Python/TurboGears server): Short fromX, short fromY, short toX, short toY)ĭoTool(tool, fromX, fromY) // Ensure the start position is done. Void Micropolis::toolDrag(EditingTool tool, * toY Vertical coordinate of the ending position. * toX Horizontal coordinate of the ending position. * fromY Vertical coordinate of the starting position. * fromX Horizontal coordinate of the starting position. * Drag a tool from (\a fromX, \a fromY) to (\a toX, \a toY). (I'm sorry, but I haven't had time to work on Micropolis in a long time, but I'm delighted for other people to work on it and I love Graham's excellent work, and I'm happy to answer any questions.) The mouse tracking code that calls it needs to pass in the previous mouse coordinates (in tile coordinates, independent of scrolling), of course. It's pretty brute force but straightforward. It would be wonderful if somebody would port the "toolDrag" code to the JavaScript version. The MicropolisEngine::toolDrag method does what you want, I think: it drags a tool from one tile to another, drawing all the tiles in-between without gaps.
I fixed that in the NeWS and X11 versions of SimCity, but probably that code didn't get ported to the JavaScript version, since it was in the user interface layer, which works a bit differently in MicropolisJS (and on every platform) of course.
#Original simcity pdf#
Here is a pdf file of a scan of the HyperLook SimCity manual I made with the NeWS version of FrameMaker:Īnd here's an illustrated transcript and video of the Hacking at Random talk I gave about Micropolis: History Of Cities And City Planning by Cliff Ellis: Here is the html documentation from the Micropolis source code, which I typed in from the original SimCity manual (originally into FrameMaker, but then I converted it to HTML), that was released by EA under GPL: