HTML5Canvas 2DWeb AudioMRAIDPlayable ad
Controls
- Drag to move the scope (arrow keys or WASD on the focused game); the first touch starts the ad clock
- Tap, press Space or use the Fire button to shoot; the scope sways and the wind pushes the bullet, so lead your shot
- Hit the gunman, never the hostage; three windows, one rescue each
- The Install button is always on screen and calls the exit API of the chosen network; the end card comes up after the last window or at 30 seconds of play
- Pick AppLovin, Unity, Google Ads, Meta or Browser to change the mock SDK the ad runs against
- Rotate switches the phone between portrait and landscape; Hide ad simulates the ad leaving the screen so it pauses and mutes; Backup shows the static image
- The mute button in the corner silences everything; sound starts only after your first touch
Works in current Chrome, Safari and Firefox on phones and desktops; Canvas 2D and Web Audio in a sandboxed frame, no WebGL and no external requests, one small HTML file. Sound needs a tap to start, as every browser requires. Respects the reduced-motion setting: no scope sway, screen shake or flashes. The ad-network SDKs on the page are mocks with the real names and call shapes. Sniper Rescue is a fictional game made for this example.
Questions
Is Sniper Rescue a real game?
No. It is a fictional game in the style of hostage-rescue sniper ads.
What does the player do?
Drag to aim through a rifle scope against sway and wind, and shoot the gunman in each lit window without hitting the hostage.
Does it use a game engine?
No. It is Canvas 2D with synthesised sound in one self-contained HTML file.
Which networks does the demo simulate?
AppLovin, Unity, Google, Meta and a plain browser, with a checklist of the rules networks check.
How it’s built
A hostage-rescue sniper playable, the shooter pattern behind Pure Sniper and War Sniper ads (one of the themes on the 67 playables 24Play lists on its playable-ads page, next to block puzzles and aim-and-shoot sports). It is built the way ad networks take playables: one self-contained HTML file that starts when the network says it is ready, is playable at once and ends on an install card. The page runs it inside a phone on a mock ad network, so every rule a network checks is visible while it plays. Sniper Rescue is a fictional game made for this example.
The playable
- Source in
src/playables/sniper-rescue/, built by node scripts/build-playable.mjs sniper-rescue (rolldown bundles game.ts to one minified script, the styles are inlined) into public/lab/ads/sniper-rescue/index.html. No image, model or audio file and no external request; backup.jpg is a frame of the ad itself. npm run ads measures it and checks the playable rules. - Flow: a rifle scope over a night-city facade; the first touch starts the run and the ad clock. Three lit-window scenes, each with a masked gunman holding a hostage who stands in front of him, wind (calm, then a pull to each side), scope sway and a 9 s patience bar. Two misses make the gunman panic. The last kill plays a slow-motion bullet cam. Hitting the hostage, running out of time or a panic ends the run; the end card shows a case file with up to three stars. The end card is forced 30 s after the first touch.
- All rules are in
logic.ts (unit-tested): the scene script, aim limits, wind drift, hit tests (the hostage is checked first), the patience clock and penalties, and the stars. scene.ts draws the facade, window, figures and scope with Canvas 2D. - Sound is Web Audio only (
src/playables/shared/sfx.ts): synthesised shots, hits and jingles. It starts on the first gesture and has a mute button. - Controls: drag the scope, arrow keys or WASD on the focused canvas, tap, Space or the Fire button to shoot. Reduced motion: no sway, shake or flashes.
Network behaviour
- Shared with the other 2D playables in
src/playables/shared/host.ts: the ad waits for the SDK (MRAID ready, then viewable), pauses its loop and sound when it is not viewable, and the Install button calls, in order, mraid.open(url), ExitApi.exit(), FbPlayableAd.onCTAClick() and window.open(clickTag). - It reports what happened with
postMessage (ready, first touch, each shot, outcome, end card, install taps, pause and resume) and the preview lists the numbers carried in detail.stats.
The preview page
- The phone, mock SDKs, ad clock, session counters and ad-ops checklist are the shared
PlayablePreview component (src/components/lab/playable-preview/); this folder only passes the copy, the theme and the four counters.
Honest limits
- The SDKs are mocks with the real names and call shapes, not the networks' own code. Check each network's current size limit and review rules before trafficking.
- The store link is a placeholder search on Google Play, because the game does not exist.
- The sound could not be judged by ear in an automated run; frame rate was not measured on a range of real phones.