Get Updates By E-mail 

iphone game development

Unity iPhone Developer Shares Tips After Developing First Game

  •  
  •  
  •  
  •  
  •  

Editors Note: Pat from Crawl Space Games was kind enough to share his experience and some tips in creating his first game using Unity 3D for the iPhone.  This will be a great help for those getting started with Unity 3D or trying to decide whether they should use it for iPhone development.

Coming from a background in web programming and databases, my first experience with game programming was a surprisingly pleasant one. While “Knife Toss” isn’t exactly “Call of Duty: Modern Warfare,” I was still initially concerned that I would have no idea how to even begin working on a video game. But in the end things became very intuitive and I was able to use my prior software engineering skills to adapt quickly to the environment of game development. That is not to say there wasn’t a learning curve throughout the process.

Knife Toss Game Trailer:

Understanding Game Objects

The biggest obstacle for me was getting a grasp on game objects in Unity3d. A novice game developer might find this task extremely simple. But I had never worked with 3D graphics, textures, materials, colliders, meshes or anything related to modeling or gaming. Once I was able to figure out how all of that worked, and how to wire up the code to it, things became comprehensible. It was challenging enough to make me think, but not so hard that it would take the fun out of it.

Coding With C#

We did all of our coding in in Mono – A Open Source implementation of C#. I had never worked with C# previously, but this wasn’t an issue at all due to my past experience with Java. Unity also allows code to be written in a Unity version of Javascript, which happens to be what all their documentation is shown with. This was an issue a few times when the javascript implementation of a Unity Engine function was actually quite different then what was needed with C#. Something I found interesting was that it seems most people in the Unity community use C#. Although little Object Oriented Programming was used in “Knife Toss,” I see it as the obvious advantage of C# over Javascript. (Side Note: The non-iPhone version of Unity3d allows for a third scripting language based on Python called “Boo”. If they ever bring this to Unity iPhone I’m going to switch and never look back) The programming process overall was pretty straight forward. We did have big issues throughout the process, but they were seldom due to coding.

Handling Textures

Textures are what killed us. We got to the final stages of finishing the game when I discovered that we were using up huge amounts of RAM. I had never thought to check before because the game always ran fine on my device. It turns out it did not run fine on other devices, specifically the first generation iPod Touch and the original iPhone. We ended up having to redo all the texture sprites and consolidate them down to two 1028×1028 sheets. This began the most frustrating week and a half of the whole development process for me. I had to redo all of our menus, GUI elements and on screen displays by readjusting all of their coordinates. Finally we got everything back in place and as a result we cut our RAM usage by almost 20MB.

Submitting To The Store

Now that our game was optimized and working well on all compatible devices, we were ready to put on the finishing touches and begin intensive testing. When the game finally was complete, I carefully went through Apple’s process to submit to the App Store. This process is not as difficult as it seems when you first glance over their set of procedures. Our first game was finally submitted and it felt great. I still wasn’t fully satisfied though. I had read so many horror stories about the App Store submission process that in the back of my mind, I actually was expecting to be rejected the first time around. I was wrong. The game was accepted a few days later. After working through a bit of a mix-up with the contracts our game was finally for sale across the world.

Some Tips For First Time Developers

My first experience with game development was an excellent learning process. Now that our team has the first game out of the way, look for us to begin pumping out games left and right. Here is a list of tips I have for any first time game developer, specifically using Unity3d for iPhone:

  • Go through the tutorials that are provided for you. I read through them, started them, but then became to impatient to finish. Had I actually finished, I would have saved a lot of time instead of having to go back and figure out how to do certain things which actually were covered very well in the tutorials.
  • Plan out your game as detailed as possible before beginning. If you are working with a team, make sure this idea is stressed. What may seem like a minor change or addition to someone who didn’t program the game, may be very difficult or may require completely redoing certain aspects of the game on the programming side. This also will prevent “band-aid programming.”
  • Use texture atlases and use as few sheets as possible.
  • If possible, do all testing on a first generation device. If it works on that it’ll work on the faster devices.
  • Use the Unity Remote. It’ll save you tons of time.
  • Create a copy or a pseudo “version” of your project at least once a day. Sometimes things will get messed up and you won’t be able to figure out what you changed to cause it. Always have something to fall back to.
  • Use Object Oriented Programming often. Nothing is more irritating then searching through your huge, single class file to find one of the hundreds of variables that have been accumulated.
  • Use the profiler and Apple’s “Instruments” often to check your games performance and resource usage.
  • Read through the documentation in Unity. Especially the optimization sections. It contains plenty of useful and sometimes absolutely necessary tips to make your game ready for sale.
  • Avoid allocating memory during game play if possible.
  • Use the Unity forums. For the most part everyone is very helpful and they are not rude to beginners as long as you aren’t asking questions that are readily available in the documentation. Also, the search feature is your friend.

I’d love to help out the best I can if anyone is looking for help getting started. Feel free to email me at [email protected] or just post to the Unity forum. I always reply to post if I think I can help out.

You can also check out Pat’s website Crawl Space Games where his gaming creations are featured.


  •  
  •  
  •  
  •  
  •  

Exceptional Getting Started With Coco2D iPhone Tutorial

  •  
  •  
  •  
  •  
  •  

The free open source Cocos2D game engine is something that is searched for and talked about alot on this site.  I occassionaly receive questions about the engine, and most often I’m asked about beginner tutorials.  Typically I’ll just reply saying to go through the example, and I think that’s a great way to learn how to use the engine.  Many great examples are provided, and if you really want to understand the question going through the examples systematically will teach you the ins and outs of Cocos2d programming.  That being said I’ve found this tutorial that does an exceptional job of showing you the absolute basics.

The tutorial is from Ray Wenderlich, the creator of the Space Game Starter Kit and co-author of the Learning Cocos2D book, and is How To Make A Simple iPhone Game With Cocos2D.

In the tutorial Ray goes through the creation of a simple 2D shooter.  Specifically, downloading and installing Cocos2D, using the Cocos2D application template, adding sprites, moving targets, shooting projectiles, collision detection, and other game creation essentials in a step-by-step fashion.

I highly recommend that you check out this tutorial if  you want to learn Cocos2D basics fast.  You’ll need to understand Objective-C first, but once you’ve got that down this tutorial can have you creating a simple game in minutes.

Once you’ve got the basics down through this tutorial you might want to check out another other Cocos2D iPhone tutorial, and other Cocos2D iPhone game engine resources.

[source Ray Wenderlich]


  •  
  •  
  •  
  •  
  •  

iPhone Game Development Resources Compendium

  •  
  •  
  •  
  •  
  •  

I’ve posted many iPhone game development resources on this website, and I can see that many of the searches on this website are iPhone game development related so I have decided to create this post which is basically a table of contents containing my other iPhone game development posts, along with some new iPhone game development resources that I have not mentioned before.

iPhone Game Engines

When most look to develop a game on the iPhone typically alot of time can be saved by using an already existing game engine.  Some of these engines use Wysiwig editors and their own scripting languages while others provide a collection of functions to us in your code.

Commercial iPhone Game Engine List
Open Source iPhone Game Engine List

Game Engine Resources

Unity 3D and Cocos2D are two widely used game engines, I highly suggest looking into these two engines if you are getting started with iPhone game development.

Unity 3D Game Engine Resources
Cocos2D Resources

Open Source Cocos2D Games

Graphics Programming

You may want to use Core Animation to program your game, often this is the easiest way to program simple 2D games with low performance requirements as you can lay out elements in interface builder and the functions are very easy to understand if you’ve done other iPhone Objective-C Programming. 

Core Animation Resources

OpenGL ES is the rendering API used on the iPhone.  If you are looking for maximum performance and don’t want to purchase or use an already existing iPhone game engine you will need to use OpenGL ES.

OpenGL ES Resource Sites
OpenGL ES Tutorials

Free Game Graphics

Something I see commonly asked is where to get graphics, well the fact of the matter is you will typically have to pay an artist to create them, or create them yourself, but there are some free graphics available.  The games you can make with these are somewhat limited, but they can be good for prototyping before finding an artist to assist you with iPhone game development.

Massively Large Collection Of Free Graphics Links

Audio Programming

The iPhone uses OpenGL AL, as mentioned above Cocos2D now includes a sound engine, but if you’re programming from scratch here’s a basic engine for you to learn from.

Finch Simple OpenAL Sound Engine


Free Game Audio

Here’s some links to some free audio as with graphics you’ll typically have to find someone to custom create the sound you want or create it yourself to get things right.

Collection Of Free Game Music And Sound Links

iPhone Game Development Community

You may want to check out iDevGames if you’re looking for a forum for iPhone game development.  It is fairly active.

iPhone Game Development Tutorials

The guys at 71 squared have put in a tremendous amount of work into creating some iPhone game development tutorials with video, be sure to check them out.

iPhone Game Programming Tutorials

That’s it for my iPhone game development resources compendium, as always if you know of any other great resources feel free to post them in the comments, and I will likely update this post in the future so look for them to be added later on.


  •  
  •  
  •  
  •  
  •  

iPhone Game Development With Core Animation

  •  
  •  
  •  
  •  
  •  

I’ve made quite a few posts about OpenGL ES, and the available game engines on the iPhone, and I’d like to iterate that you do not need to use OpenGL ES or any game engine.  Core Animation can be used for iPhone game development, and if you’re used to Objective-C/Cocoa it may be the easiest route.

There are some caveats to using Core Animation, for one, you can get better performance from using raw OpenGL ES, and it can be somewhat tedious to use in instances where you may want to micromanage the animation of a graphical object.  Also, while there are 3D transformations available Core Animation is designed for 2D graphics.  All this being said, Core Animation is great for games such as card games, and board games.  A huge advantage of Core Animation is that you can lay out your components using interface builder which can be a real time saver, as all the graphical components are inherited from UIView.

You wil want to check out the manual on Apple’s official Core Animation Programming Guide here:
Core Animation Programming Guide

While much of that guide is for Mac, you can also check out the Core Animation Cookbook:
Core Animation Cookbook

As far as code samples go the best example I’ve seen is the fantastic Geek Game Board, and an iPhone compatible version with some updates beyond the Mac version available at the Apple site is here:
http://bitbucket.org/snej/geekgameboard/

and for those who have trouble downloading the source can find it here:
Geek Game Board From Bit Bucket

I was able to get this example compiling to iPhone OS 3.0 straight out.

I also have some examples on doing some simple animation that can be used in iPhone game development here:
Easy Fading Buttons and Images
Scaling Images & Button

What makes the GeekGameBoard example so good is that it includes board games, and card games (specifically Go, TicTacToe, Hex, and Klondike) that you can use as a framework which includes cards, boards, and pieces that you can use in iPhone game development.  This should get you off to a very fast start.


  •  
  •  
  •  
  •  
  •