[HN Gopher] City simulator I made in Scratch
       ___________________________________________________________________
        
       City simulator I made in Scratch
        
       Author : Annulus
       Score  : 153 points
       Date   : 2025-03-13 14:46 UTC (3 days ago)
        
 (HTM) web link (scratch.mit.edu)
 (TXT) w3m dump (scratch.mit.edu)
        
       | eliben wrote:
       | This is very impressive, amazing work!
       | 
       | One question: how do you manage large code bases in scratch? Is
       | it easy to find a piece of code? Something like grepping for
       | specific things seems difficult.
       | 
       | I've recently been really warming up to Scratch since one of my
       | kids picked it up and really enjoys it. I love the built-in
       | concurrency model - it's a bit like CSP. Gets kids to think
       | concurrently from day 1.
        
         | Rendello wrote:
         | Scratch is not conducive to complex (traditional) projects,
         | which I think is sort of the appeal for seasoned programmers.
         | For my part, I woke up one weekend knowing I had to make a
         | recursive bisection demo in it [1]. The effort I knew it would
         | take vs the banality and lack of game play was really funny to
         | me in an absurd way.
         | 
         | Scratch lacks functions with return values, but if you hack
         | global variables to be like registers, you can emulate them and
         | even do recursion. At least that's how I did it. The Cartesian
         | plane has (0,0) in the centre, which is annoying if you're used
         | to traditional graphics.
         | 
         | I have a young cousin who's intimidated by making the jump from
         | Scratch into traditional game dev. I tell him that Scratch
         | simplifies a lot of things, but it also makes a lot of things
         | harder if you're used to regular programming.
         | 
         | "Recursive Bisection on a Cartesian Plane in the Horizontal and
         | Vertical Axes." (hold shift when you press "go" for fast mode):
         | https://scratch.mit.edu/projects/1098438053
        
           | jgwil2 wrote:
           | That's really clever, bravo.
        
           | ashater wrote:
           | My younger daughter, who is pretty good at making games in
           | Scratch is not that interested in jumping into text/code
           | based programming. I do think Scratch makes things a lot
           | easier and text based programming is not thar appealing to
           | kids. I will try to start her with Pygame but even that might
           | make it seem very arcane and not very visual.
        
             | hdjrudni wrote:
             | Maybe try something with instant feedback?
             | 
             | I'm not sure what precisely, but I'm picturing a split view
             | with text on the left and the output on the right.
             | 
             | I do this in web dev, React + hot reload is wonderful. For
             | games, I've done it with instantly recompiling shaders but
             | not much else.
        
             | Rendello wrote:
             | PICO-8 [1] might be a good choice. I always consider that
             | kids want their friends to try their games, and so being
             | able to easily distribute to the web is awesome. They can
             | link their game from the site [2], or with some parental
             | help they could even serve them from their own website,
             | which could be very empowering for a kid.
             | 
             | 1. https://www.lexaloffle.com/pico-8.php
             | 
             | 2. https://www.lexaloffle.com/bbs/?cat=7&carts_tab=1&#sub=2
             | &mod...
        
         | Annulus wrote:
         | It is really hard to search when there's a lot of code - I just
         | had to be pretty careful with how I laid out everything, so I
         | roughly knew where everything was
        
         | fatant wrote:
         | I think for me it was something that came with practice and
         | intentionally organizing my code in a way that made spatial
         | sense to me.
        
       | LukeDunsMoto wrote:
       | Oh man I love a city builder - this is very cool thanks for
       | sharing
        
       | timojaask wrote:
       | This looks very much like Polytopia
       | 
       | https://polytopia.io/
        
       | chrisan wrote:
       | on firefox at least, the WASD controls seems inverted?
        
         | mixdup wrote:
         | Safari as well, and I couldn't get any other keys to work
         | besides WASD
        
           | SamBam wrote:
           | You have to click a square of land first, and then space will
           | add a building (or whatever you cycle to with the arrows).
           | 
           | (Edit: at least in fantasy mode. I haven't yet worked out
           | what to do in reality mode.)
        
         | turnsout wrote:
         | On Dvorak, WASD never works; game designers should use arrow
         | keys or find a lower-level way to access key events that
         | doesn't depend on the software layout.
        
           | Aloisius wrote:
           | Usually game developers use keyboard scancodes which are
           | layout agnostic rather than the character generated when
           | pressing a key, so it works on dvorak, AZERTY, etc.
           | 
           | I don't know if Scratch supports them though. Seems like it
           | would given it's game focus.
        
             | turnsout wrote:
             | Whatever the reason, in this case, it's broken
        
         | araes wrote:
         | Had a similar comment on starting reality mode.
         | 
         | One issue that arrive after a few minutes that's related, is
         | the map arrows to be able to scroll around would often vanish.
         | Going to the zoomed out overview map would eventually have the
         | navigation return, yet kept occasionally happening for some
         | reason.
         | 
         | Fun game, although world got flooded pretty much instantly, so
         | was a bit of a downer. Still not sure if trade routes actually
         | do anything other than explore the map. Did not ever seem to
         | actually connect to nearby structures.
         | 
         | Be nice if there was some way to zoom out one level at least.
         | Really... wanted to be able to zoom out after having 5-10
         | structures.
        
       ___________________________________________________________________
       (page generated 2025-03-16 23:01 UTC)