Skip to content
This repository has been archived by the owner on Dec 13, 2024. It is now read-only.

Commit

Permalink
Add Colyseus example
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFlurry committed Dec 26, 2023
1 parent 9c1f088 commit e4e511c
Show file tree
Hide file tree
Showing 36 changed files with 5,622 additions and 19 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
## Templating README files

```
./scripts/template.sh
./_internal/scripts/template.sh
```

6 changes: 6 additions & 0 deletions _internal/templater/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ impl std::fmt::Display for ConfigMetaLanguage {

#[derive(Clone, Debug, Serialize, Deserialize)]
enum ConfigMetaNetworking {
WebRTC,
SocketIo,
Colyseus,
GodotHLMultiplayer,
FishNet,
UnrealReplication,
Expand All @@ -82,7 +84,9 @@ enum ConfigMetaNetworking {
impl ConfigMetaNetworking {
fn url(&self) -> &'static str {
match self {
Self::WebRTC => "https://webrtc.org",
Self::SocketIo => "https://socket.io",
Self::Colyseus => "https://github.com/rivet-gg/plugin-colyseus-server'",
Self::GodotHLMultiplayer => "https://docs.godotengine.org/en/stable/tutorials/networking/high_level_multiplayer.html",
Self::FishNet => "https://fish-networking.gitbook.io/docs/",
Self::UnrealReplication => "https://docs.unrealengine.com/en-US/Gameplay/Networking/Actors/Replication/index.html",
Expand All @@ -93,7 +97,9 @@ impl ConfigMetaNetworking {
impl std::fmt::Display for ConfigMetaNetworking {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::WebRTC => write!(f, "WebRTC"),
Self::SocketIo => write!(f, "Socket.IO"),
Self::Colyseus => write!(f, "Colyseus"),
Self::GodotHLMultiplayer => write!(f, "High-Level Multiplayer"),
Self::FishNet => write!(f, "Fish-Networking"),
Self::UnrealReplication => write!(f, "Actor Replication"),
Expand Down
4 changes: 2 additions & 2 deletions _internal/templater/tpl/README.md.tera
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
- [{{ feature.name }}]({{ feature.url }})
{% endfor %}

## Developing Locally
## Running locally

1. [Clone the GitHub repo](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)
2. Open this folder
3. Run: `rivet init`
4. Run `yarn start`

## Deploying
## Deploying to Rivet

[Documentation]({{ deploy_docs_url }})

4 changes: 2 additions & 2 deletions c/coredump/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
- [🌐 Dynamic Servers](https://rivet.gg/docs/dynamic-servers)


## Developing Locally
## Running locally

1. [Clone the GitHub repo](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)
2. Open this folder
3. Run: `rivet init`
4. Run `yarn start`

## Deploying
## Deploying to Rivet

[Documentation](https://rivet.gg/learn/html5/tutorials/crash-course#step-3-publish-your-game)

1 change: 1 addition & 0 deletions godot/example-godot-bomber
Submodule example-godot-bomber added at bee511
9 changes: 9 additions & 0 deletions html5/colyseus/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
npm-debug.log
lib
*.js
Dockerfile

### Rivet ###
.rivet/
.env
24 changes: 24 additions & 0 deletions html5/colyseus/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "pwa-node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": [
"--nolazy",
"-r",
"ts-node/register/transpile-only"
],
"args": ["src/index.ts"],
"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart",
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
],
"skipFiles": ["<node_internals>/**", "node_modules/**"]
}
]
}
17 changes: 17 additions & 0 deletions html5/colyseus/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# === Build ===
FROM node:16-alpine as build
WORKDIR /app
COPY ./package.json ./package-lock.json /app/
RUN npm install
COPY . .
RUN npm run build

# === Run ===
FROM node:16-alpine
WORKDIR /app
# Enables uWebSockets to run on Alpine Linux
RUN apk add --no-cache libc6-compat && ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2
COPY --from=build /app/package.json /app/package-lock.json /app/
RUN npm install --production
COPY --from=build /app/lib/ /app/lib/
CMD node lib/index.js
21 changes: 21 additions & 0 deletions html5/colyseus/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Rivet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
27 changes: 27 additions & 0 deletions html5/colyseus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Colyseus





| Language | Networking |
| --- | --- |
| [TypeScript](https://www.typescriptlang.org) | [Colyseus](https://github.com/rivet-gg/plugin-colyseus-server') |

**Rivet Features**

- [♟️ Matchmaker](https://rivet.gg/docs/matchmaker)
- [🌐 Dynamic Servers](https://rivet.gg/docs/dynamic-servers)


## Running locally

1. [Clone the GitHub repo](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)
2. Open this folder
3. Run: `rivet init`
4. Run `yarn start`

## Deploying to Rivet

[Documentation](https://rivet.gg/learn/html5/tutorials/crash-course#step-3-publish-your-game)

15 changes: 15 additions & 0 deletions html5/colyseus/example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[display]
title = "Colyseus"
description = """
This repository provides examples of running Colyseus with the Rivet plugin.
[**Live demo**](https://colyseus.rivet.game/)
""""

[meta]
engine = "HTML5"
language = "TypeScript"
networking = "Colyseus"
features = ["Matchmaker", "DynamicServers"]


Loading

0 comments on commit e4e511c

Please sign in to comment.