John Carmack Profile picture
AGI at Keen Technologies, former CTO Oculus VR, Founder Id Software and Armadillo Aerospace

May 19, 2021, 7 tweets

Before the iPhone existed, I worked on a few games for what were called "feature phones": Doom RPG 1&2, Orcs&Elves 1&2, and Wolfenstein RPG.
Qualcomm's native-code BREW platform had better versions, but I haven't seen any emulators and archives for it, so they may be lost at \

this point. The J2ME (java mobile) versions are still floating around, and can be emulated.
My son wanted to get O&E2 running, so we set out on a little adventure.
Kemulator ran the game, but audio was glitchy and it hung after you died in game. Well, we are programmers, we \

should be able to fix it. Unlike most emulator projects, Kemulator turned out to be closed source abandonware, so we moved over to freej2me, which is a live github project.
The hang didn't happen, but audio was even worse. Missing sound effects was a simple bug fix -- \

MIDI sounds weren't seeking to the start on replays. We will submit a patch. Still, everything was glitchy with audio underruns.
We noticed that the emulator was taking an absurd amount of CPU, despite the game being built for <100 MHz mobile CPUs. \

We spent a frustrating afternoon exploring java profiling tools, but finally, Flight Recorder and JDK Mission Control pointed out the root cause: explicitly invoked garbage collection. A vague memory of having to call system.GC() every frame to avoid problems on some mobile \

phones bubbled up. We couldn't change the source on the game, but the jvm has a handy option -XX:+DisableExplicitGC that fixed everything right up.
This is an interesting case where an operation is >10x slower on a modern computer. \

A GC sweep on a phone with 128k of heap is a very different thing than a desktop with a multi-GB heap.
Some old writing about the early cell phone work:
web.archive.org/web/2006050217…

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling