Cinema 4D woes and problem solving

Early on in Containments development I wrote a very basic exporter for Cinema 4D. All it exported was polygon outlines and triangle data but I needed to extend it to export texture UV coordinates and normals. This is when the pain started. The documentation to Cinema 4D’s scripting language is terse to say the least and there appears to be very little in the way of support so getting at this most basic of data was not easy. At one point I was on the phone to Newtek to see how much it would cost me to upgrade my old version of Lightwave instead. As per usual though the solution to this little problem came to me at about 3am and it took a lot of will power to remain in bed and not get up immediately to code the solution.

It’s always the way with me. If I get hung up on a solution to a problem I have to walk away from it and let it stir away at the back of my mind and eventually a solution will pop out all gift wrapped and waiting under the tree. At the discovery of a problem though it is difficult to remember this process and not just hammer away at the issue until you get at the same solution which usually takes longer and not as elegant. It has been a while since I had an issue that I couldn’t solve this way and just like California and it’s Earth-quakes I am due the big one.

iPhone 3D, maps and frustums in Containment

Last night I added a very basic map capability to Containment so I can now create a very crude world to wander around in. I am just using cubes for walls at the moment and and another 3D shape as eye candy but the system is more than capable of handling more complex objects. You can see it in action here:

I made some slight changes to the navigation in that I reversed the swipe gestures for left and right rotation and sped up the rotate to make it more responsive.

One problem I encountered early on is the need for scene culling. The map is cell based. Each square you see in the video is one cell so all I needed to do do a sphere check for each square to see if its in the Frustum or not and of course cull it if it isn’t. I will have to go one further than this though since it can still draw a lot of redundant data. My sphere test returns the distance from the cell to the camera so I am going to make use of that data to produce a list of near to far objects and then do a sort of ray cast to work out occlusion so that if a wall is nearer then there is no point processing anything behind that wall. This may seem like overkill but the iPhone has not got a massively powerful CPU and GPU to be able to process the entire world.

Before the ray casting goes in I am putting in environment collision detection so that you can’t walk through walls or objects :)

iPhone 3D navigation in Containment

Containment is coming along quite well now. Since it is a 3D world on the iPhone I struggled long and hard on finding the best way to navigate through it. I considered lots of options among them were:

 

  • Buttons on the edges of the screen that you press to move forward, backwards and rotate left and right.
  • Tilt the iPhone to rotate left and right and also to move forward and Backwards.
Both of the above ideas sucked though and in a flash of inspiration last night I thought about using swipe gestures so I knocked up some quick code to read swipes and integrated it into the prototype game and the results are:

The controls are:

  • Swipe down the screen to move forwards.
  • Swipe up the screen to move backwards.
  • Swipe left to rotate left.
  • Swipe right to rotate right.
It’s still a work in progress so there is a lot of tweaking to - for instance getting the speed right for the left and right swipes which is a bit fiddly at the moment.
Coding swipe based systems is incredibly easy on the iPhone - Apple got that part of the SDK correct and I must admit I am impressed with how simple it was. The most complicated part was differentiating between a vertical swipe and a horizontal one and not getting the two mixed - a Dot product solved that little puzzle though.

iPhone Engine - XGDK

In all of my game development projects I use a variation of the XGDK which stands for Xiotex Game Development Kit. It’s essentially a framework upon which games can be developed. I have one for SDL based games on Windows/OSX and I have also had one for DirectX based development - however that particular project has been left behind since I no longer use DirectX. Whenever I want to use the XGDK in the past I have had to add it as a static library to the main project which I create using either Visual studio or XCode but that has all changed now. I discovered how to make my own custom project templates in XCode and I have created a XGDK template so when I want to go and make an iPhone game everything I need is already setup for me. This has simplified the whole process incredibly. I have still got a reliance on two of the Apple supplied files so far but I am sure I can get rid of those too.

Using iPhone SDK to get contents of web page

I was toying with making use of a PHP based server as a kind of quasi-multiplayer server for my next iPhone game. It doesn’t need to be real-time on the screen multiplayer so PHP will suffice. Once you get past that conceptual hurdle comes the crunch: How to actually get at a web page using the iPhone SDK and more to the point - how do you get data back from it? I must admit I was prepared for much pain when attempting to do this and I must have spent hours tonight researching the subject. I am still being a little bit off-limits when it comes to Cocoa and Objective-C but when I saw the answer to my problem I must admit I am rapidly warming to this language and framework. So, to contact a webpage and get some data from it all you need to do is:

NSURL *url =[NSURL URLWithString: @"http://www.xiotexstudios.com"];
NSString *webpage = [NSString stringWithContentsOfURL:url];

And that’s it. Obviously this is the most basic usage and to be useful I am going to have to thread this access in order to keep the OpenGL update responsive but I just can’t get past the fact that it’s just 2 lines of code to do it!

As I have already said - I was resisting learning Objective-C mainly because the language looks ugly to me. Most languages have a certain visual elegance to them but Objective-C to me looks like an over-reliance of brackets to enforce a kind of hierarchical messaging system then is just plain ugly to read. I will have to read up on the history of the language but from what I can gather it was an attempt to add object-oriented features to place C (hence ‘Objective-C’) and perhaps with that context the brackets may be forgiven. However, given all of the research I am having to do into Objective-C and the Cocoa framework I am now giving into the necessity and reading a book on Objective-C.

‘Possible candidates are’

I have come across a lot of obscure error messages spat out by compilers and assemblers throughout my career as a coder but yesterday I met the best. XCode 3.1 decided to let me know that I had forgotten to flesh out a member function prototype by simply displaying the error message ‘Possible candidates are’ and then the name of the function. It didn’t take long to discover why I was getting this message and to correct it but that has to rank as one of the most obscure error messages. Kudos for almost solving the error but it would have been more useful to tell me there was an error and then post this message.

Forums

It’s very early days yet but I have decided to add a forum to this site. You can find it at http://www.xiotexstudios.com/Forums

At the moment it has one topic and that is iPhone game development. I am using phpBB3 with a existing template but I must admit I am finding this template confusing so it is likely to change.

Boxes finally ‘ready for sale’

I finally got an email from Apple this morning informing me that my first iPhone game has moved into the ‘ready for sale’ status. When I went to take a look at this in iTunes connect I noticed that iTunes connect has had an upgrade and I must admit the signs are looking good so Apple are obviously aware of the issues and doing something about it - it just ‘feels’ like we aren’t being listened to.

Now all I have to do is wait till the actual game appears on iTunes.

iPhone game review status and how to fix the process

My iPhone game remains in the Itunes Connect ‘review’ status. Last time it took them a week to find what they classify as a bug. I have heard from other developers that they got refused on items like version numbers not being matched in the games .plist file. While it is understandable that they want all the information to be complete I think the review process should be a dialogue between the developer and Apple rather than the opaque process they currently have in place. My main worry is that the halt the process on the first bug they find rather than compile a list of bugs to give to the developer to fix before the game goes into the next review stage. Imagine the worse scenario, i.e. that you have n bugs that means at this rate you would have n weeks of review. I have heard the argument that it’s up to the developer to make sure that their games are bug free. In the case of the actual code then I agree but when it comes down to Apple’s requirements for the game the documentation is not all that clear about what ‘has’ to be done so the developer can honestly believe that their application is complete when they submit. Another annoying aspect of this is that if you go onto the app store at the moment there are plenty of apps on there where the comments are full of ‘it crashes the iPhone’ or ‘it doesn’t work’ - how did these apps pass the review stage?

So how can Apple make this process easier for the developer and themselves?

when you supply your application to the app store you should get assigned an account manager and this is somebody you can contact in relation to your application. Now this may seem like an over-kill but look at it this way. Apple are probably swamped with games currently going through the review process and by making the review process a dialogue with a consistent person Apple can reduce their workload of apps waiting to be reviewed. The argument for this is that not all bugs should be classified the same. A simple art change bug can be fixed in moments by the developer so the account manager can inform the developer of the issue, the developer fixes it and the account manager continues from where they left off. At the moment it appears that you get informed of the bug, you fix it and then submit your app to be reviewed and the process starts from the beginning again with somebody else. If however if it is a major bug like a crash bug then I would argue that is a strong case of putting the app through the review process again.

Apple could make the whole process a little more transparent by supplying more information on the app status page other than a coloured ‘light’ and a word. It says the game is in review but it doesn’t give an estimated time to completion or anything else that is useful - at the moment the developer really does feel left in the cold to wonder if Apple are actually doing anything. If it’s in a queue then show its queue number - something to give more feedback about what is happening.

On the whole Apple have done a better job than I expected and this is their first generation of the process and I am sure that it will get better but for the moment it’s very painful and not at all clear enough for the developers out here trying to make a living and add value to an already fantastic product.

Is anybody else going through this process at the moment and would like to share your experience of it? Perhaps your experience is better than mine and a few other developers I have spoken to?

iPhone game engine

My first iPhone game has resulted in an engine that I can use for other iPhone games. It’s pretty light-weight and 2D at the moment but a good starting point. I am also porting it to SDL so that it can run on PC and OSX (and Linux at a push - but I don’t have a Linux install so I can’t work on that personally) and it occurred to me that this small engine might be of use to other developers. As I say, at the moment it is pretty light-weight and to be honest just contains enough to do the game I have just submitted to Apple but as I begin to make more games the engine will be expanded to include new features. I personally think that the iPhone is more suited to 2D games rather than full 3D due to the nature of how and when games will be played on it (i.e. at the end of it all its a phone) but there is no reason why 3D will not make its way into it. In fact the next game will probably work within a 3D world but still remain 2D in essence (if that makes sense :|).

The question then rises, if I make this engine available do I make it free, donation supported or out-right charge for it? What are your views on this? Would an iPhone game engine be useful to you? If so what kind of licensing model would you prefer?

Next Page »
 
The game goes here
The game goes here
The game goes here
The game goes here