π₯ Tanks (Canvas, Socket.io)
Language | Rendering | Networking |
---|---|---|
TypeScript | Canvas | Socket.io |
The following guide will walk you through integrating and deploying a game with Rivet.
Step 1: Setup project
Run the following to clone the repository and start the server:
This will open your browser to http://localhost:8080. Verify the game works.
Initialize project
Run the following command to setup your project:
Update the config
You can configure your gameβs Rivet config in the created rivet.yaml
file. For the purposes of this demo,
you can copy and paste this config into your file:
Step 2: Integrate Rivet Matchmaker
Install @rivet-gg/api
Run the following to install the library to interact with Rivet:
Update the client
Add the following to the top of client/Client.ts
:
Find the connect
function in client/Client.ts
and replace it with the following:
Update the server
Add the following to the top of server/index.ts
:
Find the setupConnection
function in server/index.ts
and replace it with the following:
Run with Rivet
Finally, after stopping the previous npm run start
, run rivet run start
and validate the game still connects.
Step 3: Deploy to Rivet
Now that you managed to get the game running locally, you can deploy your game to Rivet with:
The CLI will print a link ending in rivet.game
. Share the link with a friend to play your game on Rivet! π