[HN Gopher] Show HN: My multiplayer custom-engine game that load...
       ___________________________________________________________________
        
       Show HN: My multiplayer custom-engine game that loads in less than
       a second
        
       Author : crazypython
       Score  : 51 points
       Date   : 2021-01-27 21:33 UTC (1 hours ago)
        
 (HTM) web link (vnav.io)
 (TXT) w3m dump (vnav.io)
        
       | surround wrote:
       | See also
       | 
       | https://diep.io - original, abandoned
       | 
       | https://arras.io - fan made sequel
       | 
       | http://woomy-arras.io - sequel of sequel
       | 
       | (None of these load as fast)
        
       | listic wrote:
       | There seems to be a fashion for .io domains among the cool sites.
       | From what I see, the domain isn't cheap: this one is $32.98/yr
       | from NameCheap. When I am going to start a web experiment, I
       | think I am going to go with .xyz which goes for $1, because I'm
       | cheap.
       | 
       | Is there anything inherently useful in running a domain like .io?
        
         | redmattred wrote:
         | It sounds cooler
        
         | reidjs wrote:
         | One less character and familiarity.
        
       | psawaya wrote:
       | Great work! Are you using Websockets under the hood? Or something
       | WebRTC-based, a la https://geckosio.github.io/ ?
        
         | crazypython wrote:
         | WebSockets. I found that WebRTC was complicated, full of bloat,
         | and less reliable. Most home TCP connections don't have enough
         | packet dropping to warrant something like SCTP, the transport
         | protocol behind WebRTC. If we wanted to mitigate head of line
         | blocking we'd just alternate between two websockets.
        
       | crazypython wrote:
       | The game is lagging a bit because of the sudden influx of new
       | players- new servers are being spun up as fast as we can.
        
       | VectorLock wrote:
       | I like the diep.io a-like game. What other JavaScript resources
       | did you use to build this?
        
         | crazypython wrote:
         | None. It's built completely from scratch, with no third-party
         | dependencies.
         | 
         | FullStory, Google Analytics, and Sentry for monitoring and
         | analytics.
        
       | neodymiumphish wrote:
       | Just a suggestion:
       | 
       | I'd love a way to change the keybinds; using Dvorak means this is
       | wholy unplayable for me (also a mech keyboard that doesn't have
       | up-down-left-right in a traditional/usable access as you'd expect
       | on most keybs.
       | 
       | Anyway, it definitely looks fun, and man did that load fast!
        
       | phreack wrote:
       | Whoa I opened this on mobile (Opera) and it was a mess of
       | overlapping text. I suggest you add a screen saying it's desktop
       | only.
        
       | crazypython wrote:
       | Hi. To make my game load quickly, it uses <link rel=preload> on
       | JavaScript resources, smallest scripts first. While the game
       | itself is loading, the server selector's inline JavaScript
       | immediately loads the list of servers from a CDN, surge.sh. The
       | idea is network requests that depend on network requests should
       | load first, because they have the longest chain of roundtrips.
       | 
       | It pings a random server in each region to find the nearest
       | region, which is found by finding the server that replies first,
       | since nearer servers are closer. Then it pings all servers in a
       | region to find the number of players. It randomly picks from the
       | server with the two least number of players. Then the JavaScript
       | transparently pre-loads game resources (mockups.json and
       | skillmap.json) by appending a <link rel="preload"> to the <body>.
       | That way, once the game starts, "fetch" will find preloaded
       | resources.
       | 
       | 80% of players said it was very fun.
        
         | dom96 wrote:
         | Nice! Interesting approach. I'll have to try to replicate this
         | for my game[1] where the loading of some JS scripts is
         | sometimes annoyingly high (in particular for the cookie consent
         | for some reason).
         | 
         | > 80% of players said it was very fun.
         | 
         | Curious how you got this statistic, do you ask this in-game or
         | did you do a case study with some friends?
         | 
         | Btw I just played and found the FPS to be quite low (there was
         | a lot of things firing on me). This was Firefox on Windows.
         | (Edit: tried Chrome and there is a visible difference, so you
         | seem to have a bottleneck on FF)
         | 
         | 1 - https://stardust.dev/play
        
         | michaelpb wrote:
         | Looks like a fun io game, congrats! One day i'll have the time
         | to finish one of my games hahah
         | 
         | Also congrats on the fast load time! Slow JS is my biggest
         | peeve about the modern web. My "daily drivers" are all under-
         | powered hardware -- I have not spent more than ~$250 on a
         | computer in like a decade -- which 1) forces me to develop
         | lightweight & quick frontends, and 2) reveals just how awful so
         | many websites are for anyone who isn't using the maxed-out
         | MacBook Pro that the original developer used.
        
       | defanor wrote:
       | Is it supposed to work in Firefox? I've allowed all the scripts
       | to run in FF 78.7, but there's an empty screen after pressing
       | "play". There's a lot of errors in the web browser console
       | though, mostly CORS ones. And the following: "Uncaught TypeError:
       | CanvasPattern.setTransform: Argument 1 does not implement
       | interface SVGMatrix."
        
       ___________________________________________________________________
       (page generated 2021-01-27 23:00 UTC)