Hey guys, a long while back I was asking about using characters to represent multiplayer rooms that could have some custom data stored in them;
The problem was that I didn't fully understand the ownership of characters, and how intensive it would be to search the entire player database to see if someone had one character (only one person can "own" this multiplayer room at a time, and the game is to do battle and claim that room, essentially). There's more to it that involves saving some info to the "character" but those are the broad strokes.
However, now that there is Entity Groups, it seems like this is FAR more possible. Even if still impossible, I'd like to discuss the broad strokes again in the context of Entity Groups and see what you all think.
- Player A tries to join a room on photon. This assumes nobody has claimed this room before. Let's call it "Room A".
- Player A checks PlayFab for Entity Group "Room A". It doesn't exist. CloudScript fires that creates Room A and adds Player A as the only member. Player A roams around in Photon in Room A as well.
- Player B connects to the game. They chose to go to Room A. Photon returns the room in existence (Player A is still online). Playfab returns the Entity Group Room A as well. Player B sees that Player A "owns" Room A and he enters.
- They do battle and Player B wins.
- CloudScript removes Player A from EG "Room A" and adds Player B as the only member of Room A.
- Player B goes offline.
- Player C goes online.
- Player C chooses to go to Room A. The Photon room doesn't exist, but it is created again by Player C (the level's generation seed is the hashed name of the room, so everyone gets the same thing).
- Playfab returns the Entity Group Room A as well. Player C sees that Player B "owns" Room A and he enters.
- Photon triggers CloudScript to do a Push Notification to Player B, notifying them Player C is currently in Room A and will take control of it unless Player B logs in and defends it.
- Player B ignores so Player C can find the flag, replace it with their own, and trigger the Entity Group membership swap as described above.
Would this work?
Also, what kind of Data can be attached to an Entity Group? If I am procedurally generating the levels based of a seed of the room name, but I also want there to be some permanent destruction, etc., could I store this in the Entity Group itself? Or, would I make an Entity on Playfab that is a dummy Entity, that is always a member of a Room's Entity Group, for the sole purpose of having that custom data applied?
e.g. When you control a room, you get to hide the flag in a new spot. The v3 location and rotation of that flag would be stored in the EG (if possible), or in a dummy entity created when an EG is.
Open to thoughts.