Living and Programming - YJ Park's Blog

Marmalade Tricks and Tips

| Comments

During the days to develop our first game: Day Day Birds, I went through the progress of learning to use Marmalade, generally it’s very easy to use, and save me lot of time, though there are some little things that I hoped that I know earlier.

Stack Size

The game started to crash randomly before I noticed, it’s quite hard to debug, especially without the tools in Xcode or other IDEs provide. And it never crash in the simulator, so the debugging is quite awkward, a lot of guess, build, test-run going on.

When it crashed on iOS device, some information were provided, though full stack trace is not availabe, and the place of crash is not consistent. After 2 or 3 days and nights figihting with this bug, finally found out the root cause, which is very surprising.

Initial Release of s3eBass - Marmalade extension for BASS audio engine

| Comments

The audio and music are playing a very important role in games, for our future games, I want them to have good quality of audio and music, e.g. don’t use short loop of mp3 music, but something much longer and more dynamic without taking much space. My first thought is to use MIDI+soundfonts or some mod-based music, so I spent some time to try to see the possibility.

There are quite some libraries to support xm playback, though I can’t find any Marmalade extensions on the web, in the forum someone mentioned that they made use of FMOD in their game, though there is no code shared, and FMOD is quite expansive.

After some search, I decided to use BASS audio engine, which is quite powerful, with well designed API, not bad documentation and sample, and a reasonable price for small projects (the shareware license can cover product with small price).

Now I’ve got a working extension(though the only test I did was to play a xm file on OSX, iOS and Android), think other people maybe interesting in the extension or how to create similar extensions, so I’m going to share the extension and some experiences I’ve learn from the process(not in this post).

Convert Cocos2D Font (BMFont) to Marmalade’s GxFont

| Comments

In 2D games, it’s typical to use image based font for UI elements, which can provide better graphic result, fast rendering, and usually smaller then true type fonts (especially if you want to support languages with big character set, e.g. Chinese).

There are quite some tools to generate such font images, I’m using bmGlyph as the font generator, it can publish the popular “Cocos2d / BMFont” format, though it’s not directly usable in Marmalade.

Marmalade is using its own font format, and provide a font generator in the SDK, though it only support plain color, and when I feed it with some Chinese characators, they are not included in the generated files. I’m using the OS X version of the font builder, not sure about how the Windows version works.

My first thought was to add function to use the BMFont generated, though it’s not an easy task, also I want to use IwGame’s label components, which are based on Marmalade’s GxFont and Truetype support.

After reading GxFont Reference, turns out it’s using a fairly simple format, so I decided to write a converter to create gxfont files.

OpenGL ES 2.0 Shader in Marmalade

| Comments

Marmalade provide good support for writing custom shaders in it, though it’s not easy to get all the information to start writing the first shader in my case, here is some information that I gathered during the process.

I decided to only support Open GL 2.0 Shaders in our games, most current devices support it, and as a small team, supporting older devices is a bit hard since we don’t have testers for now, also the architect of 2.0 is simpler and cleaner.

The sample shader’s function is to replace non-transparent part of the image to a given color, then the color can be changed programmingly (also by xml thanks to IwGame). Basically the images will be just working as masks, the actually color to be rendered are controlled by the shader.

I will not cover the basics about Open GL Shaders, there are plenty of information on the web about that, also a PDF doc is included in Marmalade installation, it’s a good start point to me, you should read it first to get the concepts.

Game Engine Based on Marmalade and IwGame

| Comments

Since August 2012, 2 developers(including me) and 2 graphic designers come together and started a small game studio to work on some mobile casual games, as the tech lead, I need to choose a development way for our first batch of games.

Our games will be mostly 2D games, might with some 3D charactors, though the scenes or levels will be 2D, I think that’s better for the team and the graphic quality of the games.

After quite some readings and experiments, I finally have a clear idea about how we gonna build these games, We will create our small game engine, on top of Marmalade and IwGame.

Why choose Marmalade?

I did have quite some experience on cocos2d, though it’s been ruled out pretty quickly. I want our game to work on multiple platforms, since we don’t use much platform-specific features, we don’t get much with objective-c. Also personally I am not really a big fan of cocos2d, it’s kind of a simple framework with good quality, though missing some of the features I want with a solid framework, e.g. Tool or Markup for graphic scene editor, I’ve tried Cocos Builder and Level Helper very breifly, might be just me, but I don’t like neither one. A similar option is to go with cocos2d-x, which is cross platform, but because of similar reason, I didn’t dig into it deeply.

The second option is Unity3d, I’ve used it for about 3 months before, It’s pretty good, easy to use, and have a hugh community with tons of good plugins. My biggest concern about it is the binary format of the prefebs, it’s a bit like the xib file in App development, hard to change and track, as a developer, I want a text based format. Also don’t really think the .Net virtual machine is the best way for our rather small games. My feeling is that it’s more like a tool for game designers and graphic designers, as developers, we gave up full control in exchange with a full-feature game development environment. And also it’s mostly 3D centric, 2D works are possible, but a bit awkard, since we don’t need the 3D power and I want more control with my codes, I did not take this path either.

PettyFun 游戏工作室成立了!

| Comments

一点小小的历史

之前工作的公司是做外包的,因为环境和人都不错,在那里工作了好几年。渐渐的由一个独自写代码的程序员,认识了很多同行,接触了开源技术,开始做技术管理,和不少面试培训的工作。过程中学到了很多,也对自己能做些什么,有那些长处开始有了信心。

外包的好处是比较清闲,压力并不大,在技术和流程上做的相对比较完善,然而外包最大的问题是实质上是不鼓励程序员有太高的效率的。由于技术难度和工作效率的难以衡量,很难判断是效率高低还是项目难易的关系导致的工作时间的变化。虽然业内都会同意好的程序员和差的程序员的生产率会有数十倍的差距,然而外包的很大出发点就是节约成本,想给好的程序员提供有吸引力的条件是很难的。

我们做的是个长期项目,基本是按人数计算收入的,也就是说在客户关系正常的情况下,项目组的人数越多,公司得到的收入也就越多。因此,运作的模式基本是比较好的程序员倾向于成为技术组长,把大量的时间花在如何让其他能力不够强的程序员正常工作上,具体说来就是大量的代码审查。

读别人的代码,并提出意见,最终改善的过程,对于程序员来说是个很好的学习提高的过程,我也做了很久。但是工作的内容往往技术含量并不高,受到扩大规模的压力,进人的标准也渐渐放低,感觉自己做的事越来越没有意思,虽然通过业余时间做了些纯技术的学习,然而已经感觉在工作中没有热情了。

公司在iPhone刚出来不久就开始了产品开发的尝试,选择的方向是游戏,做了两款小型游戏,有些进展,然而收入不够理想,老板把方向调整为社交相关的方向,不过产品开发过程有点纠结,花了相当长的时间做了一款相对比较大的产品。(最终结果还是很好,产品有自己的创意,相当成功)

PlantUML Plugin for Octopress

| Comments

What is PlantUML?

PlantUML is a component that allows to quickly write:

  • sequence diagram,
  • use case diagram,
  • class diagram,
  • activity diagram,
  • component diagram,
  • state diagram
  • object diagram

I really like the idea of writing UML diagram with plain text. Since it’s totally plaintext, it’s very easy to do diff and version track, also you don’t need to do anything about the layout (the text itself looks pretty good too).

Also the syntax of it is very well designed, and the generated diagrams looks really nice, so I use PlantUML for technical documentation with trac and sphinx.

The Plugin

After switching Octopress to my blog platform, I was looking for a way to integrate PlantUML within it, though I can’t find one, so I wrote this very simple jekyll plugin (Octopress is based on Jekyll).

jekyll-plantuml

Movable Write Open Sourced

| Comments

What is Movable Write

Back in 2010, I already had some experiences on iOS development. Did wrote some very simple application to fetch information over HTTP-RPC to a trac instance, and wrote a very simple game with Cocos2D and Box2D. Did spend some time to catch up with the versions or iOS updates and read about the new APIs.

But my feeling was that by only spend small amount of time like it, I can never learn enough to have real experience on it, and I’ve been working on Web development for a few years. So I decided to work part-time in the company, and use the other half time to develop a real application, by real I mean with proper quality and released at app-store.

I just got a iPad1 as development device, and tried a few apps, I liked note plus a lot, it’s very powerful, but a bit too powerful for my need, I want to write words most of the time, and I want to write largely, but view the written lines small.

So I decided to write a note taking app for myself, after 3 months, Movable Write was released at app store.