9 ms·
Show HN: Quake 1 ported to the Apple Watch
I ported Quake 1 to the Apple Watch, building on top of existing ports for iOS and Mac.
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
https://www.youtube.com/watch?v=cPC2o262TfQ https://www.youtube.com/watch?v=cPC2o262TfQ
- WheelsAtLarge 4y agoWhat makes Quake so portable? Developer seem to be able to move it to just about any platform.
- audunw 4y agoQuake has a software renderer, that probably helps. 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.
- disordinary 4y agoBlood uses the build engine which was open sourced at about the same time as Quake, there are numerous source ports and it can run on most platforms (although people have gotten it running on mobile devices, there's never been an official port). As nblood is based on eduke32, I'd imagine the only reason it isn't available on more platforms is that no one has volunteered to do it.
- johnlorentzson 4y agoThe Build engine's source code isn't enough to port any game running on it, since Build was made as a library (I believe most developers using Build in the 90s didn't have access to the source code). Also, wasn't there an official Blood port by Nightdive Studios?
- z3phyr 4y agoAlso, the original build code is extremely hard to read!
- smcl 4y agoIt may have been fixed up since but the official ND port had some problems at the time of release (if I remember a civvie11 vid correctly) edit: just looked it out, it seems this has been address. I'm linking the videos because they're entertaining :D vid on the original: https://www.youtube.com/watch?v=EkG29e-nE-A https://www.youtube.com/watch?v=EkG29e-nE-A and the patched version: https://www.youtube.com/watch?v=oFUPNlfWiYg https://www.youtube.com/watch?v=oFUPNlfWiYg
- bluedino 4y agoBuild/Duke was also Ken Silverman's second game. Doom was probably Carmack's 50th That said, it had some things Doom fans dreamt of, like an interactive level editor that was built into the game engine.
- pjc50 4y agoQuake basically pre-dated hardware rendering on consumer hardware. To a great extent, the consumer 3D accelerator market exists because of Quake. https://fabiensanglard.net/3dfx_sst1/ https://fabiensanglard.net/3dfx_sst1/
- taneq 4y agoAaah the brief, heady days of “no serious gamer would use a hybrid 2D/3D card” and the Voodoo fill rate wars. Fun times!
- selykg 4y agoVoodoo... that's a name I haven't heard in awhile... thanks for that fun memory. Those were interesting times.
- deckard1 4y agoQuake and id Software were pioneering things we just take for granted now. 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/master/by_year/johnc_plan_1996.txt https://github.com/ESWAT/john-carmack-plan-archive/blob/mast...
- pizza234 4y agoThe top sibling parent has the correct explanation, however, I'll expand a bit. 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 https://fabiensanglard.net/duke3d/code_legacy.php.
- johnlorentzson 4y agoDOOM was definitely made with DOS in mind, but it also ran on NeXT from the beginning. It's pretty portable actually. Since you cited Fabien Sanglard, I guess I should mention that his book about DOOM's source code (Game Engine Black Book: DOOM) explains how the portability stuff (as well as almost everything else) worked in great detail.
- macintux 4y agoSeveral of us would regularly play it in a Chemistry computer lab on SGI workstations. Annoyed the hell out of the students doing molecular simulations, regrettably.
- flohofwoe 4y ago> DOOM was still bound to DOS AFAIK, so it's not portable without significant changes 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).
- 4y ago
- myownclone 4y agoYes! SW renderer was one of the reasons I chose that! :-) Also, source code for id tech games is so well written, architected and highly readable.
- nodja 4y agoWritten in plain readable C, open source, iconic game. Same with doom. 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.
- galangalalgol 4y agoShould we maybe take that as a lesson?
- pjmlp 4y agoSpecially for those cases that ship a browser alongside the application....
- pavlov 4y agoUnlike most games of the era, Quake was designed to be portable. It's not tied to the PC / MS-DOS platform in the same way as many other cutting-edge games were. For example, there was a lot of x86 assembly used at the time, often just intermixed with C code with no clear boundaries to enable porting to a different architecture. 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 https://quakewiki.org/wiki/QuakeEd So, it's a fun kind of homecoming that it now runs on the wrist-sized NeXT box.
- pjmlp 4y agoExcept the little detail that there is very little NeXT on that wrist-sized box, other than Objective-C is still the main language.
- flohofwoe 4y ago...the OS should be quite similar too, assuming watchOS is anything like iOS and macOS, because macOS essentially is the present day incarantion of NextStep due to the NeXT-Apple reverse takeover ;) ...not very relevant for DOOM of course, because that's just plain C for the most part, but interesting little tidbit nonetheless.
- pjmlp 4y agoExcept plenty of stuff has changed since NeXT days. Objective-C driver kit no longer exists, its C++ replacement is on its way out, being replaced by a userspace version. The watch uses watchOS UI KIT, is isn't either UI Kit nor Cocoa, so three generations apart from NeXTSTEP UI framework, which is anyway being replaced by SwiftUI. watchOS uses a customized version of bitcode as deployment format, which is now being transitioned to actual native code in upcoming versions. Related to Doom, watchOS doesn't do OpenGL, or NIB files from Project Builder. So almost nothing like NeXTSTEP.
- smm11 4y agoFor a brief moment NeXT was trying to spread Openstep far and wide. What a future everyone could have had, rather than those locked into the Mac ecosystem. Which is most in this country, actually, so same thing I guess.
- Cthulhu_ 4y agoIt helps that Carmack is a talented coder too.
- myownclone 4y agoI have chosen Quake because (arbitrary order): * great game * codebase is well written, highly readable, well architected, there are tons of documentation and also a lot of existing ports to look at for inspiration and reference * SW renderer -> meaning it runs everywhere, rewriting GL renderer to Metal or anything HW accelerated would be much more work
- wang_li 4y ago>What makes Quake so portable? 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.
- LeoNatan25 4y agoThis is truly awesome! Not necessarily the ergonomics, but the power these tiny devices have and the dedication people still have to the classic id classics.
- deleted 4y ago[deleted]
- dtx1 4y agoAbsolutely brilliant, that is so cool! 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?
- deleted 4y ago[deleted]
- vardump 4y agoI wouldn't be surprised to see optimized (using NEON, etc.) Quake 1 running at 600 fps software rendered on Apple Watch. At least until the CPU starts throttling.
- dtx1 4y agoit's always suprising to me what modern processors can do when you remove the endless layers of abstraction we see in modern development.
- jrootabega 4y agoI'm young enough that this is not surprising ("Sure, it's a device and a game; this is one possible device/game permutation."), and old enough that it makes me kind of angry because it seems impossible and I think it might be witchcraft.
- boguscoder 4y ago*watchcraft
- mikrl 4y agoFrom my dad’s CRT monitor back in the day, to the OLED distraction machine on my wrist. How things have changed over 25 years or so.
- smoldesu 4y agoIf Doom can run on an STM-32, then an Apple Watch CPU seems like a shoo-in.
- sgt 4y agoIncredibly cool. I can't wait to put this on my Series 6.
- deleted 4y ago[deleted]
- fsflover 4y agoCan it be also ported to PineTime, the open-source watch? https://www.pine64.org/pinetime/ https://www.pine64.org/pinetime/
- LeoNatan25 4y agoThe COU on that watch seems quite less powerful, so perhaps quake is not the best game for that hardware. Maybe Doom :-)
- sordina 4y agoIs there a technical reason why this couldn't be put on the app store? I've seen reference to Apple not allowing certain OSS code but never seen that confirmed so I'm curious!
- carl_dr 4y agoIn this case, the assets are licensed under a non-permissive license, so even if the code was a non-issue, that's the problem.
- imhoguy 4y agoAssets could be possibly downloaded from 3rd party site on user consent.
- yreg 4y agoAn app that doesn't work until you use it to pirate something? Yeah that wouldn't fly in App review.
- fetzu 4y agoI understand the intricacies of it in terms of the App Store, but I don’t think grabbing Quake’s shareware assets qualifies as pirating.
- Cthulhu_ 4y agoYeah but 'user consent' don't make using assets legal.
- flohofwoe 4y agoIt's probably legal for the 'shareware episode' assets (same for the Doom shareware version), although I guess it's better to let a lawyer dissect the license just to be sure: https://www.quakeworld.nu/wiki/Quake_Shareware_License https://www.quakeworld.nu/wiki/Quake_Shareware_License
- LexGray 4y ago
- mrweasel 4y agoSeems inconvenient in terms of navigation. The 60fps is pretty impressive, that and the fact that it actually fit on the watch at all.
- Tempest1981 4y agoUsing the gyro seems convenient.
- myownclone 4y agoThank you! And yes, controls are not convenient.
- habibur 4y agoRemembering : In the 90s, when it came out, I couldn't run Quake 1 on my desktop PC as it required 6 MB of RAM, and I had only 4 MB installed.
- hparadiz 4y agoWhat year was that? I got a Pentium 1 166mhz with 16MB of ram in 1995. Cost my parents $3000. Later we upgraded the RAM and for a while I was running a weird 80MB of RAM configuration (16 + 64).
- Sharlin 4y agoAny Pentium would have been considered high end when Quake came out. Most people were still running 486s, and it caused some consternation that Quake practically required a Pentium to run smoothly (as the renderer’s inner loop was written to exploit the P5’s superscalar architecture).
- forgotusername6 4y agoA friend had a DIY water-cooling system with a bucket and some ice to play quake on an over clocked 486
- brailsafe 4y ago$3000 in 95 was a hell of a lot of money. I don't think my parents ever had that much in savings. $3k now is a hell of a lot of money, my parents still don't have that much in savings and I'd really hold out for a stellar upgrade in that range.
- theplumber 4y ago>> $3k now is a hell of a lot of money Where do you live? A smartphone is $1000 or more.
- detaro 4y ago
- fsiefken 4y agoI wonder if you could mount the apple watch to your left eye and play quake with gyro (in a dark room for immersive effect). Perhaps you could map an audio stop start controller as gun. I once used a 640x480 monocular micro-display (with lensing to around 1x1cm)
- eru 4y agoThere seems to be some latency on the gyro?
- danielbln 4y agoEven the bigger Apple watch only has a resolution of 312 x 390. If you slap a lens in front of that to blow the image up to your FOV, you'll have a pixel soup with a massive screen door effect, I don't think it'll be feasible. Also, no time warp and I doubt this runs at 60+ hz, so it'll make you nauseous in no time. Last but not least, it's an OLED so there will black smear in addition to everything else.
- fsiefken 4y agoIt's a bit more at 396x484, the massive screen door effect works against nausea, and even with a lens in front, floating in the distance like a huge living room tv it would be playabale for me. I imagine it to be a bit like playing doom at 320x240 like this https://www.youtube.com/watch?v=uWpWOoKFdeE https://www.youtube.com/watch?v=uWpWOoKFdeE - 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?
- totetsu 4y agoDoes it connect to quakeworld servers? Maybe I can deathmatch with an apple watch from my nokia symbian 6120.
- deleted 4y ago[deleted]
- eru 4y agoI wonder why the binaries can not go on the app store? Is it because of the assets?
- deleted 4y ago[deleted]
- myownclone 4y agoExactly. Code is OSS, but assets are still copyrighted.
- kinard 4y ago
- nasir 4y agoIf you're having fun why not? Solving such a technical challenge is incredibly satisfying.
- destraynor 4y agoI absolutely love it, well done!
- myownclone 4y agoThanks a lot!
- xyzsparetimexyz 4y agoNext step should be writing a HW renderer for it with Metal.
- implements 4y agoCool! Are you aware of / had you considered implementing Quake's famous Reaperbot: https://www.quakewiki.net/quakesrc/56.html 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/ https://www.gamers.org/pub/idgames2/quakec/bots/ works)
- myownclone 4y agoThanks! Great suggestion! There is actually demo running at the end of the video, so the usual quake AI and different enemy archetypes work just fine for single player. I did not think about the ability to play MP arenas with bots, though. And from what I heard, Reaper bot is the best, that's a great idea!
- dom96 4y agoCool, though I wonder if you could get away with compiling Quake to WASM and running it in Apple Watch's browser. Perhaps the FPS there would have been far too poor.
- marcusjt 4y agoIt already exists, see http://www.quakejs.com/ http://www.quakejs.com/ I don't have an Apple Watch but it would be interesting to know what happens when you fire it up on one.
- myownclone 4y agoInteresting idea! Watch does not have system browser, there is kinda something like web view (I think) and also some browsers exist on App store, but integrating this with digital crown and gyro would be far harder. 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 :-)
- dom96 4y agoYeah, you can get a web view by asking Siri to search for something. I was able to get my JS game (https://stardust.dev/ https://stardust.dev/) running on it[1], but it was pretty slow (though it's not particularly well optimised, nor does it use WASM). 1 - https://twitter.com/d0m96/status/1356670213090066432 https://twitter.com/d0m96/status/1356670213090066432
- pgt 4y agoHow about using the digital crown to move forward/backward and then three buttons: [Left] [Fire] [Right] so you can play with three fingers on your Watch?
- 988747 4y agoHow precise is the gyroscope in Apple watch? Can you turn on constant movement in Quake, and then just use watch movements for turns/aiming, and the side button/screen tap for fire ?
- Gigachad 4y agoExtremely accurate. You might be surprised how much. They have a feature where you can use the watch one handed without touching the screen https://www.youtube.com/watch?v=UFCGfyHSbFM https://www.youtube.com/watch?v=UFCGfyHSbFM
- myownclone 4y agoI have tried digital crown for this, but it was not too good to use. But thanks for suggestion!
- ThrowawayTestr 4y agoI love the use of the crown!
- jbverschoor 4y agoAlmost 5 years ago I ran Quake on the Sharp Zaurus 5000D
- myownclone 4y agoOh, huge respect, sir!
- jbverschoor 4y agoI meant 15 years go of course. But it's already 20 years ago.. https://web.archive.org/web/20011212074611/https://www.insomniq.com/files/zaurus/shots/quake.html https://web.archive.org/web/20011212074611/https://www.insom...
- TedDoesntTalk 4y agoCan apps be side-loaded onto the Apple Watch?
- kaba0 4y agoI guess with the same limitations as on the iphone - with a developer account for 7 days before you have to relicense it.
- myownclone 4y agoYes, I think you are right.
- howon92 4y agoWhen people ship impressive stuff like this, I can’t stop wondering what motivated them to 1) work on it for free 2) have the persistence to finish it. Incredible feat
- bane 4y agoPeople who do this kind of stuff don't think of it as "free" necessarily. It's highly rewarding at the most abstract, but more tangibly develops skills that make them more valuable in the workforce, allowing them to demand very high salaries from top companies.
- myownclone 4y agoYes sir, you are right, exactly :-) This is highly rewarding in and of itself. + learning experience.
- Onewildgamer 4y agoJust the excitement to see it done, for the sake of it. I think money won't even remotely come to mind. 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.
- green-salt 4y agoThat endorphin rush when you finally get something interesting running is sublime
- leidenfrost 4y agoAs a web developer, I'm kinda jealous of how someone can just say "I'm gonna make this device this specific nostalgic game I love" and then just do it. How do people do that?
- 4y ago
- effdee 4y agoCan't wait for the speedruns.
- myownclone 4y agoLOL!
- Baopab 4y ago
- boppo1 4y agoWhat do you do for a living, and how much time (in hours) did this take to achieve?
- myownclone 4y agoI am a game/AI developer / ML researcher, this was just passion project of mine and it was... tens of hours, I do not have the exact numbers. But the biggest setback, which took most of the time, was the audio issues, I thought all the time that my audio backend code is wrong, but it was Watch speaker not liking low freq noise. This on itself could take cca 10-20 hours, I have tried a lot of things before realizing the above mentioned fact.
- fezfight 4y agoAnd of course, to run this yourself, you need to pay Apple 100 dollars for a developer account and even then, the app will delete itself after 7 days. 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.
- kube-system 4y agoIt's not a developer tool. It's a consumer product. 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?
- fezfight 4y agoBecause that's not equivalent to what's happening here. In this scenario, we bought a 'luxury' sedan (apple watch) that is able carry goods (quake 1) but Toyota wants you to pay them $100 dollars a year for permission to do that (dev account). And they get to decide what goods you're allowed to carry (app store). It's nonsense.
- kube-system 4y agoIt is an intentional security design choice to make it difficult to run software outside the walled garden. 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.
- omegalulw 4y agoCome on, burying side loading in a setting and having a giant red warning is good enough to keep the vast majority of users out of using it. No reason they can't offer that technically.
- kube-system 4y ago
- gopaz 4y agoAny testflight link?
- Wowfunhappy 4y agoI know this is more of a tech demo, but my mind immediately jumps to what sort of controls would be most playable. Have you tried something like: • 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?)
- nathanasmith 4y ago>Gyroscope to look around. This is demonstrated in the linked video: https://www.youtube.com/watch?v=cPC2o262TfQ https://www.youtube.com/watch?v=cPC2o262TfQ
- Wowfunhappy 4y agoYes, but in the video it's mapped differently. Gyro left and right looks left and right, but gyro up and down walks forwards and backwards.
- myownclone 4y agoThanks for suggestions! Pushing the crown invokes system UI. * gyroskope to look around: I did try some of it, but it also means that you have to tilt the watch on more axes which usually means you tend to have worse eye contact with the surface of the display. * scroll for walking: I did try, but it wasn't much satisfying to use (I mean even worse than the other controls here :-D) * tap anywhere to fire: good idea!
- Wowfunhappy 4y ago> gyroskope to look around: I did try some of it 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.
- theunamedguy 4y agoFinally, something that I can speak to! 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 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...
- myownclone 4y agoHuge respect! I think that porting Quake like you did is much more impressive feat than my port to the Watch! 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).
- Abishek_Muthian 4y agoAmazing work! 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.
- app4soft 4y ago> you need to have connected Apple Watch (via the iPhone) to your Mac and you can build the game yourself. This is the highest cost Quake 1 port till now.
- vl 4y agoI forgot what a great game Quake is. Gonna replay it. Looks like it's available on Steam!
- sleight42 4y ago<s*post> Got here just in time to muse about when we'll see Skyrim on an Apple Watch. I was an Apple customer just like you. Then I took an arrow to the knee. </s*post>
- Cryptonic 4y agoFinally a reason to get one.