0
\$\begingroup\$

I'm currently working on a board social game using HTML5 (canvas) & Asp.net MVC 4, Azure, Sql server, EF.
I'd like to do a server side realtime validation (using Ajax) of a player moves (not more than one every 2 seconds).
The problem is that I can't allow a communication to be longer than 200 ms (time of the client side animation). On the server side I have to go to the database to do the validation.
I'm not sure that it is possible to keep a good communication speed over time with a growing community.

What would be a better scenario ?


Edit:
An other possibility would be to load the grid answers on the grid load but then every player with a bit of firebug background could get the answers with no pain.. Then I'm forced to go server side. Maybe the best would be to load in the web role memory all the grids to not have to go to the database.

Another scenario could be:
1 ajax request to check in the server memory the grid solution
1 ajax request to confirm the player move in database
but it's not cheater safe neither..


Thank for your help

David

\$\endgroup\$
  • 1
    \$\begingroup\$ A better scenario would be one where you didn't have to limit yourself to 200 ms. Can you explain what kind of answer you're expecting here? This seems to be a very broad/open ended. \$\endgroup\$ – MichaelHouse Jul 31 '13 at 14:08
  • \$\begingroup\$ I'm looking for a good technical idea :-) I edited my initial question with some more scenarios. \$\endgroup\$ – Davidet Jul 31 '13 at 14:25
2
\$\begingroup\$

I'm not sure that it is possible to keep a good communication speed over time with a growing community.

You have limited control over this.

The problem is that I can't allow a communication to be longer than 200 ms (time of the client side animation). On the server side I have to go to the database to do the validation.

100 ms ping is short enough where you are going to really cut into your potential user base including all of the below.

  • Anyone from another country

  • People in remote areas from your country

  • Anyone with satilight internet

  • 3G phones

  • 4G phones

The standard solution is to have enough logic client side to let the game proceed normally. Verify after every move and if you detect an illegal move it means it means someone is spoofing requests.

In this case it is perfectly fine to disrupt the game and reset it to the last valid state. You might also want to send back a “don’t cheat” warning and have a 3 strikes you’re banned sort of thing.

\$\endgroup\$
  • \$\begingroup\$ As it's an HTML/JS application I can't trust the client.. then it's impossible to use only client side to verify the move validity. That's the root of the problem \$\endgroup\$ – Davidet Jul 31 '13 at 15:37
  • \$\begingroup\$ @Davidesan Please reread my answer. \$\endgroup\$ – ClassicThunder Jul 31 '13 at 15:51
  • \$\begingroup\$ I'm suggesting both. Let the client do what ever with the server verifying after every move. However, there is no point in blocking to wait for verification. If the server ever notices an invalid move it knows that there is request spoofing and can send back the last valid board state and repremand the spoofer. \$\endgroup\$ – ClassicThunder Jul 31 '13 at 15:53
  • 1
    \$\begingroup\$ Point is technically you can’t guarantee 200 ms round trip even with no server load. Blocking to wait for validation will be disruptive so simply allow the game to proceed and only disrupt if an illegal move occurs. \$\endgroup\$ – ClassicThunder Jul 31 '13 at 15:56
  • \$\begingroup\$ Using Firebug, use the "NET" tab to see the ms required for even simple HTTP transactions. On a University network where the pings are 10-30ms, I show even small GET requests on this site that range from 20ms to 200+ms. You can certainly demand players have less than 200ms communication times, but the effect will be losing 10-90% of potential players, and 99%+ of your players will face regular annoyance from even minor network problems. In short, ClassicThunder's suggestion is correct - let the client assume what it wants, but verify server-side without time-restriction. \$\endgroup\$ – BrianH Jul 31 '13 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.