https://github.com/rivet-gg/plugin-colyseus-server
https://github.com/rivet-gg/plugin-colyseus-server
colyseus javascript multiplayer typescript
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rivet-gg/plugin-colyseus-server
- Owner: rivet-gg
- License: mit
- Created: 2023-03-31T10:10:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-05T21:02:06.000Z (over 1 year ago)
- Last Synced: 2025-02-03T11:51:11.507Z (8 months ago)
- Topics: colyseus, javascript, multiplayer, typescript
- Language: TypeScript
- Homepage:
- Size: 229 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# 🔩 Rivet Colyseus Plugin
Plugin to Colyseus for easy development with Rivet.
## Example
See a more detailed example [here](https://github.com/rivet-gg/plugin-colyseus-examples).
```typescript
import { listen } from "../src/index";export default listen({
async initializeGameServer(gameServer) {
gameServer.define("chat", ChatRoom).enableRealtimeListing();
},
});
```## Running Test Server
The test server is used for manual testing for development. For more comprehensive examples, check out the [Colyseus examples repo](https://github.com/rivet-gg/plugin-colyseus-examples).
**Project setup**
1. Create a game on the [Rivet Developer Dashboard](https://hub.rivet.gg/developer/dashboard)
1. Install the [Rivet CLI](https://github.com/rivet-gg/cli)
1. Run `rivet init --recommend` to link your game**Running**
1. Run the server in one terminal: `yarn run test-server`
1. Copy the token from the line that starts with "[Rivet] Token:"
1. Run the test client [here](https://github.com/rivet-gg/plugin-colyseus-javascript)## FAQ
**What happened to `initializeExpress`?**
Rivet game servers run only game code and nothing else. We support deploying static content with [Rivet CDN](https://docs.rivet.gg/cdn/introduction).
If you need to run a custom API server, take a look at [Fly.io](https://docs.rivet.gg/cdn/introduction) or [Railway](https://railway.app/).
**Why not use the existing [MatchMakerDriver](https://github.com/colyseus/colyseus/blob/afb44c3d4f8100465becd81d1cb995c6d773b6d8/packages/core/src/matchmaker/driver/interfaces.ts#L29)?**
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.