Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tlabaltoh/rust-server-for-multiplayer
This is an SFU (Selectable Forwarding Unit) server for relaying WebRTC and WebSocket packets. Intended for use in a realtime multiplayer game. This repository's webrtc implementation is mostly based on binbat's live777 and webrtc-rs.
https://github.com/tlabaltoh/rust-server-for-multiplayer
audio game-server multiplayer multiplayer-server network networking rust rust-lang server sfu sfu-server trickle-ice unity video webrtc webrtc-server websocket whep whip
Last synced: 12 days ago
JSON representation
This is an SFU (Selectable Forwarding Unit) server for relaying WebRTC and WebSocket packets. Intended for use in a realtime multiplayer game. This repository's webrtc implementation is mostly based on binbat's live777 and webrtc-rs.
- Host: GitHub
- URL: https://github.com/tlabaltoh/rust-server-for-multiplayer
- Owner: TLabAltoh
- License: mpl-2.0
- Created: 2024-09-24T23:23:25.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2025-01-03T17:56:04.000Z (12 days ago)
- Last Synced: 2025-01-03T18:39:23.451Z (12 days ago)
- Topics: audio, game-server, multiplayer, multiplayer-server, network, networking, rust, rust-lang, server, sfu, sfu-server, trickle-ice, unity, video, webrtc, webrtc-server, websocket, whep, whip
- Language: Rust
- Homepage:
- Size: 7.18 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# rust-server-for-multiplayer
This is an SFU (Selectable Forwarding Unit) server for relaying [WebRTC](https://webrtc.org/?hl=en) and [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) packets. Intended for use in a realtime multiplayer game. This repository's webrtc implementation is mostly based on [binbat](https://github.com/binbat)'s [live777](https://github.com/binbat/live777) and [webrtc-rs](https://github.com/webrtc-rs/webrtc).> [!WARNING]
> I am not a member or contributor of [original source](https://github.com/binbat/live777). Please note that my modification may have dropped original source's critical features.[sample unity project is here](https://github.com/TLabAltoh/Unity-SFU-Integration.git)
## Feature
- [x] ```Broadcast```
- [x] ```Unicast (by user id)```
- [ ] ```Multicast```
### WebRTC
- [x] ```DataChannel```
- [x] ```Audio```
- [x] ```Video```
- [x] ```Trickle-ICE```
- [ ] ```Vanilla-ICE (No plans at the moment.)```
### WebSocket
- [x] ```Binary```
- [ ] ```Text (No plans at the moment.)```
### Network Event (with ```user id```)
- [x] ```OnOpen```
- [x] ```OnClose```## Overview
In this repository, you can use ```whep``` without ```whip``` in ```WebRTC```. When ```whep``` is called without ```whip```, the server prepares the dummy ```whip```. it assumes use cases for datastreams that do not need an owner (like synchronising the transform of a game object and so on ...).
## Get Started
### Install
Clone this repository with the following command
```bat
git clone https://github.com/TLabAltoh/rust-server-for-multiplayer.git
```### Build
```bat
cd REPOSITORY_ROOT
build-*.bat
```### Run
```bat
cd REPOSITORY_ROOT
run.bat
```### Client implementation Sample and Debug with browser
This repository contains a browser-based debugging tool. Prepare the media (```mp3``` and ```mp4```) of your choice and Run the command below to open it.```bat
cd REPOSITORY_ROOT
mkdir assets\webui\media@rem put the media (please set the name to sample-audio.mp3 and sample-video.mp4) of your choice.
@rem ls
@rem sample-audio.mp3 sample-video.mp4
```#### Chrome
```bat
cd REPOSITORY_ROOT
run.batstart chrome http://localhost:7777 --auto-open-devtools-for-tabs
```#### Firefox
```bat
cd REPOSITORY_ROOT
run.batstart firefox http://localhost:7777 -devtools
```Also, client implementation sample with ```javascript``` has been puted in ```./assets/webui/``` and used as part of ```debug-tool```'s module. Currently, it only has the function of just ```(join / exit) Room``` and ```(send / receive) MediaStream / DataChannel / WebSocket```. This repository only contains ```javascript``` client implementation examples. The ```C#``` version of the ```Unity``` client implementation example is maintained in a separate repository ([unity's sample is here !](https://github.com/TLabAltoh/Unity-SFU-Integration.git)).