Focus on your game, and let our SDK handle servers, sockets, and syncing game state between players.
Sound crazy? This same SDK powers all Onmuga games–which are played by thousands of humans each month.
Our Javascript SDK offers utilities for managing rooms and syncing game state between all players in a room.
Here's a sample of what this might look like:
// Initialize the SDK client for your game
const sdk = new SdkClient({
apiKey: 'YOUR_API_KEY_HERE',
game: 'yourgame',
});
sdk.on('gameStateChanged', (stateKey, state) => {
// Re-render your app with new game state
});
sdk.on('usersChanged', (users) => {
// You may want to re-render your user list here
users.forEach(user => {
// user == {
// connected: true,
// id: "ly3YHy5GZ9Pw",
// username: "foo"
// }
});
});
// Check if a username exists already from a previous sesssion
let username = sdk.getUsername();
if (!username) {
username = window.prompt('Select a username');
sdk.setUsername(username);
}
// Up to you to decide on how room IDs are stored in URL, then extract them appropriately
let roomId = getRoomFromUrl(window.location);
if (!roomId) {
roomId = window.prompt('Enter a room ID or leave blank to create a new room');
}
if (!roomId) {
sdk.createRoom(username).then(onJoinRoom);
} else {
sdk.joinRoom(roomId, username).then(onJoinRoom);
}
function onJoinRoom(response) {
console.log(`Joined room ${response.roomId}`);
// We'll update game state here for illustrative purposes
sdk.updateGameState('default', {
...sdk.getGameState('default'),
newestUser: username,
});
}
Our platform is currently in beta.
Developers in the beta will be invited to a private Slack/Discord group where we can work together closely to help you develop your game.
We don't have set prices yet, but we'll work with you to figure out something mutually beneficial.