Tag Archive for iPhone

如何相对安全的保存iPhone游戏的分数

介绍一种保存游戏分数(高分)的方法,里面提供了相关的代码。这个方法可以相对安全的保存你的游戏分数,因为现在几乎所有移动平台的游戏都使用了OpenFeint,Game Center一类的社交游戏网络,其中使用最多的功能就是在线排行榜。我在我的两个iPhone游戏(Voice Fighter, Magic Tiles)中均使用了这个方法保存游戏的最高分数,防止游戏最高分数被越狱的用户通过修改游戏文件来作弊。但这个方法防不了那些通过截取网络数据包来改分数的手段。因为整个方法的核心就是加密分数然后保存在本地。

代码部分出自:Cocos2d论坛

方法的过程是:

1.需要保存游戏分数时,有游戏分数H,把H的数据类型转换成字符串:S,在S后加上字符串M作为混淆字符串,现在就得到字符串X(X=S+M).

2.用MD5或者其他加密算法加密字符串X,得到一串密文,把这串密文和H保存在本地文件中.

3.用户程序需要获取H时(比如游戏启动时需要在界面中显示最高分),读取保存密文和H的文件,这样就可以获得H和加密后的密文,现在就对密文进行解密,得到一个数字,用这个数字和H进行对比,如果得到的数字不等于H就证明用户修改过分数,可以选择清零数据;结果相等则通过检查。

Read more

How to Make a Voice Control Game on iPhone

Some of you might play several game using voice to control the game, say “ahhh” to move the role and shout “pah” to shoot something out…

If you hadn’t played a game like that, you must try my game: Voice Fighter

This article will teach you how to use the iPhone SDK to develop the voice control part of these kinds of game. You can use the code from this article to make your own game. But this article will not show you how to make the graphic part of the game. You can use Cocos2d or other game engine to make the rest of the game.

“Voice Control” in this point is not about the “speech recognition” but like the “voice operated switch”. These games receive the information from microphone and do some simple analysis,We will use AVAudioRecorder to receive the information. You must be aware that doing this work has a lot of ways, you can find more information in iphone SDK documents, as I know use AVAudioRecorder is the simplest way, so let’s start!

Read more

Magic Tiles

Magic Tiles for iPhone is available in App Store!

ICON Magic Tiles

iTunes LinkJust $0.99

Caution! Somebody says that they are addicted to this game! :)

 

Read more