Making a game on a custom bytecode VM in 7 days and 3kB

(laurent.le-brun.eu)

108 points | by laurentlb 8 days ago ago

21 comments

  • vegabook 3 days ago ago

    It's incredibly satisfying to see the polar opposite of the usual LLM/superDB/K8/CICD/Cloud/Container/Crapola corpobloat we hear about on this site all the time, namely a tiny piece of handcrafted code, ironically produce something infinitely more aesthetically beautiful, and intellectually interesting from an almost artisan engineering perspective.

    • llmslave2 3 days ago ago

      Especially because some framework slopper using all the LLM's and bloat in the world could never even imagine reaching this level of productivity. In 7 (SEVEN) days this coder

      - Designed a language.

      - Implemented a compiler to compile it to bytecode, using F#.

      - Wrote a bytecode interpreter, using C++.

      - Created a shoot’em up game, using the custom language.

      - Renderd the graphics, using a single GLSL shader.

      • suprjami 3 days ago ago

        While I agree with the sentiment that LLM coding can produce a lot of inefficient junk code which works with holes if you're lucky...

        What you're describing is 7 days of productivity supported by probably 7+ years (or 27+ years) of experience and learning and getting things wrong and restarting over again.

        It is definitely wonderful to see though.

      • fragmede 2 days ago ago

        I gave Claude a screenshot of your comment, and it accepted the challenge.

        Claude called the language Blitz.

        The repo it created: https://github.com/fragmede/blitz

        Is the code shit? I haven't looked at it. Didn't have to. Probably is. I fed it the blog post at the end, and difference.md has a comparison on what Laurent Le Brun built vs Claude, and Claude is fully aware that it went a different way on a number of different things.

        It chose python, I had to tell it to use uv.

        I'm on a mac with high DPI and it got confused about that.

        I had to tell it to make a binary format (it made a BLTZ header)

        But you can clone that repo, do uv run main.py --compile game/shooter.blitz and it'll make a .blitzc. Then you can do uv run main.py game/shooter.blitzc Tear the code apart. Call out every tiny mistake in that repo. It's probably cheating somewhere! But all I did was give it challenge.png that's in the repo, and tiny bits of English, and Claude went to work.

        It's been 21 years since my college computer graphics class and I went into distributed systems and not game dev, so someone else will have to tell me if it used a single (or even any!) GLSL shaders, or not.

        Call it slop all you want, but that took me 70 minutes of babysitting.

        • HarHarVeryFunny 2 days ago ago

          What's the point?

          None of this is individually difficult, but an actual human being had the motivation and talent to bring it all together in 7 days, which is impressive.

          So what if an LLM can create the same components if you tell it to. It's a bit like someone sharing a handknit sweater they just made, and you counter with "Well, here's a machine made one I bought in Walmart, made in 5 min in China".

          • fragmede 2 days ago ago

            Is it impressive in the way Max Verstappen winning the F1 World Championship in 2023 was impressive, operating at the absolute limit under pressure and getting paid beaucoup bux for it? Or is it impressive in the way your kid is impressive the first time they manage to draw stick figures and a house with crayons? Those are both real achievements, but they are impressive in completely different ways, and the value of the work produced is wildly different. I might fly to Vegas along with 300,000 other people and pay for hotel rooms and pay to watch some shows while I'm there as well as to watch him race, but (and don't take this the wrong way), but I ain't gonna do that to watch your kid draw with crayons.

            The difference is the baseline. Once the default outcome is cheap, fast, and good enough, the human effort stops standing out in a way that matters. At that point, pointing at the Walmart sweater is not missing the point, it is the point.

            • HarHarVeryFunny 2 days ago ago

              So you don't put any value on being human, learning skills, showing creativity, doing inspiring things?

              Should people stop playing chess just because a free chess engine can trounce everyone on the planet?

              Humans can be awesome. Machines are just machines.

            • 2 days ago ago
              [deleted]
            • 2 days ago ago
              [deleted]
        • 19 hours ago ago
          [deleted]
  • jstrieb 3 days ago ago

    The rest of the games submitted to this very interesting, somewhat niche game jam (including my own entry) are here:

    https://itch.io/jam/langjamgamejam/entries

    There were some really impressive submissions in spite of the short time frame!

    • azhenley 3 days ago ago

      The jam was originally going to be just me doing a solo project but it grew much larger! Over 200 people joined the Discord.

      We plan on running it again: https://langjamgamejam.com/

      • jstrieb 3 days ago ago

        Maybe I missed it, but I didn't notice a submission of yours in the jam. Did you end up getting around to doing your solo project?

    • reidrac 3 days ago ago

      Dungeon-Specific Language (DSL)

      Cheff kiss!

  • NooneAtAll3 3 days ago ago

    Reminds me of https://js13kgames.com/ where people managed to do a whole air sim in 13kb (out of many other things)

  • PaulHoule 3 days ago ago

    Such a beautiful technique for shoehorning straight out of the 1970s! See also

    https://en.wikipedia.org/wiki/CHIP-8

    and

    https://en.wikipedia.org/wiki/SWEET16

    It seems so un-FORTRAN that DEC had a FORTRAN compiler for the PDP-11. that was based on a stack machine and then later built an FP accelerator specialized to accelerate the stack machine. It was a straggler but I'm still trying to track down a circa 1992 article from Dr. Dobb's Journal where someone used virtual machine techniques to unbreak the broken i860 and make a good FORTRAN compiler.

  • pikuseru 18 hours ago ago

    Of the many cool things I liked about this, removing the missile from the array by swapping it with the last missile and decrementing the missile count was a nice trick.

  • nsxwolf 3 days ago ago

    What's that overall filter that covers the view? Is it supposed to look like a late 80s passive matrix color LCD screen?

    Edit: Thanks for the downvote, guess I shouldn't have paid any attention to this post at all?

    • macintux 3 days ago ago

      Worth noting that it's easy (and probably fairly frequent) to click the wrong arrow, especially on a phone screen. I've started double-checking the "unvote" vs "undown" link that appears afterwards to make sure I hit the right one.

      • somat 3 days ago ago

        So that's how you tell, salutes. Sometimes I worry that I inadvertently downvoted someone by mistake. "But you can just unvote if that happens" sure but how do you tell what was voted.

        Anyhow, I think if this was my forum I would put the downvote selector at the end of the comment title and have the upvote selector at the beginning.

    • laurentlb 3 days ago ago

      There's no specific filter. The main effect is blending the previous frame with the current frame. When blending, I modify the coordinates and add some noise. This makes the graphics look less basic and it creates this noisy trail when things move.

      The source code is here: https://github.com/laurentlb/shmup8/blob/main/src/shaders/sc...

      Blending is on lines 241, 242.

      I didn't try to get a specific 80s look, I just played with formulas.