by bhouston · 12y ago · 0 comments
Simulation code here:
http://lo-th.github.io/3d.city/build/city.3d.js
Background worker (neat idea) that handles all user input and costly events, to keep the 3D animations consistently fast:
The simulation is from my own micropolisJS (http://micropolisjs.graememcc.co.uk and https://github.com/graememcc/micropolisJS) just stripped of the GPL License headers and attribution.
micropolisJS in turn is a port of Micropolis, the open-source release of Sim City 1989 for One Laptop Per Child.
Edit: edited the link. You'd think I should get links to my own site correct!
In addition, micropolisJS has additional terms added to the GPL [0], which are clearly linked to from the top of every source file in micropolisJS [1], which need to be distributed with 3D City.
[0] http://micropolisjs.graememcc.co.uk/LICENSE
[1] https://github.com/graememcc/micropolisJS/blob/master/js/Blo...
There are small details like laying out roads and making power lines go over them etc that are super-fiddly too.
I know this because I played around with my own simcity for a while, first in true 3D (making curvy roads look nice is damn difficult) and then a 2D grid.
Here's a screenshot I was particularly proud of - the effort to get to that point was more than it looks! http://media.tumblr.com/c9b51ca1eb2b3e89eb8d5af0f560ec34/tum...
More on my algos http://williamedwardscoder.tumblr.com/post/49797579721/willc...
I was going to procedurally produce the buildings using a variation on Eisenscript https://sites.google.com/site/williamedwardscoder/home/exten... with variables in the script based on things like price, distance to other zones, scores etc
I look at the files you link and think "yeah!". I put my city simulation into a Web Worker and the UI in the browser thread though.