Tag Archive for develop

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

Android开发体会

从我开始学习JAVA和Android编程到现在已经快5个月了,目前有3个免费游戏发布(http://codeand.me)。去年12月份你我买了一个二手(14天机) HTC G1 ¥1200 然后开始了我的Android游戏编程。

我现在的体会是:Android开发在某国确实很难赚钱! 下面我描述一下我的感受,里面的内容都是感受,只不过是我这段时间以来对这个行业的了解和体会,我并没有做过任何详细的统计和调查,请选择性阅读:)

 

1.Android手机的混乱

这是搞技术的人一个很头疼的问题,非常多的屏幕分辨率。用Android Canvas制作的游戏还很难全屏,因为不能直接拉伸,只能自己设定各个图片的相对位置。我在制作“蛋人跳吧”的时候,开始自己用Canvas吧整个游戏都写完了,已经准备发布,在发布前用模拟器做了一下各种分辨率的测试,然后就悲剧了,无法修正的悲剧,后来只能改用AndEngine重写一遍。还有就是在制作“蛋人跳吧”的时候,我的游戏做了一半,我发现了个程序框架上的Bug,无法修复我用的是Lunar lander 那个著名的Android 开发文档里面的例子! 这个有bug的例子尽然坚挺了多年而没有被修复过!这也浪费了我不少时间。

手机硬件的差异还体现在我的新游戏“啊啊啪”上面,一个iPhone声控飞机的克隆游戏。里面用到了AudioRecord来获取麦克风的输入信息,这个游戏果断的在不少手机上面无法运行,在各种手机上面有不同的表现(虽然我后面增加了声音敏感度调节功能)。独立开发者不可能有那么多手机来测试的,最好情况也就3-4个,而Android系统的热卖机型那就数不清了。就算我有那么多的机型可以测试,以一个人的力量或者少数几个人的力量也需要花费非常多的精力来一个个解决这些问题。还有不少问题可能是无法解决的,跟手机硬件相关的。这点确实令人沮丧。

Read more

Android开发资料记录(一)

 

以下资料如果没有注明均为英文资料

Android XML Parser Performance

http://www.developer.com/ws/article.php/10927_3824221_2/Android-XML-Parser-Performance.htm
DOM Pull SAX 方法在Android下的对比。(文中结论:SAX在Android下优于其余两种方法)
下面是一篇关于如何使用sax 从xml文件中载入游戏关卡文件的教程。这个AndEngine论坛里面的文章,但是跟AndEngine关系不大,它适用于所有用sax从xml文件中载入数据。
http://www.andengine.org/forums/tutorials/xml-parsing-within-andengine-t372.html

OpenGL ES Tutorial for Android – Part I – Setting up the view

Per-Erik Bergman 关于Android下OpenGL ES 的系列教程,图文并茂。
http://blog.jayway.com/2009/12/03/opengl-es-tutorial-for-android-part-i/

Why a lot of android game  has own GLSurfaceView.
在很多开源的Android游戏里面你都能找到游戏自己的GLSurfaceView.java,而且跟原生的那个差不多,这个问题困扰了我很久,直到在AndEngine自己的GLSurfaceView.java里面我发现了如下的注释才稍微明白了一点:
// This class is a replacement for the original GLSurfaceView, due to issue:
// http://code.google.com/p/android/issues/detail?id=2828
// Reason: Two sequential Activities using a GLSurfaceView leads to a deadlock in the GLThread!
详细的原因我不太清楚,毕竟没有实践过,但是大概是因为某种原因原生的GLSurfaceView在同一时间只能有一个实例存在,多线程的情况下使用原生的GLSurfaceView可能会出现死锁。这个问题很致命,很多Android游戏运行的时候都会把主逻辑和渲染分开,这样可以提高渲染速度。Replica Island的作者在下面这文章中有详细描述。

Rendering With Two Threads

http://replicaisland.blogspot.com/2009/10/rendering-with-two-threads.html  (需番羽墙)
作者将他游戏的渲染过程独立在一个单独的线程中执行以后,游戏的fps提高了30-40%,这样做的主要原因作者在文章描述如下:
for Replica Island I took a different approach. The problem with the single GLSurfaceView thread is that eglSwapBuffers() must block on the hardware until the previous frame finishes drawing. That means that even if you have nothing to draw, a call to eglSwapBuffers() takes 16.67ms to complete. (And of course, if you have a lot to draw, it could take a lot longer).
并且作者还在文中描述了一种使用双缓冲(double buffer )的方法来解决线程间同步的问题。
这篇文章可以作为 优化 Android 游戏的一个参考。
Replica Island
http://replicaisland.blogspot.com
这个博客是Replica Island这个开源游戏的开发日志,其中包括了很多非常好的Android游戏开发的技术文章和游戏设计文章,作者是Chris Pruett,他在09 10界的Google I/O 会议上面都做了关于Android游戏开发的讲座:2009 http://www.youtube.com/watch?v=U4Bk5rmIpic  2010 http://www.youtube.com/watch?v=7-62tRHLcHk&feature=channel  (两个都需番羽墙

如果有兴趣请阅读:Android开发资料记录(二)