Hacker News new | past | comments | ask | show | jobs | submit login
Quake in 13kb (2021) (js13kgames.com)
261 points by pfych 3 months ago | hide | past | favorite | 76 comments



Excellent.

I propose we inscribe the Doom and Quake source onto twin golden platters[0] and send them into outer space with the next interstellar probe.

[0] https://en.wikipedia.org/wiki/Voyager_Golden_Record


You would also need to describe how to build a JavaScript interpreter starting from fundamental physical properties of the hydrogen atom.


Wait, but in "Independence Day" they uploaded human-made computer virus into alien computer and it just worked™!


Sure, and that makes perfect sense, since earth tech was based on the alien tech they found in the Roswell crash.

Shame they deleted the scene explaining all that. It's still easy to find though.


> Shame they deleted the scene explaining all that. It's still easy to find though.

Huh! I always thought the logic was that since the aliens used earth satellite systems they had already interfaced with human computer systems and the infection was made via the satellite system, which I believe the main character was knowledgable about.


That doesn't entirely follow, though. Just because you could talk to the alien computers doesn't mean you could execute a program on them. IMO the deleted scene is the only way it can make sense.


Put differently: you can’t run a windows/linux exploit on a Linux/windows machine just because they can both connect to the Internet.


This. But everyones focused on languages lol.

Actually lol, who says the aliens were not running a emulator of our own systems and in their hubris ran it on elevated privs.

ok ok, considering the Aliens allowed their own ship, which was visually compromised AND could have been easily scanned for non-alien life(?)... clearly not a culture of security.


Yah, but worked because the aliens used the humans satelite network against them, to comunicate with their fleet.

Since they where interfacing with out tech, makes sense to use this against them.


That's like saying a C64 virus could work against a Linux box, because a C64 modem was used to control the C64.

And as the virus author, you've never seen Linux, have no idea about anything past the C64, including bioses, CPU structure, APIs, PCI/etc architecture, and all other computing hardware, and?

That's being friendly, because they'd be interfacing with computing systems hundreds, thousands, or millions of years more advanced, written by aliens, which view the universe entirely differently due to different brain structures, with an unknown number or type of senses, with an unknown way those senses work or are perceived, with "code" not necessarily in binary, or using silicon based chips, or even transistors, or.. well, this part never ends.

The premise is immensely absurd.

Of course it is a movie, but this sort of canon puts it into soft scifi, if not fantasy.



If you go with the logic of the deleted scene, it's like asking if an 80s programmer with no knowledge of modern hardware or software could still make a virus that would infect modern systems, which makes it significantly easier to swallow.


NO but a virus made for a linux box that was programed in a c64 could work.


And in War of the Worlds they uploaded a human-compatible virus into aliens and It Just Worked(TM) :P


That was more the aliens being arrogant than humans doing anything.


Left as an exercise to the reader :)


Well, you can use an approach like CosmicOS [1] to bootstrap a functional computer to the alien hardware and then write a JavaScript interpreter and display in that bootstrapped language. In fact autonomous agents might be needed in general due to the long round-trip time of such interstellar messages.

[1] https://cosmicos.github.io/


Holy Dark Forest Batman!


Nah, the aliens likely use JavaScript themselves. It's everywhere.


Heard the project has < 100 billion stars on github.galaxy though, basically dead by this point.


Also how to make an apple pie from scratch.


Where it’s going they don’t need JavaScript.


Just send Lisp.


if we send javascript to a alien species, we will make enemies of another civilization.


Of course, you'll also need to inscribe the whole Chrome source code, since this demo outsources a lot of engine stuff to the browser :)


"This civilization appears to be sending threatening messages in form of a simulation that demonstrates their destructive intent. Put their eradication on the TODO list."


That's more like sending an interstellar threat to the stars. Beware of earth, it is full of a waring race of people.


Aliens will probably be like "Oof, ping times to your galaxy are high... Here's some rollback netcode for intergalactic DM."


Rollback netcode might be good for games, not so much for conversations.


DM=deathmatch, not direct messaging.


Super 3D Noah's Ark, then?


"Sir, it appears the humans only require two of every creature."

"Very well, we shall start the optimization process with them."


One of my favorite copypasta, for it’s cosmic level of deranged belligerence:

“A LETTER TO ALL ALIENS SPYING ON EARTH'S WIRELESS INTERNET SIGNALS:

DEAR ALIENS, IGNORE EVERYTHING THAT NASA AND THE SPACE NERD SCIENTISTS HAVE TOLD YOU. THIS IS THE ONLY OFFICIAL, LEGITIMATE, HONEST STATEMENT OF ALL THE PEOPLE AND GOVERNMENTS OF PLANET EARTH. ALL OF US COLLECTIVELY, WITHOUT EXCEPTION, THINK THAT:

• EVERY ALIEN IS A SON OF A BITCH

• WE WILL WIN ANY SPACE WAR

• OUR ENTIRE PLANET IS A BOMB

• FUCK YOU FUCK YOU

WE WILL NEVER EVER CHANGE OUR OPINION IGNORE EVERYTHING THEY PUT ON VOYAGER 1”


“We like to pretend space is full of hell monsters you see”


Right ... pretend ...



It uses generative graphics like a simplification of the technique of Farbrausch (seen in its 64kb intros and usable in its ".werkkzeug" editor).

> [the] library supports only 5 different functions: Embossed Rectangle; Embossed Grid; Noise; [draw] Text; Draw previous texture

https://github.com/phoboslab/q1k3/blob/master/source/ttt.js


The Farbrausch demo and a talk by Will Wright on the (originally planned) procedurally generated design of Spore lives rent free in my brain every time I see the list of 100's of gigabytes of queued game updates in Steam nowadays.

https://www.youtube.com/watch?v=ofA6YWVTURU&t=100s


So technically this could fit in 5 QR codes.

I say technically because neither by building or downloading with wget I can get a local html version working, so I guess it would be useful to waste time creating 5 QR codes.


Nintendo kind of did this back in the day with the e-Reader accessory for the Game Boy Advance. It used dot-based "barcodes" to encode NES games onto cards that you scanned and subsequently played from RAM. I imagine that some deft compression and the ARM Thumb instruction set came especially in handy here.


I once again reinvented the wheel, I see Jokes apart, didn't know that! Extremely cool!


It runs locally if you download the "m" and "l" files alongside it (for maps and models), and run it on a localhost server (to fix the CORS errors).

curl "https://phoboslab.org/q1k3/index.html" > index.html

curl "https://phoboslab.org/q1k3/l" > l

curl "https://phoboslab.org/q1k3/m" > m

python -m http.server

--

I then zipped it up, and converted that zip file to 7 QR codes, so technically yes, we can fit Quake on a few QR codes.


So bad is not a full html self runnable, I guess it is doable with some quick trickery. In that case, one could build a QR code html interpreter (aka read > output to file > open the file with firefox ) and it would be so cool


I did that trickery and it works: https://github.com/AdrianVollmer/Zundler

(I had to fix the mime type detection and I'll have to push that fix to PyPI, so use the main branch if you want to try it yourself.)

Unfortunately, since we have to ship it with the gzip lib pako.js, the size more than quadruples to 77kb, so no QR code with this approach. Maybe I should look into making compression optional.


You can use DecompressionStream instead of pako.js for all modern browsers. FetchCrunch [1] uses it to generate self-extracting HTML files, which were not portable at that time but now fully portable across browsers.

[1] https://github.com/subzey/fetchcrunch


Very cool. Thanks for letting me know!


Uh uh thats very interesting. I am gonna play with it a lot.

> the size more than quadruples to 77kb, so no QR code with this approach.

OR we can use 25 QR codes haha. Joking, but what about huge QR codes?


This is cool.

I found that the first line didn't work but: curl "https://phoboslab.org/q1k3/" > index.html

did the trick...


I need to be able to invert the Y-axis on the mouse.

It looks amazing, but I can't play as it is.


Please play the post competition version: https://phoboslab.org/q1k3/

This fixes some bugs and also adds the mouse invert option.


open your mouse and flip the y-axis sensors like a marine


Or use it upside down. That has the additional benefit of also inverting the x axis.


You could then fix the inverted x axis by using the mouse on the underside of the table. Works fine with optical mice, but a ball mouse might require fiddling with gravity (or magnets, but that's no fun).


I think most ball mice have the ball sitting tightly enough.


Brilliant. It contains just enough content to re-activate the neurons where my memories of the original are stored, and my brain is filling in the rest.


Yep! On the 2nd level, once I had the key, I kinda knew where I had to go?

Even though the level isn't exactly the same as the one in Quake.


It is mind boggling for 13kb. After a few minutes I didn't even feel the difference. Just perfect.


Great project, and clean code, thanks for this. Also interesting how you encode the soundtrack in js instead of putting it in the assets folder and then proceeding to sample the soundtrack in js yourself!

"let music_data = [6014,21,88,[[[7,0,0,1,255,0,7,0,0,1,255,0,0,100,0,..."


Well, when computers only had a few handful of kilobytes of RAM, we did not rely on samples...

(Martin Galway being an exception, see Arkanoid on the C64 - but it is Genius and it merged organically with the system, it progressed the technique as opposed to bypassing it.)


For anyone playing in Safari on a Mac—there seems to be something about games which capture the mouse that makes the cursor really slow. But holding down the left mouse button will bring it back to a normal speed.


Dang, could we change the title to 13 kB(yte), which is in the title of the the page? It is not 13 kb(it), which in this case a quite significant difference.



weird to play without a crosshair, did the original quake not have one?


It did but it was not enabled by default IIRC. Also fun fact the "crosshair" in original Quake was limited to only the character "+" from the character set. QuakeWorld later introduced a "crosshair 2" which was a slightly more complicated bitmap that you could change the color of.


And the “+” was slightly off center as well if I remember correctly.


My memory is fuzzy, there might not even had one at all in the first version. I had one of the first publicly distributed one (on a promo CD) and I remember it sure lacked a lot of stuff that were present down the road, IIRC even early 3dfx and then glquake had a bit more console options.

As for alignment, well at 320x200 (or 240 if your video card+monitor could manage):

- the crosshair might have been on the HUD layer which was pixel-aligned.

- 2px wide would have been quite wide, and 1px would have been off centre.

Tradeoffs tradeoffs.

I remember thinking that Doom had this "always looking down the sights" feel and Quake inherited that but the 3D aspect of it was more like the weapon felt belly height instead of shoulder height.

Since weapon was centered it wasn't too hard to aim horizontally, but Quake having 3d look up down and LOS hitscan line (vs Doom which hit the first enemy along a vertical plane) made Q hard-ish to aim vertically.


> - 2px wide would have been quite wide, and 1px would have been off centre.

Off-centre of your monitor, but not necessarily off-centre as far as the game is concerned: it would be trivial to shift everything one (or half?) a pixel to the upper left. Ie so that your shooting direction perfectly aligns with the crosshair. You could do that for any crosshair position.

Even cross-hairs that are off-screen.


To be fair, I don't think it really mattered, I mean there was so much hackery going on (either because of oversight or as performance tricks)† than a pixel off isn't really a problem.

† such as https://www.youtube.com/watch?v=4gNYTqn3qRc https://www.youtube.com/watch?v=zfY96tAqmdI


I seem to recall you had to open the console and type “crosshair 1”. I remember buying a book of all the console commands and various other tips haha


Some people used to have a little putty stuck to the middle their CRTs


My roommate back in the day did this for some FPS games. He had a little crosshair made of string taped to the middle of his monitor.


I promise this is not intended as snark: if you already have .php files used for the build, why then do string and memory management in C?


I assume you're talking about the pack_map.c used during build? That just was written in C because I had the .map parser already lying around from another side project. If I had done it from scratch for this project it likely would have been JS or PHP, too.


I don't know for sure, but I would hazard a guess that it would take up less space, if memory serves, I don't think PHP has pointers for example and I guess things like that would be more space efficient in c.


PHP has a pack() function that can write arbitrary bits, and if you like things extra-gnarly, you can manipulate arbitrary structs (and pointers) with FFI. But if there’s already a parser in C, it makes sense to use it.


Mind bending!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: