I’m trying to replicate the inventory and the actions that i can do with it (drop, stack, split, and so on). Taking the drop item as an example, i have a Inventory::DropItem(Item, Quantity) method that checks if the item is stacked it calls the Item::Drop() method x amount of times to show the actor, enable collisions and throw it into the world. If it’s not stacked it only calls that method for the main item. Right now i’m only replicating the inventory to the owner, so the simulated clients have the value of None. When the user right clicks the item and clicks drop he calls Inventory::ServerDropItem(Item, Quantity) which calls the local version to drop it on the server. The problem is that i need the clients to execute those Item::Drop() methods because the visibility and collision settings are not replicated. So i only see 2 possible approaches to this problem:
-
The server is the only one that runs the Drop logic and instead of Item::Drop() it executes a Item::ClientDrop() method that is netmulticast and runs on the server also. This way the clients don’t need to know the inventory to be replicated and execute the only part that they need to run.
-
Execute the Drop logic on both the server and the clients, but this means that i have to replicate everything to the clients so that they have the same information as the server and run the exact same flow.
In general what i’m asking is, should the clients (especially the simulated) be completely oblivious of the values and run as minimalistic as possible? Or should they be more aware of the variables and run almost the same logic as the server?
Thank you