An open API service indexing awesome lists of open source software.

https://github.com/alexmollard/enetplayground

🌐 A playful networking sandbox where packets come to party and sometimes die - my personal experiment with ENet that sometimes works, often breaks, and always teaches me something new!
https://github.com/alexmollard/enetplayground

cpp enet multiplayer server udp

Last synced: 2 months ago
JSON representation

🌐 A playful networking sandbox where packets come to party and sometimes die - my personal experiment with ENet that sometimes works, often breaks, and always teaches me something new!

Awesome Lists containing this project

README

          


🌐 EnetPlayGround


A Networking Sandbox for ENet Protocol Experimentation




πŸ“‹ About β€’
✨ Features β€’
πŸ“Έ Screenshots β€’
πŸ”§ Tools & Libraries β€’
πŸ’» Installation β€’
πŸš€ Usage β€’
πŸ›£οΈ Development Roadmap β€’
πŸ”¬ Research Areas



Language
Network Library
Status

---

## πŸ“‹ About

EnetPlayGround is an experimental platform for exploring networking concepts using the ENet reliable UDP networking library. This project was developed to investigate the challenges and complexities of network programming in the context of multiplayer game development.

The primary focus of this sandbox is to test various networking approaches, understand performance limitations, and implement scalable client-server architecture patterns.

## ✨ Features



πŸ–₯️ Server Components



  • πŸ”Œ Multi-client connection management

  • ⚑ Robust event handling system

  • πŸ“¦ Reliable packet delivery implementation

  • πŸ“’ Broadcast messaging infrastructure

  • πŸ—„οΈ MySQL database integration

  • 🧩 Plugin architecture support




πŸ“± Client Implementation



  • πŸ”„ Connection stability management

  • ⏱️ Game state synchronization

  • πŸ“ Comprehensive logging system

  • πŸ–ΌοΈ Graphical user interface

  • πŸ—ΊοΈ Position visualization

  • πŸ–ŒοΈ Theming system



## πŸ“Έ Screenshots





Server Console

Server console displaying connected clients and active plugins




Login Interface

Client authentication interface




Client Interface

Client interface with inter-client communication





## πŸ”§ Tools and Libraries

### πŸ“š Core Dependencies
- **🌐 ENet**: Reliable UDP networking library for client-server communication
- **πŸ–ŒοΈ Hello ImGui**: Cross-platform GUI library for interface development
- **πŸ—ƒοΈ MySQL Connector**: Database connectivity for persistent storage

### πŸ› οΈ Development Tools
- **πŸ“¦ vcpkg**: C++ package manager for dependency management
- **πŸ—οΈ Visual Studio 2022**: IDE for C++ development

## πŸ’» Installation

### πŸ“‹ Prerequisites
- Visual Studio 2022 (or newer)
- C++23 compatible compiler
- vcpkg
- Git

### πŸ”„ Setup Process

1. **πŸ“₯ Clone the repository**
```bash
git clone https://github.com/alexmollard/EnetPlayGround.git
cd EnetPlayGround
```

2. **βš™οΈ Configure vcpkg**
```bash
# Install vcpkg in a directory accessible to all projects
# Example: "C:\Users\\vcpkg"
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg integrate install
```

- Add the vcpkg directory to your PATH environment variable
- Alternatively, set VCPKG_ROOT environment variable to your vcpkg installation path

3. **πŸ“¦ Install required dependencies**
- The projects now use vcpkg manifest files to manage dependencies so when you build the projects it will automatically install the required dependencies.

4. **πŸ”¨ Build the projects**
- Open `EnetServer/EnetServer.sln` for the server component
- Open `EnetClient/EnetClient.sln` for the client component
- Build with Visual Studio (Ctrl+Shift+B)

## πŸš€ Usage

### βš™οΈ Server Configuration

The server can operate with a MySQL database backend or with a local file system for data storage. Two configuration methods are available:

#### πŸ” Environment Variables
- `GAME_DB_HOST`: Database server address (defaults to `localhost`)
- `GAME_DB_USER`: Database username (defaults to `gameserver`)
- `GAME_DB_PASSWORD`: Database password
- `GAME_DB_NAME`: Database name (defaults to `gameserver`)
- `GAME_DB_PORT`: Database port (defaults to `3306`)

#### πŸ“„ Configuration File
As an alternative to environment variables, settings can be defined in `server_config.cfg` located in the server executable directory.

### πŸƒβ€β™‚οΈ Running the Application

1. **πŸ–₯️ Start the server**
- Launch the compiled server executable
- Verify successful initialization without errors

2. **πŸ“± Connect clients**
- Start client instances
- Connect to the server using the appropriate address and port
- Test inter-client communication

## πŸ›£οΈ Development Roadmap

- [x] Core client-server communication
- [x] Multi-client messaging
- [x] Position data synchronization
- [x] Error handling system
- [x] Authentication functionality
- [x] Direct messaging between clients
- [x] Administrative controls
- [x] Position visualization
- [x] Plugin infrastructure
- [x] Database integration
- [x] Server multi-threading optimization
- [x] Controlled server shutdown process
- [ ] Fix bug where a client can leave and the server spams game state updates until clients start crashing
- [ ] Enhanced security implementation
- [ ] Improved error recovery mechanisms
- [ ] Administrative graphical interface

## πŸ”¬ Research Areas

EnetPlayGround serves as a platform for investigating various networking challenges:

- πŸ“ˆ Network capacity and scaling limits
- πŸ”„ Concurrency management under high loads
- πŸ”Œ Recovery from connection interruptions
- πŸ“ Message size optimization
- ⏱️ Latency impact assessment
- πŸ’» Hardware requirements analysis
- πŸ”’ Security impact on performance

## ❓ Frequently Asked Questions

πŸ€” Why was ENet selected as the networking library?
ENet provides a reliable UDP implementation that balances performance with reliability, making it suitable for real-time applications that require guaranteed delivery. and there wasnt many other options available at the time of my single google search.

πŸ“Š What is the project development status?..
The project is in active development with continuous improvements to stability, performance, and feature set.

πŸ“„ Can this codebase be used in other projects?
Yes, the code is available for use and modification in other projects, though it is primarily designed as an experimental platform. I wouldnt recommend it right now.

🏭 Is this suitable for production environments?
The current implementation is intended for research and development purposes and requires additional hardening before production deployment.
PLEASE DO NOT USE THIS IN PRODUCTION!

πŸ‘₯ What is the concurrent user capacity?
I have only tested with 5 local clients and 2 remote clients, but im unsure of the maximum capacity. The server is designed to handle multiple clients.

---


Visitor Count


cat


Created by Alex Mollard