switch to golang wrapper for enet

This commit is contained in:
Travis Shears 2026-04-13 13:50:21 +02:00
parent 4420b4e061
commit ee3b8d3490
Signed by: travisshears
GPG key ID: CB9BF1910F3F7469
10 changed files with 188 additions and 194 deletions

View file

@ -1,82 +1,30 @@
# ENET Gaming Backend
# Löve2D ENET Gaming Backend
A multiplayer game server written in C# using ENet for networking.
A multiplayer game server written in GO Lang wrapping ENet for networking.
Designed to support mutiple of my LÖVE2D game experiments at once.
## Architecture
```
┌─────────────────────────────────────────────────────────────┐
│ LÖVE2D Game Clients │
│ (Fennel/Lua with Love2D Framework) │
└────────────────────────────────┬────────────────────────────┘
│ (UDP via ENet)
┌────────────┴────────────┐
│ ENet-CSharp Server │
│ (Multiplayer Backend) │
└────────────┬────────────┘
┌────────────┴────────────┐
│ Game State Manager │
│ Session Storage │
│ Player Coordination │
└────────────────────────┘
```
## Technology Stack
- **Language**: C# (.NET)
- **Networking**: [ENet-CSharp](https://github.com/nxrighthere/ENet-CSharp) - reliable UDP multiplayer protocol
- **Deployment**: Docker + Nomad
- **Port**: `7777` (UDP, configurable)
- Language: Go Lang
- Networking:
- https://github.com/codecat/go-enet
- http://enet.bespin.org/index.html
- Docker image
- Nomad deployment
## Quick Start
### Prerequisites
## Local Development
- .NET 8.0 or later
- ENet-CSharp (vendored or via NuGet)
- Docker (for containerization)
### Local Development
```bash
cd backend
dotnet build
dotnet run
```shell
$ docker compose up --build
```
The server will start and listen on `127.0.0.1:7777` by default.
## Prod Deployment
### Testing Connection
With a LÖVE2D client configured to connect to `localhost:7777`:
```bash
love ../two_player_cleaning_game
```shell
$ ./build.sh
```
## Configuration
Server behavior is controlled via environment variables:
```bash
ENET_HOST=0.0.0.0 # Bind address
ENET_PORT=7777 # UDP port
```
## Resources
- [Learn X In Y C#](https://learnxinyminutes.com/csharp/)
## Next Steps
- [ ] Set up C# project structure
- [ ] Integrate ENet-CSharp dependency
- [ ] Implement basic server startup
- [ ] Define message protocol
- [ ] Create player session management
- [ ] Build Docker image
- [ ] Test Nomad deployment
- [ ] Implement game state synchronization
Then go to homelab repo and deploy the nomad job