Plugin to Colyseus for easy development with Rivet.
See a more detailed example here.
import { listen } from "../src/index";
export default listen({
async initializeGameServer(gameServer) {
gameServer.define("chat", ChatRoom).enableRealtimeListing();
},
});
The test server is used for manual testing for development. For more comprehensive examples, check out the Colyseus examples repo.
Project setup
- Create a game on the Rivet Developer Dashboard
- Install the Rivet CLI
- Run
rivet init --recommend
to link your game
Running
- Run the server in one terminal:
yarn run test-server
- Copy the token from the line that starts with "[Rivet] Token:"
- Run the test client here
What happened to initializeExpress
?
Rivet game servers run only game code and nothing else. We support deploying static content with Rivet CDN.
If you need to run a custom API server, take a look at Fly.io or Railway.
Why not use the existing MatchMakerDriver?
The provided MatchMakerDriver
interface by Colyseus is too rigid to use in conjunction with Rivet. Under the hood, Colyseus will use LocalDriver
for the matchmaker.
We hope to eventually merge a more flexible matchmaking interface in to Colyseus in order to cleanly interface with the Rivet matchmaker.