It is now 4:49 in the morning and I've finally finished

Just opened it back up.

[quote] You still have a problem. The following happen concurrently on the clients:

  • Player 1 removes item #1 and agrees
  • Player 2 agrees to the trade

It is possible that the items arrive in the following order:
Server removes item #1 (Setting state to not accepted)
Server gets “agree” from player #1
Server gets “agree” from player #2
but…
All of that can happen before Player 2 actually sees that Player #1 has removed something from the trade.

You can fix this, you just have to be careful to attach a “what set of items is being agreed to” value to the “agree” requests. [/quote]

Sorry but not fully understanding. If what you mean is player 2 requests an altered trade from player 1 without knowing it, then it won’t matter. He doesn’t know about it so the trade will act with the old data, as each player does the others inventory work.[/quote]

He means due network latency, someone could agree on a trade,
Person A accepts, he’s a honest guy.
Person B accepts, he’s a cheater.
Person A agrees, he likes the trade.
Person B removes an expensive item and quickly agrees.
Server sees twice “agreed” due lag and does the trade.

Simple solution would be, everytime a button gets pressed, it takes one second (serverside) before it actually works.
(That way, the server has time enough to receive “item revoked”-stuff and cancel the trade confirmation)

EDIT: btw very nice system, I aprrove, I approve very much

Ah, thanks but there is something else in place he doesn’t see since he isn’t in game. When both people agree the trade doesn’t happen, instead a final trade button pops up.

In case no one saw you cannot alter the trade after the first agreement so the issue that Einsteink said won’t be an issue.

Currently combining it with the real game so the trading test is down. Will post again when it’s merged, as. I have a ton of work to do combining the systems.