Get Updates By E-mail 

first game

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.