GameMaker Networking: Item dupe + check variable before taking action

K

Krushnaks

Guest
Hello!, first of all, i apologize if my english isn't correct! ... about my problem, I have an object that is a container, inside there are 5 items, every time a player interacts with that container, an item is subtracted, then I send to the other clients the notice that I have removed an item, if the quantity of items is equal to or less than 0, we can't remove any more, the problem lies when there is an only one (1) element inside the container and two players interact at the same time, both get an item and the counter goes to -1, how can I solve it?
 
You might notice this happens in basically all online games with loot containers. The number of times I've tried to take loot in a shared container and someone with a better ping (usually my brother) has gotten it before me...In any case, the item subtraction should be handled server-side (in fact, pretty much everything like that should be handled server-side). One of the messages from the clients will arrive before the other. That is who gets the item. The other player ends up with zilch.
 
K

Krushnaks

Guest
You might notice this happens in basically all online games with loot containers. The number of times I've tried to take loot in a shared container and someone with a better ping (usually my brother) has gotten it before me...In any case, the item subtraction should be handled server-side (in fact, pretty much everything like that should be handled server-side). One of the messages from the clients will arrive before the other. That is who gets the item. The other player ends up with zilch.
I understand, I forgot to mention that I use the steam p2p system, I understand the theory but I don't know how to put it into practice, in order to avoid the "item dupe".
 
Top