-
Notifications
You must be signed in to change notification settings - Fork 60
Multiplayer Support [AARD-2024, AARD-2021]
#1252
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
Conversation
…s for active rooms
1d88f6c
to
75b1e5d
Compare
75b1e5d
to
7089985
Compare
[AARD-2024]
[AARD-2024, AARD-2021]
77d71e8
to
99d70c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that you can't use the context menu on another user's robot and that it's unavailable in the configure panel. I still had a couple issues though:
- When I spawn a robot in one window, then spawn one in another, both clients have their focus set to the second robot rather than the first client keeping focus on their own robot
- When both robots have no ejector configured, if I configure ejector on one and then pick up a gamepiece, the other client gets spammed with "configure ejector" notifications. The gamepiece does go to the correct place and is ejected properly for both users
EDIT:
- Should everyone be allowed to spawn a field? I feel like it would make more sense to only allow the room creator to spawn fields
Ok so I might just remove the toast for non-client objects
Yes, my original plan for multiplayer was that the field and game would be configured in the lobby, but we don't have one of those so we kind of just made it a collaborative sandbox environment. For now, I think this is out of the scope of this PR and should be deliberated on and addressed separately. |
Had an issue with scoring zones not syncing between users |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, I think the issues that are left can be addressed in another PR tomorrow. Would be good to get this in today
Remaining for follow up PR:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requested Changes
Starting a new match, does not reset scores back to 0, even in singleplayer
Not needed changes
Change multiplayer button to say "Multiplayer (Beta)" (Or some other way to inform the users that this still has some issues.
@AlexD717 do you have gamepieces in zones with persistent points? The old behavior was to reset to zero anyway and removing those gamepieces would result in negative scores, but I didn't think that made sense. I can change it back if you want though |
I think what you have right now is better and makes more sense |
Task
AARD-2021 AARD-2022 AARD-2023 AARD-2060 AARD-2067
Symptom
We want to support multiplayer
Solution
There were three sprints done to determine which technology / architecture would be used for multiplayer: #1198, #1220, and #1240, The latter of which we ended up choosing, read that spike PR for details on the architecture.
This PR introduces a new
MultiplayerSystem
, which manages all the peer connections, handles all the sent and received messages, and keeps data about which objects are owned by which peers, including its own client. Every tick,PhysicsSystem.update
sends either a collision or update message, as outlined in #1240.To avoid having to send field assemblies over network every time one is spawned, at first, only the assembly name is sent over, the receiving client searches for the assembly in its cache. If it doesn't find the assembly, the receiving client sends an assembly request message back to the first client, which responds with the full assembly.
To avoid any central stateful server (which peerjs is designed to avoid), joining rooms is done by encoding several hashes in the user id. This allows clients joining a room to easily identify peers with the same room id, verify that they also know the room id, and avoid exposing the room id to anyone who doesn't know it (and prevent people from enumerating rooms).
Verification
cd <synthesis>/multiplayer
bun i && bun run start
http://localhost:3000/fission?randomId=1
in two tabs. Click the multiplayer button in both. Press create game in one and copy the code, then paste it and click join game in the otherBefore merging, ensure the following criteria are met: