11 ms·
14kb WASM game written in D
- adenozine 5y agoWow, what an impressive game for the web browser, and in such a small size! I'm particularly impressed by the variable lighting of the bullets down hallways, that's really quite masterful work. Kudos! Edit: I am impressed because I'm impressed. I spent a few weekends recently messing around with pygame, and I had a really hard time organizing my code and my thoughts. I do primarily numerical, technical work, and I see that there is something challenging about writing a game that I haven't come across much in 25+ years. Feel free to shit on my comment, but I still think it's a very cool project, and seeing it run so smooth in a web browser, in a vm, on a beat up box with a Celeron was surreal to me.
- AnIdiotOnTheNet 5y agoOk, I'm not trying to take anything away from the developer here but calling this "masterful" makes me think you must have incredibly low expectations for webtech games and/or developers.
- elb2020 5y agoOr incredibly low expectations for programmers in general, which is fair. If you pick 100 random run-of-the-mill programmers from any corporation, and ask them to repeat this exercise, 95 of them would not even get out of the starting blocks. I liked it.
- rapind 5y agoThe remaining 5 would talk like an elitist about their peers?
- TimTheTinker 5y agoIn my experience, those that are actually the smartest are also down-to-earth and approachable -- the sort that you can have very interesting, thoughtful conversations with and enjoy being around. I suspect folks who had bad experiences with a "smart" person might have been dealing with someone who was a "big fish in a small pond", who hadn't been sufficiently humbled by going to (or trying to go to, haha) a more appropriately challenging level of education or professional practice. So generally, I think the difference is that truly smart and knowledgeable people have serious respect for the vast body of knowledge they haven't acquired.
- adenozine 5y agoTo piggyback on this, some of the people I've worked with in the past that could be called "smartest" are people with a natural aptitude for explaining things. I've definitely met people who hadn't been humbled by life yet, and they're not too grating imo to deal with, provided they have good social skills and work ethic. But there are those who innately understand that a lot of software team communication is about conveying an idea that is potentially unfamiliar to someone, and cooperating with them. I remember the first time someone showed me how to use Makefiles. I had seen them, I comprehended their usage, but when I was shown how easy it is to actually form them and use them for different purposes, it was incredibly eye-opening. That conversation couldn't have been but 7-8mins. That man was actually my boss for a while later on, before he had a bad car accident. Another example might be my old mentor who helped me grok syntax-rules for the first time, over a lunch break, with a pen and paper. It just clicked, and I learned. My point is, the combination of social skills + intelligent explanations + teaching practice is a powerful one.
- elb2020 5y agoMaybe it sounded a bit elitist. I myself am not a game programmer, and I would indeed be among the 95 struggling to get out of the starting blocks. I do like low-level stuff, however, and I choose to be impressed by projects like this!
- AnIdiotOnTheNet 5y agoBeing impressed by something and calling it "masterful" are very different things.
- adenozine 5y agoNobody has ever called your work masterful, have they? That must be why you've been so dismissive and rude in this thread, because you feel sad. :(
- AnIdiotOnTheNet 5y agoI don't feel I am being rude or dismissive. I have nothing negative to say about this project or its results. I just find the idea of calling a relatively simple bit of lighting "masterful" very strange. It'd be a bit like someone looking at something I have written, like a serialization routine, and saying that my use of bitshifting and masking was "masterful". That kind of thing is very basic for the domain.
- pjmlp 5y agoImpressive? 2011 says hi. "Unreal Engine 3 Support for Adobe Flash Player - Epic Citadel" https://www.youtube.com/watch?v=xzyCTt5KLKU https://www.youtube.com/watch?v=xzyCTt5KLKU
- zamadatix 5y agoThat's something on the order of ~5,000 times the size and looks extremely bland/boring.
- pjmlp 5y agoMight be boring, yet where are the WebGL/WASM versions that are the modern versions thereof?
- caslon 5y agoThe Citadel demo already works with Emscripten, so...still Citadel.
- zamadatix 5y agoBoring demos are available anywhere you care to search. https://playcanvas.com/explore https://playcanvas.com/explore is the typical goto for this kind of 3d market these days. Particularly popular in the mobile OS and web game (e.g. facebook) space. Robostorm, seemore, and After The Flood are their demos. Unity and Unreal can both export large games to the Web just fine but people found out they didn't want to serve 50 GB games to a temporary client.
- sireat 5y agoMaking a sticky game is much harder that it seems. Many of us could code something like this technically but it would play horribly and look worse - and would be more than 14kb of WASM It is the little things, the lighting, the little sound effects, even the unlimited ammo
- deleted 5y ago[deleted]
- apsdsm 5y agoI think it's pretty cool too. The people shitting on your post should go try implementing the same thing.
- catoc 5y agoYour post it just fine. Shows enthusiasm, and provides argumentation why/what made you enthusiastic. Up voted for balance.
- code_checker4 5y ago> A D port of a js13k competition game written by Dominic Szablewski. [0] -- [0] - https://github.com/skoppe/spasm/tree/master/docs/examples/underrun https://github.com/skoppe/spasm/tree/master/docs/examples/un...
- teddyh 5y agohttps://github.com/phoboslab/underrun https://github.com/phoboslab/underrun
- deleted 5y ago[deleted]
- jand 5y agoThis uses webgl, right? Maybe feedback to the user in case of missing support would be useful. Else folks get stuck at "Initializing..." with an exception in the console. Not everybody checks the console. (TypeError: can't access property "createBuffer") Edit: stuck at "Initiating..."
- newfie_bullet 5y agoYeah I first tried this in Safari and just had a black screen - edge/chrome worked just fine. Notice/pop-up would be helpful
- edgls 5y agoRunning fine on Firefox on Mac OS
- city41 5y agoThis is my first exposure to Spasm (a wasm web framework where apps are written in D) and my first impressions are quite positive. https://github.com/skoppe/spasm https://github.com/skoppe/spasm
- abhimanyu003 5y agoThis is really amazing work, super impressed with such a small size, gameplay mechanics, and how smooth it works. Bullet animations are super impressive.
- edgls 5y agoPretty impressive performance. It seems web assembly is pretty good tech for writing a performant web app. Is there any benchmark comparing web assembly vs javascript? I mean the same logic executed by javascript code vs the web assembly. Also curious to know if there are any serious web apps developed using web assembly.
- tempest_ 5y agoMy understanding is WASM is pretty performant except in the case when it needs to interact with browser apis / js where is preforms quite a bit worse than JS.
- Thaxll 5y agoI'm not sure there is a difference for webgl calling it from Wasm vs JS?
- AnIdiotOnTheNet 5y agoI don't think you say much about the performance here except that it isn't noticeably terrible. Any modern computer should be expected to run this kind of thing with a smooth framerate using paltry resources. I would expect this even if this had been written directly in javascript.
- deleted 5y ago[deleted]
- nikki93 5y agoFigma uses webassembly. We also use it for our web engine at https://castle.xyz https://castle.xyz, I gave at talk about that you can watch here: https://youtu.be/0FjCaoc1uzs https://youtu.be/0FjCaoc1uzs where I go into some details and also do some live wasm game development (not sure how "serious" since we're still working on our app though). Much, much better performance than JS is possible because (among many other things) you can perform a lot of optimizations during AOT compilation due to eg. LLVM, avoid GC and arrange memory to help cache efficiency. Re: JS call overhead, ultimately using instanced drawing so you have a constant number of draw calls even for a growing number of objects is what helps.
- tester34 5y agothis is great! but ff shows that underrun.wasm is 35KB, what's going on?
- destructionator 5y agoheadline put the one compressed number instead of the uncompressed number. There's also ~10KB of javascript bridge it requires as well.
- lifthrasiir 5y agoYes. As far as I see index.html + underrun.wasm + l1.png + q2.png combined will compress into about 20.1 KB of ZIP. Still very small, but not 14 KB.
- chrismorgan 5y agoA few errors: • There’s an & that should be either & or &, depending on whether it’s setting HTML or text. • The opening garbage text is mojibaked, so that it looks like… different, not as æsthetically pleasing garbage. • The text that’s supposed to be like “7 SYSTEM(S) STILL OFFLINE” is getting mangled badly, missing much of the string and getting a bunch of U+0000s in it—unchecked and incorrect string indexing, by the looks of it. Hmm… “1␀␀␀␀␀␀␀␀␀␀STIL1␀␀␀␀␀␀␀” actually looks like something’s clobbering the string literal stillOffline. Ouch; that actually worries me, though I hope it’s largely just a side-effect of some shortcuts taken to keep the code tiny and not something that would normally be an issue? • terminal_text_outro has some double quotes that should be single quotes (apostrophes). Other than that, seems to be working well.
- phoboslab 5y agoFor what it's worth, the original 13kb JS only version[1] does not have these problems. I was confused for a second why this game made its way to HN again (there's a making of for the game itself from 2018[2]). This seems to be a port of the game to D[3] as a demo for a WASM runtime, Spasm, which is also written in D[4]. [1] https://phoboslab.org/underrun/ https://phoboslab.org/underrun/ [2] https://news.ycombinator.com/item?id=18031024 https://news.ycombinator.com/item?id=18031024 [3] https://github.com/skoppe/spasm/tree/master/examples/underrun/source https://github.com/skoppe/spasm/tree/master/examples/underru... [4] https://github.com/skoppe/spasm https://github.com/skoppe/spasm
- umvi 5y agoThe style of this game reminds me strongly of "Teleglitch": https://store.steampowered.com/app/234390/Teleglitch_Die_More_Edition/ https://store.steampowered.com/app/234390/Teleglitch_Die_Mor...
- the_af 5y agoThe graphics definitely resemble Teleglitch! Though that game is more complex, what with the combination of items...
- krumpet 5y agoIn the "making of" post, Dominic references Teleglitch when discussing the graphic assets. https://phoboslab.org/log/2018/09/underrun-making-of https://phoboslab.org/log/2018/09/underrun-making-of
- sgt 5y agoI only see a black screen in Safari.
- sgt 5y agoSay if you increased the resolution here to become significantly less blocky, would it work with browsers in general or would it consume considerable amount of CPU?
- the_af 5y agoI think the blockiness is an aesthetic choice, much like in the awesome roguelike Teleglitch. I like it!
- sgt 5y agoAlso, what is the advantage using D for this? Could this be D's niche market? It looks really exciting.
- jug 5y agoThey’re not the best metrics but the related Spasm toolkit had surprisingly many stars and forks for being D. This was the more interesting tool I discovered here, rather than the JS game port to D, where honestly the impressive part is already done in JS. So yes it got me thinking the same thing. https://github.com/skoppe/spasm https://github.com/skoppe/spasm
- mhh__ 5y ago> had surprisingly many stars and forks for being D. Github stars are an extremely weak signal. Some D users have actually said to me that they feel slightly confused that their projects have more stars than the actual language implementation on github just because of hype, for example.
- mhh__ 5y ago> Could this be D's niche market? Maybe it could be, but our goal is not to have "niches". If anything, our niche is making people who would otherwise not be, productive enough to deliver what they want to make. D isn't a gimmick language, it's a Programming (with a capital P!) language.
- chrismorgan 5y agoThe original JavaScript implementation: https://js13kgames.com/games/underrun/index.html https://js13kgames.com/games/underrun/index.html (It was a js13kgames submission in 2018; I’m guessing that this being submitted here now is in some way linked to how Q1K3 is currently on the homepage, also a js13kgames submission, though for 2021. Pure speculation.)
- teddyh 5y agoLink to author’s site: https://phoboslab.org/underrun/ https://phoboslab.org/underrun/ Source code: https://github.com/phoboslab/underrun https://github.com/phoboslab/underrun
- hatch_q 5y agoQuite interesting... no noticeable difference in performance between the two. FPS capped at 72fps. And pretty much identical cpu/gpu load.
- tacticaldev 5y agoA LITTLE SLOWER, BUT WAY LESS BUGGY. Thanks for sharing the link. Very cool for a 1k game.
- dragonshed 5y agoI wonder why the rewrite doesn't have music. The original js13k game implemented a small sonant-x player for the audio, both sound fx and music.
- tacticaldev 5y agoSUPER IMPRESSIVE, SUPER BUGGY... VERY COOL (OVER ALL)...
- mstange 5y agoWASD doesn't work by default because I'm using a Dvorak keyboard layout. Using KeyEvent.code would solve this problem.
- deleted 5y ago[deleted]
- bachmeier 5y agoA little background information from the author in this post: https://forum.dlang.org/post/cpdnekfjletgezqvqayz@forum.dlang.org https://forum.dlang.org/post/cpdnekfjletgezqvqayz@forum.dlan... Includes links to a couple other examples.
- johnnyApplePRNG 5y agoWhy does my mouse not move the direction of the gun when pressing W, A, S or D? Was frustrated by a similar experience with Q1K3 earlier.
- hmmokidk 5y agoHow does one learn what it takes to do this?
- adamredwoods 5y agoStart by forking the code and adding a new enemy.
- brundolf 5y agoD is garbage-collected, right? How does the game plus the whole runtime fit into 14kb?
- lifthrasiir 5y agoIt is using the BetterC mode which disables all runtimes including gc. Spasm framework used by this demo is designed for such use case.
- destructionator 5y agoI did D including a custom runtime in about +20 KB of webassembly over this (I just wanted to take a straight desktop program and port it over). The runtime doesn't have to be that big.
- WalterBright 5y agoD's garbage collector is optional.
- marty8 5y agoui
- marty8 5y agohi
- brundolf 5y agoI appreciate the quality of the art given that this is presented (at least partially) as a tech demo! Oftentimes you don't get both; it's refreshing to see
- Andrex 5y agoI remember paying money for Impact.js (HTML5 game engine by PhobosLab) and it was leagues ahead of any rivals for quite a while IIRC. PhobosLab is awesome and it's great to see Dominic Szablewski pushing web-gaming forward to this day. Hope to see it continue. :)
- Newtonip 5y agoMy initial reaction to the title was "what genre is WASM?". Then I remembered it means web assembly.
- glandium 5y agoFor some reason, I quickly ended up outside the walls with no apparent way to get back inside.
- em3rgent0rdr 5y agoexcellent combination of smooth real 3D with pixelation. Reminds me of the old demo scene showing 3D on 320x240 QVGA displays.
- kesslykaes 5y agoI wonder if the other route forward is cloud streaming games to the browser powered by a "Heroku" for cloud game hosting.
- kesslykaes 5y agoWould allow for more graphics extensive experiences! But, I do think the future will be full of games that can be instantly played directly in the browser
- joaquincabezas 5y agoAfter finishing the game, there is the following message: > SENT: SEP. 13, 2018 > RCVD: SEP. 13, 2718 > > THANKS FOR PLAYING > > I HAVE PREVIOUSLY BEEN A PROUD SPONSOR OF THE JS13K > COMPETITION SINCE THE VERY FIRST ONE BACK IN 2012. > HOWEVER, THIS YEAR"S COMPETITION WAS MY FIRST ONE > AS A PARTICIPANT AND IT HAS BEEN TREMENDOUS FUN! > > I WANT TO THANK MY DEAR FRIEND ANDREAS LÖSCH OF > NO-FATE.NET FOR COMPOSING SOME AWESOME MUSIC ON > SUCH SHORT NOTICE. > > FURTHER THANKS GO OUT TO THE JS13K STAFF, THE > SONANT-X DEVELOPERS AND ALL OTHER PARTICIPANTS > IN THIS YEAR"S JS13K. SEE YOU NEXT YEAR! > > DOMINIC > END OF TRANSMISSION
- 271327 5y ago<!DOCTYPE html> <html lang="en-us"> <head> <meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Unity WebGL Player | Gun Swinging</title> <link rel="shortcut icon" href="TemplateData/favicon.ico"> <link rel="stylesheet" href="TemplateData/style.css"> <script src="TemplateData/UnityProgress.js"></script> <script src="Build/UnityLoader.js"></script> <script> var gameInstance = UnityLoader.instantiate("gameContainer", "Build/WebBuild.json", {onProgress: UnityProgress}); </script> </head> <body style="background-color: #e15417;"> <div class="webgl-content"> <div id="gameContainer" style="width: 506px; height: 900px; box-shadow: 2px 10px 0px 0px #0000007d; border: solid 5px #fff;"></div> <div class="footer"> <div class="webgl-logo"></div> <div class="fullscreen" onclick="gameInstance.SetFullscreen(1)"></div> <div class="title">Gun Swinging</div> </div> </div> </body> </html>