This project is a powerful tool for indie game developers who want to add seamless online multiplayer functionality to their games.
We're building a robust NAT traversal solution that's easy to integrate and packed with features.
The core NAT punching functionality is now implemented and ready for testing! This MVP includes:
✅ Working Features:
- Client registration and discovery
- NAT punching between peers
- Connection establishment and verification
- Error handling and logging
- Keep-alive mechanism
- Lobby system for game matching
- Automatic peer connection when joining lobbies
- Test scripts for validation
🧪 Ready to Test:
- Run
./test_mvp.shfor basic NAT punching - Run
./test_lobby.shfor lobby system testing
- Centralized Server: Handles all the complexities of NAT traversal for you, so you can focus on building awesome gameplay.
- Debug Client: A handy tool to test connections and see the magic in action.
- Protobuf Definitions: Clean and efficient communication between server and clients.
We have big plans for this project! Here's a sneak peek at what we're cooking up:
- Lobby Management: Create and manage lobbies with ease, allowing players to connect and play together seamlessly.
- Advanced NAT Traversal: Support for STUN, TURN, and ICE to ensure smooth connections in even the most challenging network environments.
- Multi-Language Support: Integrate with clients written in various programming languages.
- Robust Connection Management: Features like connection persistence, quality-of-service management, and load balancing for a top-notch multiplayer experience.
- Ironclad Security: Encryption and authentication to keep your players' data safe.
- Server (
/cmd/server): The heart of the operation, managing client connections and orchestrating NAT punchthrough. - Client (
/cmd/client): A basic client for testing and demonstration. - Protobuf Definitions (
/proto): The language of communication between server and clients.
It's super easy to get started! Just run make in the root directory to build the server and client binaries.
Fire up the server:
./bin/server -p <port>(Replace <port> with your desired port number.)
Launch the client:
./bin/client -a <server_address> -p <port>(Replace <server_address> with the server's IP address and <port> with the server's port number.)
The client supports the following commands:
list: Lists all clients registered with the server.connect <index>: Connects to a client by its index from thelistcommand.ping <index>: Pings a client by its index to verify a direct connection.lobbies: Lists all available lobbies.create <name> <max_players>: Creates a new lobby.join <index>: Joins a lobby by its index from thelobbiescommand.help: Displays a list of available commands.exit: Exits the client.
The test_mvp.sh and test_lobby.sh scripts can be used to test the NAT punching and lobby functionality.
Once connected, you can use the ping command to verify that a direct peer-to-peer connection has been established.
Example:
- Run
./test_mvp.shto start the server and two clients. - In one client, type
listto see the other client's index. - Type
connect <index>to initiate the NAT punch-through. - Type
ping <index>to send a direct ping to the other client.
A successful ping will be logged in both clients, confirming a direct connection.
We'd love to hear from you! Contribute to the project, report issues, or share your ideas. Let's build amazing multiplayer games together! 🧑🤝🧑
