7 ms·
Beautiful work with Three.js. But the simulation work is also really impressive -- and a lot of work. Simulation code here: http://lo-th.github.io/3d.city/bu
by bhouston 12y ago
Beautiful work with Three.js. But the simulation work is also really impressive -- and a lot of work.
Simulation code here:
http://lo-th.github.io/3d.city/build/city.3d.js 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:
http://lo-th.github.io/3d.city/js/worker.city.js http://lo-th.github.io/3d.city/js/worker.city.js
- willvarfar 12y agoVery neat! 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/tumblr_inline_mm0koaB6MW1qz4rgp.jpg http://media.tumblr.com/c9b51ca1eb2b3e89eb8d5af0f560ec34/tum... More on my algos http://williamedwardscoder.tumblr.com/post/49797579721/willcity-update 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/extendingeisenscript 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.
- agentultra 12y agoThe worker code is interesting. Looks like a single observer that watches everything and dispatches to methods on a global state object. One would expect one observer per subject. Is there some implementation detail in web workers that makes this design more efficient than registering an observer per event?
- Keloran 12y agothe whole repo, much easier https://github.com/lo-th/3d.city https://github.com/lo-th/3d.city
- jastanton 12y agoFor clarity, by user input it handles the callback of the map being clicked to delegate which tool it's going to use and to update the budget etc... I was excited at first to see all the event handlers setup in a thread that wasn't the UI thread because event handlers are expensive but that doesn't appear to be the case. AFAIK webworkers are fairly isolated so something like setting up event handlers would not be possible.
- graememcc 12y ago> The simulation work is also really impressive -- and a lot of work. The simulation is from my own micropolisJS (http://micropolisjs.graememcc.co.uk http://micropolisjs.graememcc.co.uk and https://github.com/graememcc/micropolisJS 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!
- judk 12y agoIs that compliant with your license?
- the_mitsuhiko 12y agoIt's his own work. He does not be to be compliant with anything.
- bhouston 12y agoIt isn't his own work apparently, he copied the simulation and removed the GPL license statement.
- edvinbesic 12y agoIt is his own work apparently. `The simulation is from my own micropolisJS (http://micropolisjs.graememcc.co.uk http://micropolisjs.graememcc.co.uk and https://github.com/graememcc/micropolisJS https://github.com/graememcc/micropolisJS) just stripped of the GPL License headers and attribution.`
- anamexis 12y agoThat is not the same person as the one who made the 3D.CITY game.
- stickydink 12y ago