views:

61

answers:

2

Hello.

I'm developing a Flash game in ActionScript 2, and the issue if that this game has to count the time securely.

It can't count the time from the Date class because the Flash Player takes the time from the local computer, and the user can change the local time so the time reported would be fake.

I haven't considerend to take the time from the server because there's a 3WH (3 way handshake) time and it would not be practical.

What do you sugest me??

+3  A: 

You cannot perform secure computations on the user's system. They can manipulate it.

If that is a problem, your only real choice is to do it on the server. Of course, they could sandbox your app and fake a server conversation, so that's not entirely secure from within the client, but in most cases that won't cause a big problem since it should just affect that user (unless the data from the manipulated/forged server connection is then sent somewhere to affect other users).

Michael E
I used AES to secure the comunication so the data can't be faked... buy the real problem it's to report a real time... I can't use date class to make a substraction of final time minus initial time in milliseconds... what can you recomend me??
Jean Paul
If you embed the key for AES in your flash code you are giving it to the player - if they disassemble the flash code they will be able to cheat. Or they could simply use the Cheat Engine.
Simon Groenewolt
By fortune I didn't make that mistake... of couse the key isn't in the source code of the game... it is created using Base54, MD5 and a custom algorithm mixing in an unique way multiple variables among the user name,,, the md5 of the password... the IP address and a token code... that isn't what worries my... what worries my it's the time hanlde but I found a way to use the FPS (Frames per Second) rate of the Flash Player to create a pseudo time-meter
Jean Paul
+1  A: 

When you are developing games that run on a system that you do not control there is basically no solution, you can make it hard for people but you can never be certain unless you basically modify your game to run on the server for all important parts. Even if you would make the game call the server for the time only people can insert a proxy and fake the response...

So is you really want to be sure no one messes with the game you have to make it run on the server (I know, lots of the time this is unwanted and/or impossible). In all other cases you can make it hard (obfuscate game code, encrypt communication) but never impossible - see google for lots of suggestions on making it hard, or see here and here.

The best way of solving the issue is to remove the incentive for players to cheat, so they simply won't try it at all -- of course lots of the time this is really hard.

See also: Cheat Engine, in case you didn't know about that one.

Simon Groenewolt