lördag 5 mars 2016

SignalR laboration: Reaction Time Game

About two years ago I decided to learn the basics of SignalR by doing a small laboration. The laboration became this Reaction Time Game where the players try to be the fastest to click a button after it has changed color from yellow to green. It has a high score list and a chat.

When playing on my smart phone, a Samsung S3, it is impossible to get an good honest reaction time registration. On the computer I get around 300 ms and on the phone around 800 ms, I'm not sure why this is the case. Maybe because of less CPU power, slower wifi or slow tap registration on the screen?

Of course @ordbajsarn had to hack it almost at once. The SignalR hub sends a signal to all clients when it's time for the button to change color. He changed the java script on his client to simulate a click on the button as soon as the color-change signal was received. This way he got really low reaction times registered on the server side. I guess I could guard against this by setting a limit on how many times in a row a client is allowed to have an unreasonable low reaction time. But the code is open source now and therefore a user can see whatever cheat guards are used. So, two questions from this laboration is: is it possible to have the source code open and still catch cheaters? How then?

Btw, the repository is here.

Inga kommentarer:

Skicka en kommentar