Shared inventory

Hi guys,

i have read some threads, that having network access to a shared list is not good practice (e. g. a chest which is looted by two players simultanously).

I think in my project, i cannot avoid that all players have same access to the inventory of the party. So i thought if i do changes at the inventory via RPC (all calls in inventory e. g. Equip item or sell item will be handled by host of the session) i would be save because the host handles the data. Requests which are received to items which arent part of the inventory anymore will be discarded.

Is this way consistent or am i wrong? What would be the best way to solve this problem?

That is correct. This is what Server authority is for.

The alternative would be shared (or: instanced) loot chests, as many networked games do it. Anyone can open the chest, anyone sees either the same or an individualized list of items. Each player is allowed to take one or more items from the chest without taking anything away from other players. Everyone gets to choose their own reward. Nobody sees what the other players are taking - they can only talk about it, or it requires the game to message and display to everyone what the other players took.

Thank you!

Yes i alread thought about instantiated loot but in my current game structure there is a party with characters. The party is a FPS controller like in Might and Magic or other dungeon crawlers... One or more characters can be assigned to a player. Players do not have an inventory because they are only controlling their assigned characters. To simplify i thought about using a shared party inventory instead of a character inventory. I think this will be a bad ux for players to select first the character which loots.

Have to think about it... Instantiated loot is also a good option, but i do not know where to put it.

It may require a restructure of your inventory system, but how im handling a similar situation is:
The host has the save file, and therefor all the info on party characters inventory.

When a client player goes to alter the inventory of the character they are controlling, they "ask" the host to make the change requested(replace item 1 with item 2, item 2 goes to item 1's spot.
Then the host game updates any changes made by that movement of items.
And finally the client(s) recieve the updated inventory lists and their games reflect the new lists.

Thank you!
A okay I think this is the RPC way, where the host has the full control of it.