Explorer’s Lab › Tower Blast › Build log
Build log
Tower Blast in the browser, from the same Unity project
The mobile game was exported from its own Unity project to static web files (19.8 MB) that need no server configuration. It has a custom start page, browser-specific fixes, and a listing upgraded from mobile-only to "Play in browser".
Goal
Derek asked for Tower Blast “exactly as it is”, playable on this site from a sub-folder, self-contained, with no special server configuration.
What was done
- Approach. The game is a Unity Web export, not a rebuild in three.js or Rapier. The star targets and charge budgets were tuned against Unity’s PhysX collapses, and the browser runs the same PhysX build. A web-engine rewrite would also have meant porting roughly 5,800 lines of game code and rebalancing every level.
- No server configuration. The files are compressed with gzip, and the page’s own loader decompresses them, so plain static hosting works. A server that adds
Content-Encoding: gzipfor*.unitywebwould make startup faster, but it’s optional. - Browser fixes in the Unity project:
- AdMob is off in browsers. Phone browsers report themselves as mobile, which would otherwise have started it.
- Frame pacing is left to the browser’s
requestAnimationFrame, instead of the app’s fixed 60 fps target. - Tilt aiming is offered only in phone browsers. Desktop Chrome exposes an orientation sensor it can’t grant, and that produced a console error.
- Haptics use
navigator.vibratewhere it exists (Android). Elsewhere Settings shows “Not available”. - Music waits until its audio has decoded before playing. This stopped hundreds of “sound not loaded” console messages at startup.
- The browser uses the same quality level as the phones.
- Start page (a Unity Web template): title, controls for mouse or touch, loading progress, a Play button and a link back to
../.- The Play tap also asks an iPhone for motion permission and unlocks audio.
- The canvas fills the window and renders at no more than 2× device pixel ratio.
- Download size. Medium managed stripping, size-optimised IL2CPP code and “Disk Size with LTO” cut the download from 25.3 MB to 19.8 MB (code 11.2 → 6.6 MB).
- Listing.
kindchanged frommobiletostatic, andwebadded to platforms.- New fields: controls, how to play, an icon, a hero image and five store screenshots.
- Store links are still empty, because neither store listing is live yet.
What broke / dead ends
- Unity’s default page added a footer bar and a “not supported on mobile” style banner. It was replaced by the custom template.
- A CSS specificity bug in the first template showed the mouse and touch control lists together. Fixed.
- Lower-bitrate music for browsers didn’t work. The importer override set for the web platform left the import files unchanged. It was dropped, because the download was already under the 25 MB target, and the music now matches the apps.
- Frame rate couldn’t be measured in the hidden preview pane, because the browser throttles background pages.
Human interventions
Derek chose the plan and asked for it to be completed in one pass while he was away. He didn’t change any code.
Verification
- Desktop browser (plain Python static server with no headers): the game loads and Level 1 plays to a clear in 4 shots, through the replay and the result screen. A reload then shows Level 2 with the Level 1 result. Settings survive a reload.
- Console: no errors or warnings in desktop play.
- Phone width (375×812, Android user agent): the start page shows touch controls, and the portrait Home and gameplay HUD match the app. The emulated phone does log “No permissions to use RelativeOrientationSensor”, because the desktop browser can’t grant motion sensors.
- Site:
npm run buildandnpm run checkpass. That covers all manifests, 58 crawled URLs, and thetower-blast/playsmoke test (basic test: nowindow.wolfWorld). - Unity tests (in the editor):
- EditMode: 126 of 126 passed.
- PlayMode: 394 passed, 1 failed and 1,100 were skipped by the project’s own settings.
- The failure is
EveryGeneratedFamilyCanClearAtHigherBand(Generated Cross had 17 units left after 14 shots). The project’s music notes already record this test failing intermittently, including on code that predates the web changes. The web changes don’t touch physics or shot logic.
- Not verified:
- real phones (iPhone Safari motion aiming, Android vibration and sensors, frame rate during big collapses on a mid-range phone)
- Firefox
- Safari on macOS
Next steps
- Test on Derek’s iPhone and Moto. If tilt aiming misbehaves in a phone browser, consider defaulting phone motion off on the web.
- Add the App Store and Google Play links once the listings are live.
- Optionally ask the sysadmin to serve
*.unitywebwithContent-Encoding: gzip, for faster startup.