[HN Gopher] MicropolisJS: A JavaScript clone of the original Sim...
       ___________________________________________________________________
        
       MicropolisJS: A JavaScript clone of the original SimCity
        
       Author : AnnikaL
       Score  : 263 points
       Date   : 2022-03-07 07:40 UTC (15 hours ago)
        
 (HTM) web link (www.graememcc.co.uk)
 (TXT) w3m dump (www.graememcc.co.uk)
        
       | smallerfish wrote:
       | It's really fun. Please store state in localstorage if at all
       | possible. I accidentally killed a tab and lost my city :(
       | 
       | The other issue I had was dragging with the road tool
       | occasionally glitched and skipped squares. It'd be nice if you
       | could allow users to drag fairly quickly and give them a nice
       | straight road as an outcome.
        
         | JKCalhoun wrote:
         | Original Sim City had the same issue?
        
       | omarhaneef wrote:
       | So, when people make a clone like this, do they painstakingly
       | recreate every piece: graphics, logic and so forth, or do they
       | typically get access to some of the original code or graphics and
       | transfer it over.
       | 
       | This thing looks like it was recreated from scratch.
       | 
       | edit: minor rewording.
        
         | onlyrealcuzzo wrote:
         | AFAIK, they never recreate the graphics.
         | 
         | You write code that is able to read the assets (graphics,
         | sound, etc) - like the original code is able to.
        
         | bragr wrote:
         | The short answer is it depends. In this case where you want to
         | independently distribute a game in a playable state, you need
         | to recreate everything from scratch in order to not violate
         | copyright.
         | 
         | In other cases, they only implement the game code, and you need
         | to source the maps, assets, etc from an original copy. The goal
         | with this is usually to fix bugs and quality of life issues on
         | modern systems, not to supplant the original game or any
         | remaining sales of it. Good example of this IMHO is OpenRCT2
         | which provides an opensource client compatible with
         | Rollercoaster Tycoon2.
        
           | dragonwriter wrote:
           | > The short answer is it depends. In this case where you want
           | to independently distribute a game in a playable state, you
           | need to recreate everything from scratch in order to not
           | violate copyright.
           | 
           | Unless the original is under a license which allows
           | derivatives; e.g., the original SimCity specifically was
           | released (as "Micropolis", because of trademark issues) under
           | GPLv3 in 2008, so GPLv3 downstream versions (like
           | MicropolisJS) don't have to recreate anything from scratch to
           | avoid copyright issues.
        
             | bragr wrote:
             | Looking at the docs for that, it looks like they had to
             | redo most of the assets for exactly this reason. The person
             | who put it on the web may not had to redo them, but someone
             | did.
             | https://github.com/SimHacker/micropolis/blob/wiki/Assets.md
        
         | Thoreandan wrote:
         | The Micropolis name was used to avoid hitting EA trademark, but
         | it came from the original game's porting team:
         | 
         | https://wiki.laptop.org/go/Micropolis#History_and_Future_of_...
         | 
         | https://donhopkins.medium.com/har-2009-lightning-talk-transc...
        
       | roschdal wrote:
       | https://github.com/graememcc/micropolisJS
        
       | dylan604 wrote:
       | been playing this for a little while now, and using the
       | about:performance I compared how this behaves. It uses less
       | resources than a tab with Slack, Gmail, Trello, Stripe's
       | documentation page, my CDN resource page, and the browser's task
       | manager itself. Color me impressed
        
       | jcuenod wrote:
       | Anyone know of an open equivalent to Caesar II? I feel like this
       | is just before these SIM games became enjoyable for me.
        
       | rijieli wrote:
       | Any framework used in this project?
        
         | jenscow wrote:
         | jQuery
        
           | good8675309 wrote:
           | During my day job I use Vue and and Typescript. In my side
           | projects I use Java to build web apps and to serve the pages
           | and jQuery to add bits of dynamic interactivity. Love jQuery.
           | I miss the old days, everything is so overly complex now.
        
       | rmbyrro wrote:
       | Super cool dude, thanks for building and sharing this!
        
       | jacobkg wrote:
       | I have this strong memory of playing tons of SimCity on my dad's
       | mac and then it stopped working when he upgraded his computer
       | from 16 to 256 colors. It was a sad day.
        
       | sdoering wrote:
       | Oh this brought back memories. I remember playing Sim Ant on my
       | Macintosh Classic for hours on end. The same look and feel. Just
       | that I had a b/w screen.
       | 
       | What a great way to have a throwback Monday.
        
         | goda90 wrote:
         | I grew up with color screens on everything but my GameBoy
         | Pocket. But for some reason the B/W laptop my oldest sister had
         | gotten for college in the early 90s made it's way home for me
         | to mess with and I was surprised how well so many of my
         | favorite DOS games worked in B/W.
        
           | MisterTea wrote:
           | A friend and I played a lot of adventure games on a 486
           | Compaq laptop with grayscale.
        
         | blackoil wrote:
         | document.getElementById('wrapper').style.filter =
         | 'grayscale(100%)';
        
           | jmkni wrote:
           | document.getElementById('hnmain').style.filter =
           | 'grayscale(100%)' // for Hacker News :)
        
           | BeefWellington wrote:
           | Why not just:                   document.body.style.filter =
           | 'grayscale(100%)';
           | 
           | EDIT: Actually, neither of these approaches actually works
           | for the game it seems. The map and any actual "tiles" are
           | hidden when this is put in place, whether it's on the wrapper
           | or the body.
        
           | tiborsaas wrote:
           | Green monochrome emulation:                   sepia(1) hue-
           | rotate(54deg) saturate(3)
        
         | Mezzie wrote:
         | Sim Ant was the first game I bought with my own money, back in
         | the day, as my start to collect ALL the Maxis games after
         | getting my hands on SimCity + SimEarth. This was an excellent
         | thing to wake up to.
        
           | yosito wrote:
           | I really wish I could play SimAnt on my iPhone.
        
             | Mezzie wrote:
             | I do and I don't. Maxis has stolen many more hours of my
             | life than any Big Tech company; mobile Maxis games are
             | dangerous.
        
       | willcipriano wrote:
       | > Uh-oh!
       | 
       | > This screen is too small--I won't be able to fit in all the
       | controls, buttons and gizmos! Sorry!
       | 
       | Most things like this say a vague "invalid browser" or try to let
       | you play even though it's impossible. I like this approach
       | better.
        
       | pierreyoda wrote:
       | This is incredibly cool, thanks to Don Hopkins for open-sourcing
       | the original (C, C++ or Java implementations) micropolis codebase
       | [1] !
       | 
       | As a shameless plug, I've been for the last few years re-
       | implementing on and off this exact same project (based on the C++
       | codebase) in Rust, WebAssembly and Svelte! [2] Quite a bunch of
       | buzzwords I know, but it's specifically made for me to have fun.
       | 
       | The map generation is working (or at least it was properly
       | rendered when I was using React) and about ~50% of the codebase
       | has been ported over to Rust, but there's still a lot of work to
       | be done if anyone wants to help!
       | 
       | The end goal is notably to have tons of slick data visualisations
       | with d3.js.
       | 
       | [1] https://github.com/SimHacker/micropolis [2]
       | https://github.com/pierreyoda/micropolis-rs
        
       | bawolff wrote:
       | Also, for those who don't know archive.org lets you play original
       | simcity in emulator in browser -
       | https://archive.org/details/msdos_SimCity_1989
        
       | shikhardevgupta wrote:
       | Looks super cool!
        
       | blurker wrote:
       | Ooh, zero dependencies (not counting dev dependencies). Such a
       | rare treat to see that in the JS ecosystem <3
       | 
       | edit: oh, there is also a manually included jquery dependency :P
       | Still pretty minimal and impressive <3
        
       | rootusrootus wrote:
       | Pretty fun! It crashes reliably for me right after I build a
       | police station, however. Console says:
       | micropolis.js?f750f1ad7f255ea64b6a:1 Uncaught TypeError:
       | A.Position is not a constructor           at
       | micropolis.js?f750f1ad7f255ea64b6a:1:242246           at
       | De.mapScan (micropolis.js?        f750f1ad7f255ea64b6a:1:243311)
       | at Object.Wi [as _simulate] (micropolis.js?
       | f750f1ad7f255ea64b6a:1:272893)           at Object.bi._simFrame
       | (micropolis.js?        f750f1ad7f255ea64b6a:1:269927)
       | at Object.bi.simTick (micropolis.js?
       | f750f1ad7f255ea64b6a:1:269535)           at ys.Us
       | (micropolis.js?f750f1ad7f255ea64b6a:1:350146)
        
         | jcuenod wrote:
         | same for me
        
         | wesleytodd wrote:
         | https://github.com/graememcc/micropolisJS/issues/34
        
           | wesleytodd wrote:
           | https://github.com/graememcc/micropolisJS/issues/34#issuecom.
           | ..
           | 
           | quickly fixed and a lesson learned!
        
       | jcpst wrote:
       | Pleasantly surprised at the source code for this.
        
       | bradrn wrote:
       | Amazing, it even warned me after I spent half an hour on the
       | game! I wish more programs would do that.
        
         | jonwinstanley wrote:
         | The ask for a donation at this point was a great touch too. He
         | knew we'd had some fun by this point.
        
         | m1k1 wrote:
         | Same thing was in Anno. It warned me that i play too long way
         | too many times.
        
       | lopis wrote:
       | Does anyone know how to prevent pollution? I have only nuclear
       | power since day one, but my industry is very dirty. I guess the
       | only way is killing off my industry, but then I suffer from
       | unemployment.
        
         | jonwinstanley wrote:
         | Try spreading out the Industry units and keep them away from
         | Residentials
        
       | salmo wrote:
       | This is so much fun. I love the simplicity of the original feel
       | of the game. No need for fancy graphics, etc. for it to be
       | enjoyable.
       | 
       | And I'm amazed at 0 browser issues or weirdness. Takes me right
       | back to my Tandy 1000.
       | 
       | My only wish it had the help stuff to remember how to resolve
       | some of the problems in the city. I can't remember if that was in
       | the game or in the book back in the day. I have housing and
       | unemployment problems but have unpopulated residential,
       | commercial, and industrial blocks. I know I'm missing something
       | but my memory from the 80s/early 90s is failing me.
       | 
       | Instantly remembered to slow it down after a while to maintain
       | roads and rail, get to nuclear power ASAP, keep industrial away
       | from residential, build parks, and all of that.
       | 
       | Will need to start over again after a bit with better planning
       | :).
        
       ___________________________________________________________________
       (page generated 2022-03-07 23:02 UTC)