You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/blog/making-a-game-with-pion.md
+43-16Lines changed: 43 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,8 @@ date: 2025-09-09
5
5
authors: ["Srayan Jana"]
6
6
---
7
7
8
+
(The following was adapted from a talk I gave at [DWeb Weekend 2025](https://dwebseminar.org/weekend/) at the Internet Archive in San Francisco on August 17, 2025)
9
+
8
10
# Simplifying WebRTC Datachannels for Games
9
11
10
12
First of all, to get some stuff out of the way, instead of using the "super complicated" WebRTC datachannels, why don't we use something simpler?
@@ -20,18 +22,22 @@ First of all, to get some stuff out of the way, instead of using the "super comp
20
22
## The Case for Web Transport
21
23
22
24
- Replacement for Websockets, uses QUIC instead of TCP.
23
-
-Has been in development for a long time, and I want to get started now.
25
+
-However, it has been in development for a long time, and I want to get started on making games now.
-**Potential**: Will probably solve most problems once finished.
31
+
-**Potential**: Will probably solve most problems once finished and would be the best choice for making a multiplayer game on the web.
30
32
31
33
## Datachannels: A Hidden Gem of WebRTC
32
34
33
35
-**Feature**: Lets us send unreliable packets over the web using SCTP.
34
36
- Advantage: We don’t need WebTransport; we can use this today.
37
+
- They were created in part for exactly this use case
38
+
-[See the reasoning for unreliable datachannels in the official specification itself](https://datatracker.ietf.org/doc/html/rfc8831#name-use-cases-for-unreliable-da)
39
+
-[Not to mention that one of the original implementers of WebRTC wanted to enable this usecase](https://news.ycombinator.com/item?id=13264952)
40
+

35
41
36
42
## Benefits and Drawbacks of WebRTC
37
43
@@ -56,7 +62,9 @@ First of all, to get some stuff out of the way, instead of using the "super comp
56
62
-[webrtc-rs](https://github.com/webrtc-rs/webrtc) - Rust (using Tokio Runtime).
- Created by Valve and made for Steam, which means if you've ever played a game like Counter Strike or Deadlock, you've already seen this library in action!
60
68
61
69
### Existing Game Networking Libraries Using WebRTC
62
70
@@ -67,7 +75,7 @@ First of all, to get some stuff out of the way, instead of using the "super comp
67
75
-[Matchbox](https://github.com/johanhelsing/matchbox) - WebRTC datachannel library for Rust, compiles to both native and WASM.
68
76
-[PeerJS](https://github.com/peers/peerjs) - Great for browser-only apps/games, not specifically for game networking.
69
77
-[Netplayjs](https://github.com/rameshvarun/netplayjs) - Untested but seems to work well.
70
-
-[Godot's WebRTC Native](https://github.com/godotengine/webrtc-native) - Official Godot bindings to libdatachannel for Godot’s multiplayer API.
78
+
-[Godot Engine's WebRTC Native](https://github.com/godotengine/webrtc-native) - Official Godot bindings to libdatachannel for Godot’s multiplayer API.
71
79
72
80
## Real-World Uses
73
81
@@ -76,7 +84,11 @@ First of all, to get some stuff out of the way, instead of using the "super comp
- If time permits: Show a version that works with the web at [ValorZard](https://github.com/ValorZard/gopher-combat)
101
-
102
-
## Games That Use WebRTC
106
+
- The creator, [Hajime Hoshi](https://hajimehoshi.com/), has ported the engine (and the Go language!) to [the Nintendo Switch](https://ebitengine.org/en/blog/native_compiling_for_nintendo_switch.html) and other game consoles
107
+
-**Battle Tested**: Has been used for actual games like
108
+
-[From Madness with Love](https://playism.com/en/game/frommadness-withlove/)
- And more on the [Ebitengine Showcase Page](https://ebitengine.org/en/showcase.html)
117
+
-**Potential Crossplay**: You could make a cross platform multiplayer game in pure Go that works between the Nintendo Switch, PC, and the browser!
118
+
119
+
## Official Pion Example
120
+
- We now have an official example using Ebitengine in the Pion [example-webrtc-applications](https://github.com/pion/example-webrtc-applications) repository
121
+
- This includes an bundled in signaling server so you can host your own lobby, and connect with another player.
122
+
-[**Github Link to Game**](https://github.com/pion/example-webrtc-applications/tree/master/ebiten-game)
123
+
-**PR where it was merged in**: [Example WebRTC Applications](https://github.com/pion/example-webrtc-applications/pull/351)
124
+
-**Limitations**
125
+
- Right now, this can only support two players on the same computer
126
+
- Could probably work between two different computers, but we would need to figure out how to setup CORS properly for the signaling server
127
+
- The machinery is there to support more than two players in a lobby, but as of writing this article it is [currently hardcoded](https://github.com/pion/example-webrtc-applications/blob/5c7005933879d34fa19b4d0c744bb884a247f5dc/ebiten-game/game/main.go#L154) to just two
128
+

0 commit comments