Phaser is browser-native -- no build step required. Load the engine from a CDN, write your game in an ES module, and run it with wavedash dev.
Setup
Create a web/ folder with two files: index.html and main.js.
web/index.html
Load Phaser 3 from CDN, add a container div, and include your module:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>My Phaser Game</title>
<script src="https://cdn.jsdelivr.net/npm/phaser@3/dist/phaser.min.js"></script>
<style>
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; }
#game-container { width: 100%; height: 100%; }
</style>
</head>
<body>
<div id="game-container"></div>
<script type="module" src="./main.js"></script>
</body>
</html>
web/main.js
Await the SDK, create your Phaser game, fill the progress bar, then init() (which dismisses the Wavedash loading screen):
const WavedashJS = await window.WavedashJS;
class MyScene extends Phaser.Scene {
create() {
// ... game objects ...
}
update(time, delta) {
// ... game logic ...
}
}
const game = new Phaser.Game({
type: Phaser.AUTO,
parent: "game-container",
width: 800,
height: 450,
scale: { mode: Phaser.Scale.FIT, autoCenter: Phaser.Scale.CENTER_BOTH },
scene: MyScene,
});
WavedashJS.updateLoadProgressZeroToOne(1);
WavedashJS.init({ debug: true });
window.WavedashJS is a Promise injected by wavedash dev. Using type="module" on the script tag gives you top-level await.
Call updateLoadProgressZeroToOne(...) with intermediate values during async asset loading. init() automatically signals load completion, so call it last.
wavedash.toml
game_id = "YOUR_GAME_ID_HERE"
upload_dir = "./web"
SDK features
Once initialized, WavedashJS exposes leaderboards, achievements, stats, and user data:
const user = WavedashJS.getUser();
await WavedashJS.uploadLeaderboardScore("high-scores", score, true);
WavedashJS.setAchievement("first_win");
await WavedashJS.storeStats();