This game is for PC but odds are that something like 70% of you are reading this on your phone.
So wouldn't it be nice to be able to play the playable web build on your phone too?
Well, I just spent the last 2 days hacking in touchscreen support, so now (maybe) you can!
Touch Gamepad
Most mobile games have control schemes that are totally alien to me: tap on the enemy to jump on the enemy! Tilt left to steer left! Swipe left to see a different potential romantic partner!
Me, though? I'm an old-fashioned guy,1 and I make old-fashioned games,2 so I made an old-fashioned gamepad3 appear on your screen when you first touch it:
The touch gamepad also turns off most of the rest of the game's UI (like the top menubar that is sometimes there), since it would be annoying to accidentally interact with those.
All that did mean I had to rewrite my input handling logic yet again, but on the plus side now when you're playing singleplayer you can also seamlessly swap between keyboard-and-mouse or gamepad (or the touchscreen gamepad). And of course if you press the Start button on a gamepad then a new player will still drop in, using that gamepad. 4
Low Graphics Mode
Unbeknownst to me until now, the performance of this game in web browsers on mobile phones is somewhere between "bad" and "shockingly bad". 5
I mean, it does work, but at about 10-15 frames per second instead of the expected 60 frames a second - possibly because the graphics cards in mobile phones have different characteristics vs desktop graphics cards?6 Or maybe I'm just doing something dumb.
Now obviously I could spend a bunch of time fixing the performance, but extracting performance insights on mobile browsers is extremely painful,7 so instead I added a quick "low graphics" toggle:
I also track the average framerate for the last 2 seconds: the first time that average goes under 25 frames per second it will automatically switch into the low graphics mode. (That happens basically immediately on most mobile devices but you can always switch back & forth if you want.)
Mobile-friendly-ish web build!!
Anyway, does the touchscreen gamepad work for you? Please hit me up and say yay or nay!8
Known issues:
- Some of the text doesn't "fit" properly in its containers: for example, your health bar is always too small to contain the text that tells you how you died. (less of a problem if you run the game in fullscreen mode)
- You can get stuck in touch gamepad mode if you enter touch gamepad mode by clicking the relevant checkbox, and if you don't have a touchscreen then you can't turn it off because you need to specifically touch the "Disable Touch Gamepad" button - oops. Just reload the page in that case.
- Broken lighting: err, I seem to have broken the lighting effects in this web build somehow? Weirdly lighting works when the exact same web build is hosted elsewhere (e.g. works fine if my desktop hosts it), so that's going to be a bundle of fun to figure out!
For certain values of old-fashioned. I still feel like an imposter whenever anyone talks about their old Atari computer or anything like that.
Or at least, I hear that this game gives people retro vibes in a good way (Soldat! Worms! Cortex Command!) and that's good enough for me.
Also, not gonna lie: it would be silly to spend a lot of effort on fancy touch controls when this game is intended to be played with a gamepad or mouse & keyboard.
Because previously the game wasn't even playable on a mobile phone.
I suppose I could have used a bluetooth keyboard or something if I was a real go-getter?
I am no expert, but as far as I understand: mobile graphics cards have a much lower "fill rate" (number of pixels they can draw per unit of time), so they struggle with drawing things over the top of each other - like drawing partially transparent images.
And full floating point precision maths in shader code run on mobile GPUs might incur a performance penalty too, or something like that?
(I do a lot of both of those things)
My in-game profiling UI works, but 1) it's super tiny and 2) the timing information is restricted to "nearest second" granularity.
Normally I can get at least microsecond resolution on timing, even in browsers - or at least I can over in Firefox with some about:config tweaks applied and/or a secure hosted context.
So far I've tested on my touchscreen laptop, Android Pixel 7 (Firefox is ok, Chrome is better - just like on desktop) and on a 4-year-old iPad Air and they all seem to work.
I did run into some issues with touch events not being read properly on Chrome on Android (so e.g. you would tap jump and sometimes it would register as a touch being moved rather than a new touch being started), but I hacked in a workaround and that seems fixed now.