Asset sharing with Dropbox

Our team is going to use Dropbox to share the game assets;


Fixing "cocos-ext.h" not found issue

When using the Cocos2d-extension (e.g ScrollView, Button) on my project, 

I found that it is okay to compile in Xcode but not in Android; 
It said cannot found "cocos-ext.h"

The case is easy because Android.mk in the extension folder is configured wrong;

File location: cocos2d-x/extension/Android.mk

Orignal setting: 
                           $(LOCAL_PATH) \
                           $(LOCAL_PATH)/GUI/CCControlExtension \

Correct one should:  $(LOCAL_PATH) is added
                           $(LOCAL_PATH) \
                           $(LOCAL_PATH)/GUI/CCControlExtension \


Setup Android Project on Cocos2d-x 3.0

Important things need to make cocos2d-x android project running

1. Make sure the Android SDK (ADT) and NDK ready 

2. Configure the Android.mk 

Need to config the following variables:

  • LOCAL_SRC_FILES : Because we may have more sources than the "HelloWorld" project
  • LOCAL_C_INCLUDES: The related header files will be searched by the compiler
  • LOCAL_WHOLE_STATIC_LIBRARIES: Our project may not need the sdk given
  • $(call import-module, moduleName) : Need to match with the LOCAL_WHOLE_STATIC_LIBRARIES

3. Configure the AndroidManifest correctly 

Need to config these two variables:

  • <uses-sdk android:minSdkVersion="9"/>  : Need to "9" or above to use Native Activity
  • <meta-data android:name="android.app.lib_name" android:value="App" /> : it will link to your native library called "libApp.so"

4. Copy the java source to proj.android

5. Prepare Eclipse to import the android project

Other Troubleshooting

Unable to load native library: "xxx.so"

Problem: Fail to define the native library
Solution: config the library name correctly in AndroidManifest.xml

For example: your library is libs/armeabi/libGame.so
the value defined in AndroidManifest.xml should be like the following:
<meta-data android:name="android.app.lib_name" android:value="Game" /> 
Note: No need to define the path, extension, and 'lib' prefix;

LogCat said "dvmFindClassByName rejecting 'org/cocos2dx/lib/Cocos2dxHelper"

Problem: Missing the java source folder
Solution:  http://www.cocos2d-x.org/forums/6/topics/36265


List of Patches for Cocos2d iphone

Here are the solutions for the problem you may encounter when using Cocos2d-iphone with CocosBuilder Extension.

Cocos2d-iphone Version: 2.0.0
CCBReader: v3

1. CCScrollView not showing and handle touch correct if the parent position is not CGZero

2. CCLayerColor and CCLayerGradient cannot  show color

3. CCControl doesn't change to Disable Look when control.enable = NO


List of "Got Stuck"

This is the list of technical issue that I got stuck :

Install pecl_http on Mac (MAMP) / 18 Nov 2013 

Work around Solution: using curl function instead

More Information:

  • PHP about PECL_HTTP: http://us3.php.net/manual/en/http.install.php
  • CURL Usage: http://us3.php.net/manual/en/book.curl.php


PHP Not Refresh

If you are using MAMP & Php 5.5.3, and found that the php logic is not updated; Try to close the cache config; See more at here: http://stackoverflow.com/questions/19079089/mamp-time-between-seeing-live-changes


Fixing CCBReader v.3 with Cocos2d-iphone v2.0.0

1. Occur Exception at CCLayer

Add the “setTouchEnable” method to CCLayer(at CCLayer.m)

- (void)setTouchEnabled:(BOOL)enabled
     [self setIsTouchEnabled:enabled];

2. Cannot see CCLayerColor properly
Add the follow code segment in CCBReader just before the code "if ([node isKindOfClass:[CCBFile class]])” in the method called "(CCNode*) readNodeGraphParent:(CCNode*)parent"

if([node isKindOfClass:[CCLayerColor class]]){
     [(CCLayerColor *)node setOpacity:255];

3. Cannot see CCLayerGradient properly

Add the “init” method to CCLayerGradient  (at CCLayer.m)
- (id) init
     return [self initWithColor:ccc4(0, 0, 0, 255) fadingTo:ccc4(0, 0, 0, 255)];

4. CCControl doesn't change to Disable Look when control.enable = NO

Problem: When CCBReader generate the ccbi, it use "3" as the disable state, but it is "4" is iOS now;

Place the following in "CCBReader.m" at Method "readPropertyForNode" right before "if ([node isKindOfClass:[CCBFile class]])"

// Fix for DisableState
 if ([node isKindOfClass:[CCControl class]]) {
  // the disable state value is wrong!!!!
  //  CCBReader use 3 as CCControlStateDisabled, but it is 4 in iOS now
  // Change "|3" -> "|4"
  name = [name stringByReplacingOccurrencesOfString:@"|3" withString:@"|4"];

Remark CocosBuilder is an user interface builder worth to integrate to your project; It can make your code more tidy and easy to modify later. This is the screen capture of the Demo GUI using CocosBuilder.


Fixing CCBReader problem for CCScale9Sprite

Today, when making some unit tests to check the behaviour of the CCBReader (CocosBuilder Reader); 
Found 2 issues when adding a CCScale9Sprite to the Interface;

1. Crash if the interface included a CCScale9Sprite Node:

2. The CCScale9Sprite Node have a wrong opacity setting

Hope this small pieces of information helps







** 秘訣:當工作的時候,要感恩當刻的生活有一定保障;出糧時候,也記得興祝一番吧!



** 秘訣:多多整理和紀錄你工作學習了的知識或技能,當你自己回顧或準備面試,必有意外驚喜!


把工作做好,就能給你成就,自己更能肯定自己,也能得到別人的認同和稱讚;不要把成就看未一件很宏大的事情;例如為公司的產品清理程序BUG, 提升品質,是一項成就;建立一個好的團隊,也是一項成就;


** 秘訣:多制定目標,並把它們達成;也可以利用社交工具(微博或Twitter)等,紀錄和分享一下;



** 秘訣:三人行必有我師,讓你的工作夥伴成為你的良師益友;

經歷神 (信耶穌的人獨有)


** 秘訣:應當仰望神,因他笑臉幫助我;我還要稱讚他(詩篇42:5)



Again?! What's a good game?

My company and I develop games for years; We always say "good games
make good returns"; However, what is a good game? We really don't have an good answer; Actually, I was making several games last few years but they are not good enough.

While I rethink about the definition of "GOOD", I remember the games I enjoyed and loved in my life. They recall me what are the elements of a "GOOD" game!

Here they are:

  • Comfortable to play
  • Attractive Story or Scene
  • Things to unlock
  • Skill to master
  • Make me great!
  • Killing my time happily
  • Beatable Challenges 
  • Wow! That's amazing!
  • My princess is waiting for me!
PS: No more explanation about the points above, it should be straight forward if you play or make games. 


遊戲製作人需要具备的 5 项特質

1. 視野



注:沒有異象,民就放肆; (箴言29:18)

2. 魅力




作品未成的時候,怎樣做到?可以很多方法,找你的朋友親人,透過Internet, 社交網絡, ….
最近在 Kickstarter 有2個遊戲項目,Project Phoneix 和 Mighty No.9 就在說吸引玩家投資他們的遊戲;

注:在信的人,凡事都能 (馬可福音9:23)

3. 親和力

製作遊戲時候,會出現這些情況:為了一些決定而爭執,因為進度落後而士氣低落,因為老闆試壓而感到疲累,因為沒有玩家感覺挫折,.... ; 實現夢想的過程,總是苦的;(當然開始時候,感覺很甜);



注:溫柔的人有福了,因為他們必承受地土 (馬太福音5:5)

4. 胸襟


注:將能,而君不御者,勝! (孫子,謀攻篇)

5. 毅力






終於申請離職了,下個月轉去新的公司; 這次的決定是對,但是執行上卻很錯,需要好好記得這次的經歷和教訓; 決定是對,因為我配合不了公司的情況,留下來發揮也不大,鍛煉機會也不多,而且核心價值和自己有點不同; 執行的時間和做法不對,其實我可以先辭職,後找機會;這樣雖然冒險一點,但是這樣不會得失現在的公司,離職時間可更有彈性, 而且在找機會時候,也能順便休息,整頓一下自己,未未來重現出發; 不過事情既然決定了,就不能回頭,我要繼續好好工作,好好生活,依靠神積極面對困難和挑戰! ! !


C++ Study: Implements String trim()

This code snippet show how to trim a string (remove whitespace at the beginning and end of the string);
The implementation is inspired by Poco Library

std::string trim(std::string input) 
 int first = 0;
 int last = input.size() - 1;
 while (first <= last && isspace(input[first])) { first++; }
 while (last >= first && isspace(input[last])) { last--; }

   return input.substr(first, (last - first + 1));

Testing for Syntax Highlighter

This article shows my testing or Syntax Highlighter in Blogger

Thanks to:

void testSimple()  
        queue q;

        while(! q.empty()){
                string str =  q.front();
                cout << "data=" << str << "\n";


7 things to be done when start making an APP

1. Version Control System (VCS) ready 

Version Control System is a very important things for every APP developers, it helps to keep track of the development history and changes; It is not a MUST, but you may be regret if not adopt any VCS; 

The two famous VCS are GIT and SVN; And the two famous public repositories are GitHub and BitBucket;  

Related Links:
  • GIT: http://git-scm.com/
  • SVN: http://subversion.tigris.org/ 
  • Repository: 
    • https://github.com/
    • https://bitbucket.org/

2. KM and PM Tools Ready

KM and PM are Knowledge Management and Project Management respectively; The tools for these two are important because, During the APP development, you need know the Road Map, which are what is the stuff to going to do, and when should be done right now. 

I am using MediaWiki for KM and Redmine for PM 

Related Links:
  • http://www.mediawiki.org/wiki/MediaWiki
  • http://www.redmine.org/ 

3. Code style

Code Style is a important thing for program; A consistent style can help coders code efficiently because they can understand other codes quickly (no need to ask or check docs). 

Related Links:
  • http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
  • http://www.oracle.com/technetwork/java/codeconvtoc-136057.html

4. Naming Convention

Naming Convention (or called Naming Rules) are the rules how coders names the variable, class, package, ….; It is important because we are all humans not machines; If the "java.util.Random" class named as "java.xx.AA", you are hardly guess the behaviours of the class. It is also an important section inside the Code Style; 

The followings are the parts should be defined:
  • Namespace (named as Package in java)
  • Class Prefix, Suffix
      (for example: GL Prefix mean Graphics Library module, View suffix mean this is a view class) 
  • Variable Prefix, Suffix
     (for example: str Prefix mean it is a string)
Related Links:

5. Program structure and folder structure

Folder structure is that clarifying how different kinds of files should be placed; To make a good program, we need to organise the source and project files properly; The more chaotic it is, the harder 
to manage the program project. 

This is an example of program structure
  • log.txt - development logs
  • docs/ - documents related to the project
  • src/ - source code folder
  • res/ - resource folder
  • res/gui/ - resource related to GUI
  • res/sound/ - sound resource

6. Make a very simple runnable program

This is my practice of start a software project. I make a very short and simple program so that I can make sure compile, build and run doing properly. This can make sure the development environment is setup successfully. "Build and run" is a good starting point of the coding activities;

7. Setup TDD coding facility

Once a program can be built and run. I will immediate add unit test related sources and library, such as  JUnit. For project involving graphics stuff, I will write some codes help testing the some graphics modules. Once it is done, it let you to write and test small pieces of code, which is the TDD practice;



Key Tasks of cocos2d-x development

Setup Development Environment

  • Make the iOS binary (.ipa), run on Simulator and Device
  • Make the Android binary (.apk), run on Device

Seek and Read References

  • Reference of Cocos2d-x
  • Reference of C++
  • Reference of POCO library

Create Testing Code

  • Create UnitTest for Logic (text mode stuff), suggest to use UnitTest++
  • Create UnitTest for GUI or Graphics stuff

Create Architecture / Utility / General Code

  • Clarify how MVC architecture work
  • Create Data Class
  • Create a singleton class
  • Make and understand Useful MACROs

Manage GUI, Graphics and Scene 

  • About GUI 
    • Custom View
    • Popup View
    • Fullscreen View
    • TableView
    • Scrollable View
    • Using Cocos builder to create the views
    • Gallery View
    • Loading View
  • About Graphics
    • Render Sprites
    • Render Maps
    • Render something you want to
    • Controlling the zoom and location of the Camera
  • About Scene
    • Add a new scene
    • Switch between scenes

Network Stuff

  • Connect using Socket or HTTP
  • Adding Network Protocol
    • Create Requests
    • Handle Response
    • Handle Network errors
  • Testing the network protocol

Debugging and Profiling

  • Check the potential problem
  • Check memory leak
  • Check the performance using profiler
  • Locate where and when will crash the app


  • Create different kinds of build using Makefile/build.xml/.… 
  •  Publish the app (ipa or apk) using TestFlight


Tools that we need in a software projects

When running a project, there are lots of tools that we need in order make the project running smoothly and efficiently.

Knowledge And Asset Sharing

In a software project, knowledge is one of the most important things every one need to know. That includes the project requirements, frequently use information, KNOW-HOW and tips;
For asset, many software need many assets to build; For example, UI graphics, sound, text data, ..

My Tool: Media Wiki
Media Wiki a Knowledge Database; It helps to share specification, tips, requirements, team contacts, ...

Comments: MediaWiki is a really good stuff to share information and idea

Source Control

Source control is a very important things for programmers; It helps to share and collaborate codes with others and help to keep track of the code change history; Every professional programmers use Source Control.

My Tool: SVN and Will be GIT
- The best choice of source control before GIT. Many developers still using it. Its concept is more simple than GIT but it is not good for users to branch and merge stuff.

- The new fashion source control system and its design is really good

Comments: MediaWiki is a really good stuff to share information and idea

Project Management and Bug Track System

The management of a software project is complicated, many parties may be involved. So a PM tool is necessary to help different parties know their TODO list. This helps the project deliverable get done on time. Also, a bug track system is very useful to log the bugs, prioritize them and get ride of them based on the priority.

My Tool: Redmine
Redmine is a tool that help organize tasks and assigning to different people. It has the parent / sub tasks feature so that we can break down a big task to smaller one which helps easier to manage;

Comments: I use it to manage bugs and taskses; The team is more efficient because they what they need to do.

To run a project successfully, unless the team size is less than two (solo team); The most important thing is not the toolset, it is the communication between team members; Therefore it is important to keep things simple, the more tools we adopted, this increase the complexity to communicate; Tools are helping team members to communicate and collaborate; Face to face communicate always be the best one;


About my Cocos2d-x game project

I am working on a new project using Cocos2d-x. There are some notes about the development.

Reasons why using Cocos2d-x:

  • This is a cross-platform engine; easy to port to Android and iOS with one set of Source.
  • It has a lots of documents, samples, books and supports
  • Some team in our company use it
The parts of Cocos being used:
  • Memory Management (CCObject has retain/release behaviour like objective-c)
  • String Utility
  • File Utility
  • BatchSpriteNode
  • GUI Nodes uisng Cocos buidler
  • Particle Systems
  • HTTP
  • Animation Action Handling
  • Screen Auto-fit
  • GUI Components
  • Zip/Unzip support
  • Audio Support
The parts implemented by ourselves:
  • Sprite Rendering with skin support (because need to integrate with our existing data)
  • Map Rendering (also need to integrate with the existing data)
  • Protocol decoding
  • In-game controls
  • Special UI Components
    • Full View
    • Popup View
    • Tab view
    • RichText Label
    • RichText Input
The parts using the 3rd parties:
  • Game Content Patching (using vcdiff protocol and xdelta)
  • Thread (using Poco::Thread)
  • Socket (using Poco::Network)
  • A* Path finding
  • Unit Testing (using UnitTest++, this is really good)
The tools have used:
  • In house
    • Sprite and Animation Editor
    • 2D Tile Map Editor
    • Game Event Editor 
  • 3rd parties
    • Cocosbuilder

The things I want to try:
  • Sprite and Animation of cocos2d
  • Texture packer
  • Run the Unit Test without starting the simulator
  • Profiling Tools
  • Other texture formats: ETC, PVRTC
(will update if there are something new!!)


Check points for a new game mechanic design

From my game development experience, I found that there always had problems while making a new game mechanic design.

Here are the main problems: 
  • The mechanic doesn't drive player attention;
  • The mechanic doesn't help user retention, drive income, and make surprise;
  • The programmer and artists cannot figure out what to do based on the design;
  • Cannot work out the UI/UX based on the design;

So check points for different parties:

Producer and Operations:
  • Is the mechanic worth to work out? (..  ROI) 
  • Can user retention be improved?
  • Can it drive income and How much will be?
  • Can the new mechanic cohere the main gameplay?

UI & UX:
  • Can work out the game flow based on the design?
  • How the new mechanics associate with other UIs?
  • When will user learn it and How can to learn?

  • Can the design tell the assets need to produced based?
  • Can the assets production meet the deadline?

  • Can work out data design based on the game mechanic?
  • Can work out program flow based on the game mechanic?
  • Is the mechanic contradict itself?
  • Is the mechanic too complex so that it is gold plating (over-polish)?
  • Can the implementation and testing meet the deadline?


Cocos2dx Study Checklist

Start learning Cocos2dx this week (End of May 2013)

Here is the checklist to be studies

  • [ ok ] Hello World
  • [ ok] Setting up TDD framework
  • [ ] Using CCMenu
  • [ ok ] Building iOS and Android using the same source code
  • [ ok ] Understanding the Coordinate System of Cocos2d
  • [ ] Memory Management
  • [ ] Make a CCNode/CCLayer Scrollable
  • [ ] Make a custom CCNode
  • [ ] Understand the SELECTOR (Method Pointer) 

Will keep update this checklist!!




  • 引擎类:
    • Cocos2Dx
    • Unity3D
    • OpenGL
  •  语言
    • C++
    • Lua
  •  工具
    • Spine - 2D动画工具
    • Tiled - 地图工具
  • 开发技巧
    • Test Driven Development
    • MVC Design





但是在 神凡是都能,圣经 (诗篇84篇) 说:
 如 此 住 在 你 殿 中 的 便 為 有 福 ! 他 們 仍 要 讚 美 你 。 ( 細 拉 )
  靠 你 有 力 量 、 心 中 想 往 錫 安 大 道 的 , 這 人 便 為 有 福
我们可以任何看来不能“安息”的情景,在神的同在,在神的殿 中着安息,得着祝福;
就算我们不能做到, 我们可以靠着 主耶稣 得着力量,走到可以与神同在的境界;




  • ヤスダスズヒト
    •  作品:Digimon Digitize Recode
  • 岸田メル
    • 作品:艾丝嘉的练金工房
  • Yansquare
    • http://bbs.rohome.net/thread-915012-1-1.html


编程常用的SDK - Java (持续更新中)


  • CSV
  • JSON
  • XML
  • doc
  • xls


  • Junit 

用户界面 GUI

  • Swing
  • SWT 




  • Log4j


  • png
  • jpeg





其实神吩咐我们认识他,其实也是对我们很大的祝福; 圣经充满了神的话和他留下的智慧,还有很多美好的价值观;例如叫我们不用过度忧虑,叫我们要常常喜乐,不住祷告,凡是谢恩,考顺父母,爱护及教导儿女;叫我们不要贪心,不要粗暴,不要凶残等等;




箴言 ~ 使人曉得智慧的書卷

  • 令人領受教訓;学习公義、公正和正直;
  • 令人變成精明,獲得知識和明辨的能力;
  • 令人增長學問,獲得智謀;
  • 令人懂得智慧人的言詞和他們的隱語(神的奥秘);

** 箴言 1:1-6 - 箴言的功用 **

Bible Collections