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!
- Host: GitHub
- URL: https://github.com/alexmollard/enetplayground
- Owner: AlexMollard
- Created: 2025-03-02T10:12:12.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-09T04:30:44.000Z (over 1 year ago)
- Last Synced: 2025-03-09T13:16:11.609Z (over 1 year ago)
- Topics: cpp, enet, multiplayer, server, udp
- Language: C++
- Homepage:
- Size: 5.89 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
---
## π 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 displaying connected clients and active plugins
Client authentication 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.
---