[HN Gopher] Crafting a 13KB Game: The Story of Space Huggers
       ___________________________________________________________________
        
       Crafting a 13KB Game: The Story of Space Huggers
        
       Author : lovegrenoble
       Score  : 142 points
       Date   : 2024-08-16 08:10 UTC (14 hours ago)
        
 (HTM) web link (frankforce.com)
 (TXT) w3m dump (frankforce.com)
        
       | lifthrasiir wrote:
       | For the record, this year's js13kGames [1] has just started days
       | ago and will continue to run until September 13. :-)
       | 
       | [1] https://js13kgames.com
        
         | Waterluvian wrote:
         | I love the idea of tiny games as a constraint to keep scope
         | sensible. But I worry this is actually a code golf competition.
         | I wonder how many entries are just auto-minified.
        
           | actionfromafar wrote:
           | Still a challenge.
        
           | lifthrasiir wrote:
           | In some way, it is; better minification does give you some
           | additional margin. But it would then be a _terrible_ code
           | golf competition because 13 KiB here is the size _after zip
           | archiving_ so the actual limit is anywhere from 30--40 KiB
           | for typical entries and would be very generous. The
           | introduction of better compression tools may have lifted the
           | upper limit a bit but not too much. (Disclaimer: I 'm the
           | author of one of such tools that got popular later.)
           | 
           | It should be noted that most assets are still too large in
           | this limit, so almost everything should be made from a code
           | and many stuffs have to be consciously chosen to be included.
           | For this reason, I feel that the limit is rather a very
           | interesting threshold that allows for ordinary developers
           | without much size optimization experience to start with, but
           | should be plenty enough for experienced people to make
           | difference.
        
             | Waterluvian wrote:
             | Awesome, thanks. So while I might need to think about
             | clever ways to generate/handle assets, I can generally not
             | worry about "all the clever JavaScript hacks" and just
             | write thoughtful TypeScript that I elide and minify.
        
               | lifthrasiir wrote:
               | Yeah, most microscopic JS hacks would be too cumbersome
               | to use in this scale. But some conscious decisions to
               | structure your code may make a big difference.
        
             | jsheard wrote:
             | Kind of tangental since it doesn't apply here but I love
             | the compression hack used in JS competitions where HTTP
             | wire compression or zipping the files don't count towards
             | the size limit, so the HTML has to decompress itself. The
             | canonical way to do it is to craft a file which browsers
             | will parse as either a PNG or HTML, with the HTML part
             | carrying a stub of Javascript which reads the page as a
             | PNG, draws it into a canvas, extracts the pixel data,
             | reinterprets it as a string containing the main JS payload
             | and evals() it.
        
               | lifthrasiir wrote:
               | AFAIK js13kGames is intentionally using ZIP as a
               | compressed container in order to avoid requiring such
               | relatively obscure hacks to be competitive (up to some
               | degree). Also the hack itself is now being less relevant
               | due to the introduction of DecompressionStream and non-
               | DEFLATE compression algorithms.
        
           | Cthulhu_ wrote:
           | Even if minified, the file size is so constrained that it
           | basically excludes the use of assets like images and audio
           | files.
        
             | whizzter wrote:
             | 13kb of 44khz 16bit MONO audio is 150ms, even with
             | compression sampled audio is more or less out of the
             | question.
             | 
             | With pixel art images however you can get a fair bit in if
             | you're comfortable with low resolutions in 8bpp or lower.
        
               | criddell wrote:
               | You can still do some impressive stuff:
               | 
               | https://js13kgames.com/games/q1k3/index.html
        
         | whizzter wrote:
         | Actually noticed the compo in time this time (no idea good
         | ideas for the theme though), got 2 or 3 interesting failed
         | attempts to scrounge code from (but not sure of the approach to
         | take yet).
        
       | filcuk wrote:
       | It's amazing how close to the inspiration - Broforce - it
       | actually feels, at least from the video. I'd sacrifice floppy 41
       | out of 45 of Microsoft Office 97 Standard Edition to be able to
       | play this.
        
         | twic wrote:
         | It looks incredibly similar. It plays somewhat differently -
         | the controls are quite sluggish for me, the jumping and
         | climbing is a bit clumsier, and the grenades change the
         | dynamic. But the influence is very clear!
        
       | diceduckmonk wrote:
       | Another reason to golf. It's not quite right, but it's a fun goal
       | to fit an app within the first few TCP roundtrips.
       | 
       | https://endtimes.dev/why-your-website-should-be-under-14kb-i...
        
         | asdfman123 wrote:
         | It actually felt weird that the site loaded so fast. I'm not
         | used to that!
        
         | comprev wrote:
         | PinkBike (online mountain bike community) has a good tech blog
         | post on increasing their slow start settings (2010)
         | 
         | https://www.pinkbike.com/u/radek/blog/pinkbike-speed.html
        
       | debo_ wrote:
       | LittleJS is great. I love tinkering with it. Frank is great too,
       | nice little community in the discord and he is super responsive
       | to questions.
        
       | nox101 wrote:
       | Neat game but why is it so slow? It runs smooth at the start but
       | whenever I get near some enemies, as soon as 1 or 2 explosions
       | happen it runs at like 10fps or less. I'm on an M1 Mac which can
       | run some pretty high end games. I tried Safari, Firefox, and
       | Chrome
        
         | mecsred wrote:
         | It is 13kb. They were optimizing for a small binary over
         | performance.
        
           | nox101 wrote:
           | They claim it's fast
           | 
           | > Super fast sprite and tile map rendering engine with WebGL
           | 
           | > Update and render 100,000+ sprites at a solid 60fps
        
         | fullstop wrote:
         | Odd, it runs like butter even with a bunch of enemies on my
         | screen over here.
         | 
         | Linux, Brave, i5-10210U, integrated GT2 GPU.
         | 
         | Firefox is much slower on the same machine.
        
       | throwawayk7h wrote:
       | Incredible. I love these stories of kb games. For those
       | interested, there's a great video for this 40 kb nes game, micro
       | mages:
       | 
       | https://m.youtube.com/watch?v=ZWQ0591PAxM
        
       | RegW wrote:
       | It's great to see this sort of stuff still goes on.
       | 
       | In 2000 (I think), I put 2 Java Applets into the 5k competition.
       | One a maze game with a thousand rooms (10x10x10), the other a
       | spelling checker that checked the contents of an input field
       | against a word list. Both were quite poor and I didn't do well.
       | 
       | The general standard was really impressive. I remember that there
       | was pretty good chess game done in Javascript.
       | 
       | https://www.the5k.org/about.php
        
       | causality0 wrote:
       | Impressive,though I still think Kkrieger is the most impressive
       | tiny game I've seen.
        
       | nhggfu wrote:
       | brilliant.
        
       | Lammy wrote:
       | Love it, though I wouldn't have been able to resist naming it
       | Gamehuggers From Outer Space.
        
       ___________________________________________________________________
       (page generated 2024-08-16 23:00 UTC)