Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplayer #71

Open
collinalexbell opened this issue May 9, 2024 · 11 comments
Open

Multiplayer #71

collinalexbell opened this issue May 9, 2024 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@collinalexbell
Copy link
Owner

As part of the Game Design book of lenses book, the first lens is Emotion.

What emotion do I want from a game built on HackMatrix? I want a feeling of Connectivity and Competence.

To generate a feeling of Connectivity, the engine must support multiplayer... players can join up to solve computer problems (programming, Linux stuff, even graphics design and asset creation).

So my current focus based on the game design book is going to be multiplayer.

@collinalexbell collinalexbell added the enhancement New feature or request label May 9, 2024
@collinalexbell
Copy link
Owner Author

Claude's thoughts:

Milestones:

  1. Networking and Communication
  2. Screen Sharing
  3. Player Movement Synchronization
  4. Voice Chat Integration
  5. Server and Party Management

Tasks:

Networking and Communication:

  • Choose a networking library for low-level network communication (e.g., Boost.Asio, ENet)
  • Implement client-server architecture for connecting players
  • Design and implement a protocol for exchanging messages between clients and the server
  • Handle connection establishment, disconnection, and error handling

Screen Sharing:

  • Research and select a library for capturing and encoding screen content (e.g., FFmpeg, libVNC)
  • Implement screen capturing and encoding on the client-side
  • Design a protocol for transmitting screen updates to other players
  • Implement screen decoding and rendering on the receiving clients
  • Optimize screen sharing for performance and bandwidth efficiency

Player Movement Synchronization:

  • Design a protocol for synchronizing player movements across clients
  • Implement client-side prediction and server-side reconciliation for smooth player movement
  • Handle latency compensation and interpolation to ensure consistent player positions
  • Implement collision detection and resolution for player interactions

Voice Chat Integration:

  • Choose a voice chat library or service (e.g., Mumble, Discord API, WebRTC)
  • Integrate the voice chat functionality into your game engine
  • Implement voice chat channels or proximity-based voice communication
  • Handle voice encoding, transmission, and decoding
  • Ensure low-latency and high-quality voice communication

Server and Party Management:

  • Design and implement a server browser or matchmaking system
  • Create a party system for players to join and invite others
  • Implement server creation and configuration options
  • Handle player authentication and authorization
  • Provide tools for server administrators to manage players and settings

Libraries and Off-the-Shelf Code:

Networking: Boost.Asio, ENet
Screen Sharing: FFmpeg, libVNC
Voice Chat: Mumble, Discord API, WebRTC
Serialization: Protocol Buffers, FlatBuffers
Compression: zlib, LZ4
Encryption: OpenSSL, libsodium
Logging: spdlog, Boost.Log
Testing: Google Test, Catch2

@collinalexbell
Copy link
Owner Author

Me: First, the networking library. I'm currently using ZMQ for other purposes. Is that too high level? What are the tradeoffs vs using the other ones you suggested?

Claude:

image
image

@collinalexbell
Copy link
Owner Author

Ok. I'm choosing ENet. Reddit says it is battle tested.

I'm keeping a design doc of decisions on the new multiplayer branch: https://github.com/collinalexbell/HackMatrix/tree/multiplayer

@collinalexbell
Copy link
Owner Author

I asked claude to generate Client, Server, and Gui classes:

737a34e

@collinalexbell
Copy link
Owner Author

HackMatrix already has a preexisting Imgui class with tabs that Claude didn't know about. I had claude rewrite the Gui class so that it can plug into the engineGui class.

b55f95e

@collinalexbell collinalexbell self-assigned this May 9, 2024
@collinalexbell
Copy link
Owner Author

Barebones GUI works. Connect button still needs something to call, but that will be implemented in the Client class. I also thing the GUI needs an option to make a particular instance into a server.

7d6c195

2024-05-09-211954_1920x1080_scrot

@collinalexbell
Copy link
Owner Author

Got a used laptop, installed Arch. HackMatrix is the only WM installed 😆.

Test environment all set up to start hacking on multiplayer in earnest. Lfg

image

@collinalexbell
Copy link
Owner Author

Client and Server compile now. Had to add enet impl to engine.cpp.

5e8d151

@collinalexbell
Copy link
Owner Author

collinalexbell commented May 11, 2024

Client and Server basis connection works.

Server starts (no connections
notconnected

Add client info on another machine
ready-to-connect

Connected
connected

Server also sees 1 connection
client

@collinalexbell
Copy link
Owner Author

Position commands are getting sent.

trim.1914FA87-7935-4012-88FE-3B8FDDBFFC33.MOV

@collinalexbell
Copy link
Owner Author

collinalexbell commented May 13, 2024

x11vnc + tigervnc-viewer seems to work pretty well

host
13-05-2024 19-45-06

client (ignore w.e. is going on with the screenshot (dimensions may be off, idk))
13-05-2024 15-45-03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant