Converting Pokemon Walk to HTML5/WASM
Background
As you may have heard, Google intends to lock down Android the same way Apple locked down iOS. Sometime in 2027, you will not be able to install any app that Google has not been provided to sign and track, which requires the developers to provide significant identification for as well. I moved to itch.io because Google had no actual need for my drivers license, and now that they're going to lock me out of this path as well I had to make a choice.
Option 1 was to capitulate and sign every app. I didn't.
Option 2 was to make a launcher and content packs. I'd still have to get the launcher signed and get ID'd, but other people making PraxisMapper games wouldn't have to. I still balked at this.
Option 3 was to make my games HTML5 browser apps. This sounded like the biggest technical challenge, possibly finding show-stopping bugs or incompatibilities that would render the games unusable, plus potential UI reworks for the new environment. On the upside, this would allow my games to work on iOS for the first time, and any other fun OS setups with location services available.
Option 4 was to drop PraxisMapper and move on to other projects. This wasn't an option I wanted to do as much as the results when all other options were exhausted.
Execution
I went to check into Option 3, and I was way off. It took an hour to make a simple proof-of-concept that dumped GPS info on-screen, and another hour to get Pokemon Walk and PraxisGodotComponents running in a browser with location data.
Hooking up location data for an HTML5 game in Godot is actually pretty easy. I had to make a custom HTML shell with an extra script block that's 40 very simple lines long. Acquire a wake-lock so the screen stays on, start listening for location data with high accuracy, event listener to save location data to a variable. Godot-Side, I call a function to activate the location listener, and I set a timer to call a function that uses the JavaScriptBridge to read that local variable and copy it to one in GodotScript every half a second to match the Android plugin's timing.
That's it. The entirety of code changes needed to get the core library working again is only slightly more character than the paragraph you just read explaining them. Everything else Godot-wise just worked. It even downloaded map data and drew tiles on demand in the browser. It was dramatically slower than as a native app, but it worked with no changes to the code. My mind was blown, huge credit to the Godot engine and its contributors for making this open source, free project so amazingly robust across dramatically different export targets.
Testing
So with that in place, it's time to discover what other issues and steps needed taken to actually make things work. Surely it's not that simple, right? Nothing in code is. There's always something undocumented or unknown that's going to cause issues, right? The first thing that happened is hosting on itch.io broke things. Everything worked fine when I ran the app from the same server as the map data. Itch blocked network calls because of CORS, which is standard web security stuff there was no need to consider until now. A header update on my server fixes that.
The next most obvious issue is that orientation data is no longer available. The calls to read sensors do not work on HTM5 in Godot, and Javascript doesn't have a simple API to grab which direction the device is facing (I guess advertisers haven't figured out how to make money from that particular bit of user data yet). This can be fixed by pulling the info from the location data, since it's part of the GPS location response. That reveals another issue, of course.
Browsers, apparently, don't run location updates as often as other native apps, even with high accuracy on. Playing Pokemon Walk native on a bike or in a car gives you a steady set of updates and sound effects, because you're getting location updates at the requested pace of every half-second or half-meter from the native plugin. In the same setup, on the web, you will get an updated every 2-5 seconds in motion.
I am uncertain if this is something the app can adjust or control, or if this is entirely at the whim of the browser/OS. It's not a showstopper for PraxisMapper at its core, but Pokemon Walk specifically is set up that things happen when you move far enough, and if movement updates are 5-10x less frequent it will need some reworking of that plan. Further testing will happen, and it may be that if this is a timing thing, it won't affect walking gameplay very much at all.
I also noticed that place detection was not functioning in the web port. This is a feature most locative games don't do, and is more or less an exclusive feature to PraxisMapper. I am not sure why this did not work immediately, given it's the same data used to draw the map tiles. This will take some investigation as well, but since map tiles function I have high confidence that Places can be identified again in-game.
Summary
I was afraid that locking down Android was going to cut out my hobby project entirely, and instead it was the push to make it available to a whole new audience of users. Thing weren't nearly as complicated as I expected, though there are some smaller issues still to work out like I expected. PraxisMapper will continue on, pushing boundaries for what location-based games can do and making them easier to create.
Get Pokemon Walk
Pokemon Walk
Explore the real world with Pokemon in this fanmade location based game
Status | Released |
Author | Cerol |
Genre | Adventure |
Tags | Casual, Godot, location-based, Open Source, pokemon |
Languages | English |
More posts
- Pokemon Walk is now a WebApp!8 days ago
- Pokemon Walk V14 Released52 days ago
- Pokemon Walk V13 Released - Buddy Candy Fixes68 days ago
- Pokemon Walk V12 Released! Significant bugfixes!69 days ago
- Pokemon Walk V11 Released72 days ago
- Pokemon Walk V10 Released - Shinies!73 days ago
- Pokemon Walk V9 is releasedMay 28, 2025
- Pokemon Walk Release 8 is out!May 10, 2025
- Pokemon Walk Release 7 is Out!Apr 18, 2025
Leave a comment
Log in with itch.io to leave a comment.