netrunner icon indicating copy to clipboard operation
netrunner copied to clipboard

Fast clicking leads to getting more than 3 Credits from Cache

Open queueseven opened this issue 11 years ago • 8 comments

In a recent game my opponent got 7 credits from Cache. Some sort of timing issue?

queueseven avatar Jul 30 '15 22:07 queueseven

Yes. There is a general issue in that spamming a command will cause multiple messages to be sent to the server, and no checking is done server-side to distinguish between them. You commonly see this with Cache because people click it quickly.

nealterrell avatar Jul 30 '15 22:07 nealterrell

OCTGN has it's CTRL +C for multiple credits, we have this :-)

queueseven avatar Jul 30 '15 22:07 queueseven

The question is if this is worth fixing.

queueseven avatar Jul 30 '15 22:07 queueseven

There is a lock mechanism to prevent this from happening. When a client sends an action to the server, a lock is set. When a game state comes back from the server the lock is removed. While the lock is on, any actions sent from the client is ignored.

This prevents a card from being played multiple time when clicking on it quickly (resulting in duplicate cards in play). It happened very often as playing a card on OCTGN requires a double click. It normally prevents taking too many credits from Cache. A possibility is that your opponent did an action while you were clicking very quickly on Cache. If a game state is received from the opponent's action the lock is unset. A more elaborate lock mechanism could prevent this from happening.

There is also another issue with the current simplistic lock mechanism. When an action causes a serious exception from the game engine, no game state is sent back and the client is locked forever. This gives the impression that the client disconnected although the connection is still there. The only way to unlock it is waiting for the opponent to type in the chat or do any other action to receive a game state.

A timeout on the lock could solve this issue. But it could also lead to an inconsistent game state.

mtgred avatar Aug 07 '15 14:08 mtgred

A possibility is that your opponent did an action while you were clicking very quickly on Cache.

No, it was my opponent that got the credits, and I didn't do any actions in between. He just clicked very fast.

queueseven avatar Aug 07 '15 16:08 queueseven

I just tested this, trying a runner with just 3 Caches in deck. I was able to get 4 credits from the first cache I installed, while every next Cache (including ones I dragged from heap back to my hand) I tried gave me only 3 creds. I was able to reproduce this result next game.

Test was done on live server.

zaroth avatar Dec 17 '15 23:12 zaroth

To quote neal's guess on the cause of the issue:

I see that in -main (which is the production main) two threads are started to listen to the ZMQ socket, but in dev only one thread is going. I wonder if that's why I've never reproduced this on dev.

zaroth avatar Dec 17 '15 23:12 zaroth

fwiw I experienced a similar issue recently where clicking "successful run" twice in rapid succession triggered two successful runs (creds from desperado twice, accessed card in server twice)

strongoose avatar Aug 21 '16 13:08 strongoose