Wednesday, October 21, 2009

Initial findings.

I gave the irrlicht engine a full lyposuction. Removed all of the modules that I thought I would not be using, like those dozen mesh formats, a dozen image formats, keeping only the 3DS mesh format and created the compressed png loader for the iphone. Next step would be to create a pvr texture format. But before that I ran a few tests. I rendered a 100 cubes in the wireframe mode with just vertex colors. What did I find?

Sadly, a meager 20fps. I found the total number of primitives that were being rendered were 1242. 1200 for the triangles and the rest for the text which I used to render the framerate and the primitive count. Now today I will do some more tests using the cpu sample that comes with the sdk and see which are the bottlenecks in the engine.

Will post the results soon.

Labels:

Tuesday, October 20, 2009

Iphone 3D graphics Engine.

Now that one of my games is gone for approval on the appstore, I was kind of tinkering around with what can be done on the iPhone. Now till date I used the Cocos2D Engine which is fine by all means for any 2D game. But some how the inability to have the flexibility offered by C++ (esp. template classes and stl), I was beginning to wonder what other alternatives I could have if I go out to develop anything on the iPhone. So after cranking up the old trustworthy google, I found these options.

1) SiO2 - Considerably complex, has everything I needed (actually more than what I needed), but when looked at the some of the samples it wasn't as appealing as it was when I went out to hunt for the 2D Engine. Cocos2D pretty much sold me out when I looked at it first. Simple Api and decent performance.

2)Unity - Commercial, excellent and expensive. (Since this research was intended for me to learn a bit more on how to write good optimal code on the iPhone, I crossed that out because it is already well optimized and frankly I dont have the money to buy the full source code license).

3) Torque - Same reason as Unity

4) Oolong - Amazing graphics renderer. I cannot consider this to be a full engine because it is kind of tied around the Pod scene format. I am not against the Pod scene format, its just that I couldn't figure out how to export the damn pod scene format. So I kind of gave up on using this as an engine. Plus there is no abstraction to the opengl calls. I mean you pretty much have to write a lot of code to just get a barebone scene graph going. But OOlong presented its strong points too. The Engine is blazing fast. The underlying math code is awesome. All kinds of vfp (the assembly that iphone understands) optimizations. But it kind of leaves you wishing for more.

Now here is twist in the story. As aspiring game developer I was in a love affair with an engine which ever since the version 0.7 has been close to my heart. Now at version 1.6 this engine by Nikolaus Gebhardt (I hope i spelled the name correctly), irrlicht had blossomed into a nice little complete graphics engine. Irrlicht had a vital role to play in my game development career, and since it was written in a very clean abstracted way, I thought why not give it a spin on the iphone, and i did. I would post the results of that soon.

Now that I had a working 3D engine on the iphone which I was comfortable with, I ran some tests. I created a terrain octree and added a couple of meshes and a fire particle system. What I found as the end result had mixed emotions for me. After skimming through the forums I had managed to get this thing up and running on the iphone only to know that at around 800 something primitives/frame the framerate dips to 30. If I add a skinned mesh the framerate dips to 5-6.
One of the immediate problems that I found during the development of my 2D game on cocos2D
was that whenever we changed the texture format from 32bits/pixel uncompressed to 16bits/pixel pvr, we had an improvement of around 15fps.

So here is the quest that I am going to embark upon. Take the nice things of the two engines that I have liked so far. Use the optimization of OOlong and use the good SceneGraph and an awesome core framework of irrlicht and bring them together on the iphone. Ladies and gentlemen, I present to you irrLong or Oolicht.

More updates to come as I progress forward.

Labels: , , , , , , , ,

Wednesday, October 14, 2009

I am back after a long time.

After a long time working my way through a lot of stuff, I am back. Now on the verge of my first iphone game done on the cocos2d engine, its time to do some postmortem. One of the first and foremost problem is of texture size. I was wondering if what if we saved all of the artwork in one big file of size which is a even multiple of 1024x1024 used a quad tree to divide the texture marking out texture zones. Once that is done there would be n 2^n textures created. Each node that wants to render itself knows which texture it needs to sample from, and hence binds the same texture and render itself.

Now the big question here is why keep it in one texture when you can have the same thing accomplished using 2^n different textures?

One straight forward answer is that the artist gets full freedom to make the art in 3D by painting a surface, instead of creating textures and tiling them.

But do we need such detail on a screen of the size of 480x320. I dont know?

With this thought in mind i will work on my first opengl tutorial for the iphone.