692 points · by myownclone · 4y ago · 216 comments
Some features: * uses Quake SW renderer + blitting to WatchKit surface (~60 fps, 640x480, larger res can run on lower framerate, tested up until 1024x768) * touch + gyro + digital crown controls * new AVFoundation audio backend (quake to Watchkit audio buffer copy logic), as Watchkit does not support CoreAudio * high pass audio filter to remove clicking on Watch speaker for some of the low frequency quake .wav samples * some smaller modifications and code updates to glue Quake 1 c code to Objective C and Watchkit
I once ported Quake 1 to the Rockbox operating system for MP3 players, which enabled it to run on the Apple iPod: https://www.youtube.com/watch?v=r6V-4AZ7pkA
The whole world of software ports basically boils down to "anything is possible, given enough memory, pixels, and time". The actual process of porting anything is sometimes incredibly tedious (e.g. "scour the entire source code for unaligned memory accesses, and manually rewrite all of them"), but also gives a chance to do some very clever things (like, "use the piezo speaker to beep out the address of a fault, because nothing else works on the device after a crash").
What made me do it was 1) the satisfaction I got from seeing my work produce something which, at first glance, shouldn't exist (Quake... on an MP3 player?), all while 2) learning deeply about software close to the bare metal, which is fairly hard to do early in one's career. There's of course also the factor of having lots of free time - I did my port when I was still a student with not very many responsibilities, so I could afford to spend entire evenings and weekends poring through mountains of C code. Nowadays, not so much...
Totally agreed with the reasons for doing ports, huge satisfaction and learning experience; which applies to all of the programming OFC, but here, you also learn from the original codebase (which is in case of Quake phenomenal).
I loved Rockbox on my iPod nano, Then Apple recalled the device due to a battery issue and gave me a 6th gen nano whose signed bootloader meant no more Rockbox.
So if I have to sync songs now on Linux, I need to spin a VM; Sigh.
How things have changed over 25 years or so.
You start with a "What if", and it tends to nibble at the back of your brain. Then it evolves to "Why not?"
You hack it and see the light, or more specifically you fail to find a reason for the "not" part, and you make it.
And yes, there's an immense satisfaction for doing it. Not from "look at me" angle, but from "ach, it was possible, and I made it. It turned out I was capable enough to make it work. Let me get some tea" angle.
I like feats like this. Honestly kudos to them. Both impressive and fun. Delightful, more precisely.
Also, thanks for the kind words!
Along the way, I learned that when "what if?" becomes "I have to", the drive in me just dies. So I've had to learn how to stay in "what if?" mindset even when I have a deliverable I have committed to.
Sometimes, this means picking at a totally unimportant part of a project, getting it working and then—while in the same mental groove—shift to delivering the core feature.
I once ported Quake 1 to the Rockbox operating system for MP3 players, which enabled it to run on the Apple iPod: https://www.youtube.com/watch?v=r6V-4AZ7pkA
The whole world of software ports basically boils down to "anything is possible, given enough memory, pixels, and time". The actual process of porting anything is sometimes incredibly tedious (e.g. "scour the entire source code for unaligned memory accesses, and manually rewrite all of them"), but also gives a chance to do some very clever things (like, "use the piezo speaker to beep out the address of a fault, because nothing else works on the device after a crash").
What made me do it was 1) the satisfaction I got from seeing my work produce something which, at first glance, shouldn't exist (Quake... on an MP3 player?), all while 2) learning deeply about software close to the bare metal, which is fairly hard to do early in one's career. There's of course also the factor of having lots of free time - I did my port when I was still a student with not very many responsibilities, so I could afford to spend entire evenings and weekends poring through mountains of C code. Nowadays, not so much...
How do people do that?
When you take small consistent steps, you can go very long distances at relatively short time.
For the second point on persistence, this guy must have a lot of patience. I've struggled on this actually. If the initial push is strong enough I sit through 3-4 days but at least for me I can't seem to come back and finish it if I put it away for more than a day.
Truly impressive considering all this.
Some people build hot rods or fix old tractors, some people collect all 7,341 achievements in some game, some people catch up on the complete available catalog of Doctor Who, some people go out and bag peaks or train for better times on their marathon, some people grind on their karaoke performance of Tainted Love, some people devote themselves to being close with and available to their kids.
This is a beautiful project, but what makes you feel like the motivation is somehow different here than it is for those?
Are you aware of / had you considered implementing Quake's famous Reaperbot:
https://www.quakewiki.net/quakesrc/56.html
- might make for good demos, I thought?
(Some of the links are old and broken - https://www.gamers.org/pub/idgames2/quakec/bots/ works)
• Gyroscope to look around.
• Scroll crown to walk forwards or backwards.
• Tap anywhere on screen to fire.
(Pushing in the crown to fire isn't possible, right?)
Just wondering—was it on your wrist when you tried it? I'm imagining moving my whole arm up and down, which I can do in sync with my head fairly easily.
And ideally turning around 360 degrees would require physically turning 360 degrees... might need to be played in a swivel chair.
This is demonstrated in the linked video: https://www.youtube.com/watch?v=cPC2o262TfQ
Youre brilliant, you paid for the watch, but you cant use it the way you want because of Apple.
Edit: I have been corrected. 100 dollars buys you 1 year. 7 days is 'for free', so it's basically a tithe.
We would laugh if someone bought a sedan and complained that it can't haul any pallets of goods. Why do we make that complaint for electronics?
It's nonsense.
You might be savvy enough to not be concerned about being fooled into installing malware on your device. But this design decision was not for you.
AFAIK, Quake was originally developed on NeXT boxes and ported to PC later. The level editor was a native app using the NeXTSTEP APIs which Apple renamed Cocoa:
https://quakewiki.org/wiki/QuakeEd
So, it's a fun kind of homecoming that it now runs on the wrist-sized NeXT box.
The original NeXT computer: 25MHz Motorola 68030 plus copro, 8MB RAM, 256MB storage, 300W power usage, $15k in 2021 dollars, weighed a lot
The Apple Watch Series 7: 1800MHz t8301 CPU (but scales up and down), 1GB RAM, 32GB storage, 50-100 mW (I think?), $399, weighs 35g or so
What a difference 33 years makes!
...not very relevant for DOOM of course, because that's just plain C for the most part, but interesting little tidbit nonetheless.
But most importantly, ID software released the original source code for it quite early. Not that many game development companies do that. I would've loved to see more Blood ports, but I don't think the source was ever released? So I believe the existing ports were reverse engineered. Duke Nukem 3D source was only released in 2003 it looks like.
The quality of the source code of Quake 2 is quite high. Doom is.. a bit messy but OK. There are already abstractions that make porting easier. I'm guessing Quake (haven't looked at the source yet) is somewhere in between. That helps too.
Games prior to Quake were bound to specific O/Ss and/or hardware components.
DOOM was still bound to DOS AFAIK, so it's not portable without significant changes.
Older games are even worse - not only they were bound to DOS, but also to the display adapters of the time (CGA/EGA), which required some sort of emulation (or translation, depending on the approach) in order to be ported.
Games based on the Build engine (written by Ken Silverman), like Duke Nukem 3D and Blood are... simply written in very poor form. Carmack is a tidy programmer, Silverman isn't. Quoting Fabien Sanglard:
> Looking at the innumerable ports that spawned Doom/Quake, I was always puzzled to see so few ports of Duke Nukem 3D. The same question arose when the engine was ported to OpenGL only when Ken Silverman decided to do it himself.
The answer is in his analysis: https://fabiensanglard.net/duke3d/code_legacy.php.
John Carmack is awesome. However, to take the next step after Doom, he brought Michael Abrash on board.
Doom was literally developed on NeXT computers (the precursors to modern Macs, ironic considering Doom was single-handhedly responsible for turning the public perception of PCs from boring office machines to cool gaming systems):
https://en.wikipedia.org/wiki/Development_of_Doom#Programmin...
DOOM was always extremely portable, the DOS and PC specific parts are well separated from the other code (DOOM was actually developed on NeXT machines, so separating the platform specific parts probably came naturally).
I remember playing QuakeWorld when it came out, on Linux, over a dial up modem. You had ping times of 200-300ms and it was playable. You have to remember at the time Doom and other games were LAN-only. John Carmack used to keep a .plan file with some really cool details behind Quake/QuakeWorld development. Check out Aug 02, 1996 for some detail behind the netcode[1]. You can read the future of gaming being invented right there.
[1] https://github.com/ESWAT/john-carmack-plan-archive/blob/mast...
That said, it had some things Doom fans dreamt of, like an interactive level editor that was built into the game engine.
Also, wasn't there an official Blood port by Nightdive Studios?
This is also from an era where there wasn't that much abstraction and "software rendering" was the norm so the implementations tended to be much more straightforward, this makes it so that worst case scenario, you just write to whatever the equivalent of a framebuffer is in the target implementation.
There's like 10 glue functions you have to write to do things like initialize your platform, get input, begin the sound loop, call the main loop, and then something to switch buffers to the display. It takes a quite short amount of time to do. Id provides a set of null functions that you can use as a starting place and incrementally add in video support, input, sound, etc. They made it super easy to port.
I've been fiddling off and on making a tiny CM-2 computer model with all the blinking lights on the front panels. Inside it's an rpi zero 2, and I'm using some 1.5", 128x128 SPI RGB OLED displays instead of trying to make itty-bitty LED arrays. Long story short I decided I should be able to run quake and quake2 on the thing. It only took two days to put in enough code to have them running.
This is the highest cost Quake 1 port till now.
I was an Apple customer just like you. Then I took an arrow to the knee. </s*
post>I don't have an Apple Watch but it would be interesting to know what happens when you fire it up on one.
Also debugging would be pain.
And most importantly, performance would be IMHO terrible.
I haven't even though about using WASM, I prefer native code as much as possible. But WASM is actually cool technology in my book :-)
https://web.archive.org/web/20011212074611/https://www.insom...
Maybe I can deathmatch with an apple watch from my nokia symbian 6120.
I'm suprised you get close to 60 FPS in Software Rendering. Is there some form of hardware rendering that could be used aswell on the apple watch?
At least until the CPU starts throttling.
It's not that Apple doesn't allow anything here, they just impose their own T&C which breaches some, but not all, OSS licenses. And the workaround for the former is usually to have the contributors accept a small affidavit, which effectively puts their software in compliance with App Store.
Is there any write-up on that that explains how exactly they did that?
> For example, this is what iSH uses to legally ship an entire x86 Linux userland inside of an app.
An entire userland?! AFIR it only shipped the gnu toolkit, the rest is downloaded from the repositories?
If you copy and distribute the GPLv2 code or a work based on it in object or executable form, you have to do one of:
a) Accompany it with the complete machine-readable source code; or
b) Accompany it with a written offer valid for at least three years to give any third party a complete machine-readable copy of the source code, for a charge of no more than your cost of physically distributing the source; or
c) Accompany it with the information you received to distribute such code, but only if your distribution is noncommercial and you received it in object or executable code.
See GPLv2 section 3.
A developer uploads a copy of their app to the App Store. Apple then makes copies and distributes it when people buy it (for free or for money) on the App Store.
Since Apple is copying and distributing that GPLv2 code, Apple should have an obligation under GPLv2 section 3 to distribute the source. They would not be able to punt this obligation back on the developer via option c because their distribution is not noncommercial.
This is a crucial difference between app stores (and other digital goods stores) and stores selling physical products that contain GPL code.
Best Buy for example does not run into this problem when they sell you a TV that contains a Linux kernel because although they are in fact distributing a copy of a Linux kernel to you they did not make that copy. They received that copy from the TV manufacturer or a distributor and are just passing it along.
Copyright law in most places contains an exception, often called the "first sale doctrine", which states that once the copyright owner releases a particular copy, those who legally obtain that copy can give it away or sell it or rent it without requiring permission of the copyright owner. That covers Best Buy's case.
Unless there is some way to argue that when I but an app on the Apple App Store it is the developer who uploaded the app that is making the copy I get, I'm having trouble thinking of a way to avoid Apple having to handle GPLv2 source distribution if they let third party GPLv2 code on the store.
First party GPLv2 code would be OK, because then the developer owns the copyright and so can grant Apple the rights to distribute it in binary form without source code. (It has been a long time since I've read Apple's developer agreement, but I think it requires the developer to give Apple such rights).
My oculus quest 1 oled display gives no black smears and even so a little smear I can tolerate. Now what lens could I buy to make this work?
Where do you live? A smartphone is $1000 or more.