Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucasteles/backdashgodotsample
Sample of Backdash Rollback net-code with Godot
https://github.com/lucasteles/backdashgodotsample
csharp gamedev godot rollback-netcode
Last synced: about 6 hours ago
JSON representation
Sample of Backdash Rollback net-code with Godot
- Host: GitHub
- URL: https://github.com/lucasteles/backdashgodotsample
- Owner: lucasteles
- License: mit
- Created: 2024-04-30T18:48:21.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-11-29T23:21:47.000Z (2 months ago)
- Last Synced: 2024-11-30T00:21:52.586Z (2 months ago)
- Topics: csharp, gamedev, godot, rollback-netcode
- Language: C#
- Homepage: https://lucasteles.github.io/Backdash/
- Size: 161 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SpaceWar with Godot
This project is a usage sample of [rollback netcode](https://lucasteles.github.io/Backdash/docs/introduction.html#how-does-it-work) using [Backdash](https://github.com/lucasteles/Backdash) in [Godot](https://godotengine.org/).
It shows a basic example of an online lobby for NAT traversal using [UDP hole punching](https://en.wikipedia.org/wiki/UDP_hole_punching).
## Video
[![Godot Online](https://img.youtube.com/vi/8M8QnTiJZzA/default.jpg)](https://youtu.be/8M8QnTiJZzA)# How does it work?
This enables a P2P connection over the internet, this is possible using
a [middle server](https://github.com/lucasteles/Backdash/tree/master/samples/LobbyServer)
which all clients know.
The server catches the IP address and port of a client and sends it to the others.The current server runs almost as a simple HTTP with JSON responses. It keeps the lobby info with sliding expiration
cache.When a client enters the lobby the server responds with a token of type `Guid`/`UUID`. It is used a very
basic `Authentication` mechanism.The client uses HTTP pooling to get updated information on each lobby member/peer.
When logged in, every client needs to send a `UDP` package with their token to the server. The server uses the package header metadata
to keep track of their `IP` and open `Port`.> ⚠️ UDP Hole punching usually **does not** work with clients behind the same NAT. To mitigate this the server
> also tracks the local IP and port on each client to check if the peer is on the same network.## Controls
- **Arrows**: Move
- **Space**: Fire
- **Left Ctrl**: Missile## Running
### Server
> [!NOTE]
> This project uses an already published [demo lobby server](https://lobby-server.fly.dev/swagger/index.html).The server URL is configured in the `settings.ini` file and you can start your own [server from here](https://github.com/lucasteles/Backdash/tree/master/samples/LobbyServer):
After cloning the repository run this command on the server project directory:
```bash
dotnet run .
```- Default **HTTP**: `9999`
- Default **UDP** : `8888`> [!TIP]
> 💡 Check the swagger `API` docs at http://localhost:9999/swagger