Skip to content

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.

License

Notifications You must be signed in to change notification settings

TLabAltoh/rust-server-for-multiplayer

Repository files navigation

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.

Warning

I am not a member or contributor of original source. Please note that my modification may have dropped original source's critical features.

sample unity project is here

Feature

  • Broadcast
  • Unicast (by user id)
  • Multicast

WebRTC

  • DataChannel
  • Audio
  • Video
  • Trickle-ICE
  • Vanilla-ICE (No plans at the moment.)

WebSocket

  • Binary
  • Text (No plans at the moment.)

Network Event (with user id)

  • OnOpen
  • 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

git clone https://github.com/TLabAltoh/rust-server-for-multiplayer.git

Build

cd REPOSITORY_ROOT
build-*.bat

Run

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.

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

cd REPOSITORY_ROOT
run.bat

start chrome http://localhost:7777 --auto-open-devtools-for-tabs

Firefox

cd REPOSITORY_ROOT
run.bat

start 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 !).

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published