@ikirmikir/game-sdk
v1.3.1
Published
Optional SDK for games on Ikirmikir: loading, gameplay, pause, sound, player context, share, rooms, saves, scores and badges. Works standalone too.
Maintainers
Readme
@ikirmikir/game-sdk
Optional SDK for browser games on Ikirmikir: real loading progress, gameplay start and stop, pause and resume, the player's sound switch, player context (language, device, touch), sharing, multiplayer rooms to play with friends (1.1), Ikirmikir's own interface sounds for menus (1.2.1), and the player, saves that survive new versions, leaderboards with where a score places, and badges (1.3). Any engine that runs in a browser. Outside Ikirmikir it runs in local mode, so one build works everywhere, and no call ever throws.
npm install @ikirmikir/game-sdkimport { Ikirmikir } from "@ikirmikir/game-sdk";
const ik = await Ikirmikir.init({ gameId: "your-game" });
ik.game.loadingProgress(50);
ik.game.loadingDone();
ik.on("pause", () => game.pause());
ik.on("mute", muted => { audio.muted = muted; });
menuButton.onclick = () => ik.sound.play("click"); // Ikirmikir's own click
const { room, error } = await ik.multiplayer.create({ maxPlayers: 2 }); // inside Ikirmikir only
room?.on("message", (data, from) => applyMove(data));
room?.send({ cell: 4 });
await ik.data.set("progress", { level: 3 }); // kept by Ikirmikir, survives new versions
await ik.scores.submit("best", 120); // a board listed for your game
const r = await ik.scores.rank("best", 120); // { week: { place, ahead, of }, all: ... }
await ik.badges.award("hundred"); // a badge listed for your gameWithout a bundler, use dist/ikirmikir.js (gives window.Ikirmikir), from this package or the CDN:
<script src="https://cdn.jsdelivr.net/npm/@ikirmikir/[email protected]/dist/ikirmikir.js"></script>Quick start, API reference and a test tool: https://ikirmikir.com/developers/
MIT license.
