我说的是一款没有得分上限的动作游戏,也没有办法通过重玩动作等方式来验证服务器上的分数。

我真正需要的是在Flash/PHP中最强的加密,以及一种防止人们调用PHP页面而不是通过我的Flash文件的方法。我在过去尝试了一些简单的方法,对一个分数进行多次调用,完成一个校验和/斐波那契序列等,也用Amayeta SWF加密混淆SWF,但他们最终都被黑客入侵了。

感谢StackOverflow的响应,我现在从Adobe找到了更多的信息- http://www.adobe.com/devnet/flashplayer/articles/secure_swf_apps_12.html和https://github.com/mikechambers/as3corelib -我认为我可以使用加密。但我不确定这是否能让我绕过CheatEngine。

我需要知道AS2和AS3的最佳解决方案,如果它们是不同的。

主要的问题似乎是TamperData和LiveHTTP报头,但我知道还有更高级的黑客工具,比如CheatEngine(感谢Mark Webster)


当前回答

我认为最简单的方法是在游戏每次注册一个分数时调用RegisterScore(score)这样的函数,然后对其进行编码、打包并将其作为字符串发送到php脚本。php脚本知道如何正确地解码它。这将停止对php脚本的任何直接调用,因为任何强制得分的尝试都会导致解压错误。

其他回答

您不能相信客户端返回的任何数据。验证需要在服务器端执行。我不是游戏开发者,但我确实制作商业软件。在这两种情况下,都可能涉及金钱,而且人们会破坏客户端混淆技术。

可能会定期将数据发送回服务器并进行一些验证。不要把注意力集中在客户端代码上,即使您的应用程序就在客户端代码上。

The way that a new popular arcade mod does it is that it sends data from the flash to php, back to flash (or reloads it), then back to php. This allows you to do anything you want to compare the data as well bypass post data/decryption hacks and the like. One way that it does this is by assigning 2 randomized values from php into the flash (which you cannot grab or see even if running a realtime flash data grabber), using a mathematical formula to add the score with the random values then checking it using the same formula to reverse it to see if the score matches it when it finally goes to the php at the end. These random values are never visible as well as it also times the transaction taking place and if it's any more than a couple seconds then it also flags it as cheating because it assumes you have stopped the send to try to figure out the randomized values or run the numbers through some type of cipher to return possible random values to compare with the score value.

如果你问我,这似乎是一个很好的解决方案,有人认为使用这种方法有什么问题吗?或者可能的解决方法?

你说的是所谓的“客户信任”问题。因为客户端(在这种现金中,运行在浏览器中的SWF)正在做它设计要做的事情。保存高分。

问题是,你想要确保“保存分数”请求来自你的flash电影,而不是任意的HTTP请求。一种可能的解决方案是在请求时(使用flasm)将服务器生成的令牌编码到SWF中,该令牌必须随请求一起保存高分。一旦服务器保存了该分数,令牌就过期了,不能再用于请求。

这样做的缺点是,用户每次加载flash电影只能提交一个高分——你不得不强迫他们刷新/重新加载SWF,然后他们才能再次播放新的分数。

通过AMFPHP与后端通信可能是个好主意。它至少应该阻止那些试图通过浏览器控制台推送结果的懒人。

没有办法使它完全不可攻击,因为它很容易反编译swf,一个熟练的开发黑客可以跟踪您的代码,并找出如何绕过您可能使用的任何加密系统。

如果你只是想通过使用TamperData这样的简单工具来阻止孩子作弊,那么你可以生成一个加密密钥,在启动时传递给SWF。然后,在将高分传递回PHP代码之前,使用http://code.google.com/p/as3crypto/之类的东西对高分进行加密。然后在服务器端解密,然后将其存储到数据库中。