collinalexbell / HackMatrix

A 3d Linux desktop environment (and game engine)
MIT License
472 stars 15 forks source link

Multiplayer #71

Open collinalexbell opened 6 months ago

collinalexbell commented 6 months ago

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 commented 6 months ago

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:

Screen Sharing:

Player Movement Synchronization:

Voice Chat Integration:

Server and Party Management:

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 commented 6 months ago

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 commented 6 months ago

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 commented 6 months ago

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

737a34ec76e94d993774244461879e2af837f602

collinalexbell commented 6 months ago

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.

b55f95e608fc0eac3764285ec9cfb79ae226ff47

collinalexbell commented 6 months ago

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.

7d6c19525f6ccf15c7a407631e79b9e33313db00

2024-05-09-211954_1920x1080_scrot

collinalexbell commented 6 months ago

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 commented 6 months ago

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

5e8d1511f013557d1d2cdc08cfefe78369bedfd2

collinalexbell commented 6 months ago

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 commented 6 months ago

Position commands are getting sent.

https://github.com/collinalexbell/HackMatrix/assets/1966377/48b8938c-1499-47a6-b4a0-448c5c96081b

collinalexbell commented 6 months ago

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