Show HN: Making a cross-platform game in Go using WebRTC Datachannels
a day ago
- #Game Development
- #Networking
- #WebRTC
- WebRTC datachannels are a simpler alternative to complex WebRTC setups for game development.
- Websockets are too slow for most games, making them suitable only for turn-based games like Runescape.
- Web Transport, using QUIC, is a potential replacement for Websockets but is still in development with current issues on Firefox.
- WebRTC datachannels allow sending unreliable packets over the web using SCTP, usable today without waiting for Web Transport.
- Benefits of WebRTC include host flexibility, no need for port forwarding, minimal server requirements, and community support.
- Drawbacks of WebRTC include complex setup and the need for signaling and STUN/TURN servers.
- Various WebRTC implementations exist, including libwebrtc, libdatachannel, Pion WebRTC, and others in different programming languages.
- Existing game networking libraries using WebRTC include Geckos.io, Netlib, Matchbox, PeerJS, and Netplayjs.
- Real-world uses of WebRTC include WebXash3D (Half-Life 1 + Counter-Strike 1.6 reimplementation) and Hypersomnia (2D shooter).
- Go is preferred for development due to efficiency, active WebRTC support, and faster coding compared to Rust.
- Ebitengine is a versatile 2D game engine used for cross-platform games, including potential crossplay between Nintendo Switch, PC, and browser.
- An official Pion example using Ebitengine includes a bundled signaling server for hosting lobbies, currently limited to two players.
- WebRTC enables possibilities like hosting Minecraft-style games without dedicated servers or port forwarding.