Bag Multiplayer Sync
hammy275 opened this issue ยท 2 comments
Other players can't see someone's bag. We should allow this!
Would need to sync other player's arm positions, since mc-vr-api
doesn't support that.
A bag opener would send a BagOpenClosePacket
to the server, which tells it to open the bag or close the bag (explicitly set in the packet in case a close or open falls to packet loss). The server, knowing a good arm position, would send the arm position and left-handedness to the client, which would store that data in a HashMap
. The rendering function would render from the position there. The client auto-dismisses bags that are 12+ blocks away, and a close would be passed along from someone closing the bag to everyone else.
Moving this out of Alpha 2, and keeping this on the backburner until MC VR API gets support for having the data of other players on the client-side (will come with hammy275/mc-vr-api#14 ).
A redo of the above:
A bag opener would still send the BagOpenClosePacket
to the server, with the open state set explicitly. The server keeps track of the state of all players' bags, and the server tells other clients once every second the status of all players within 24 blocks of them if they have their bag open or not. Clients can then handle the rendering, and discard bags infos (effectively closing them) once outside of the range.
As an aside, I'll need to think if I want to integrate this into All bags should be managed in ImmersiveBackpack
, a file that's already a mess, or move it into a separate immersive (potentially an immersive for handling attachments to other players)?ImmersiveBackpack
.
EDIT: With #308 done, we should also sync the bag settings with the BagOpenClosePacket
, so that each player displays their customization of the bag!