Metaplay AI
SamplesPricing

Sample game

Real-time multiplayer strategy sample

A real-time multiplayer strategy game whose web and Unity clients connect to the same server and share the same C# game logic.

Genre
Strategy
Client
Blazor WebAssembly and Unity
License
Apache-2.0
Core Metaplay features
  • Clients on different engines
  • Multiplayer entities
  • Matchmaking
01

What it is

Megaton is a real-time free-for-all on a 3D globe, in which nations launch missiles at each other's cities. CPU nations take the seats that no player fills.

It's worth exploring if you're building a real-time multiplayer game, or one game for more than one engine. A Blazor WebAssembly client in the browser and a Unity client connect to the same server and share the same game logic code, and the server keeps full authority over every match.

02

Core features in the game

// the_same_match_in_the_web_client_and_the_Unity_client

Clients on different engines

The same moment of one match in the web client, in a browser, and in the Unity client, in the Unity editor. Both connect to the same server and share the same game logic code.

03

What it shows about Metaplay

Each system in the game maps to a Metaplay feature. The label under each card names it and links to its page in the Metaplay docs.

Clients on different engines

A Blazor WebAssembly client in the browser and a Unity client connect to the same server and share the same game logic code. They also share the client code that decides what each screen shows. Only the presentation is engine-specific: each client has its own UI, input handling and globe rendering.

Blazor Starter Project(Metaplay docs, opens in a new tab)
Real-time multiplayer gameplay

Players fight live matches of four nations. Each match is a multiplayer entity on the server, which the server and every client in the match run in step. A player who loses the connection rejoins the same match.

Multiplayer entities(Metaplay docs, opens in a new tab)
Deterministic shared game logic

The match rules and CPU nations are C# code that runs identically on the server and every client. The server has full authority: it validates every launch before it runs for anyone, so a modified client cannot cheat.

Game logic execution model(Metaplay docs, opens in a new tab)
A matchmaker that always starts a match

A matchmaker entity on the server holds the queue, forms a match when enough players are waiting or when a player chooses to start, and fills the empty seats with CPU nations.

Custom entities(Metaplay docs, opens in a new tab)
Fully end-to-end tested

The match rules and the shared client code run in headless tests, with no engine or browser. The end-to-end tests are written once and play each scenario on every client against a real server, including a match with both clients in it.

Automated testing(Metaplay docs, opens in a new tab)
04

Explore this sample

Read it on GitHub

The full source code is public on GitHub. The README explains how the game is built and how to run it on your own machine.

Ask your coding agent

Prompt

Read the Megaton sample at https://github.com/metaplay-shared/samples/tree/main/Samples/Megaton and explain how it is built on Metaplay.

05

More samples

All samples→
Real-time multiplayer card sample gameplay

Card game

Real-time multiplayer card sample

A four-player real-time card game where the server owns every deal, with a full live-service layer around it.

Blazor WebAssemblyExplore→
Turn-based PvP collectible card sample gameplay

Collectible card game

Turn-based PvP collectible card sample

A two-player PvP collectible card game where the server runs every rule and both browsers replay the same C# actions.

Blazor WebAssemblyExplore→
Server-validated real-time runner sample gameplay

Autorunner

Server-validated real-time runner sample

A one-button ninja autorunner that runs in the browser at 60 Hz, with the server validating every run to decide the time that counts.

Blazor WebAssemblyExplore→