The current setup consists of an Inventory Component, ItemData Struct and a widget called WB_Slot.
Within the Inventory Component i have a function called “setSlotData” within this function i simply insert the new data for the chosen slot using “set Array Element”.
This ItemData struct array is replicated and set to Rep Notify. Here comes the problem. The array is not aware what specific index has been changed. So i cant really update the index, In this case im simply updating all of the slots (id like to change this to a system that updates the slots that changed speciffically)
Extra Info :
-
yes the inventory component is replicated by default using the checkbox.
-
yes the inventory component is added to the player and actors alike.
-
The player controller handles the updating part. (Drag / Drop / Move / Split / Stack)
-
The items are server sided. Most of the function calls are done using RPC’s but the client is able to run “Owning Client” events if needed.
-
Yes i tried creating a integer array that stores all the changed “Slot Indexes” and then looping through that array on Rep Notify to update only the indexes that changed. The problem with this approach was i couldnt clear the list on Rep Notify because the list is beeing filled on server… So the list keeps getting bigger… essentially creating the same problem of updating slots that arent needed at that point.
-
I tried a simple Rep notify boolean but it seems that the network isnt fast enough and items start dissapearing even though they are present. This kind of inconsistent behaviour will ruin the gameplay experience, i dont have this when i update every single slot.
hopefully this has informed you enough ! if you have any idea’s feel free to share your thoughts ! i’d appreciate it, since i have been struggling with this for months now.