Ipod Touch Game

From MCS Wiki
Jump to: navigation, search

The reason that I chose to write an application for the Ipod Touch is primarily that it will be a good learning experience and it is something that greatly interests me. In the process of writing this application I will be learning various technologies new to me such as: working with a Mac, using XCode, using the Iphone SDK, coding in Objective-C, interacting with Cocoa Touch, and coding in OpenGl Es.

This application is being developed for the iPod Touch[1] and should be compatible with the iPhone[2] as well. This application will be created on a Mac using its compiler, Xcode, with the addition of the iPhone SDK. This application will also be using the Cocoa Touch frameworks and will be written almost entirely in the Objective-C language. This application will be tested using the iPod Touch simulator and a 3rd generation iPod Touch assuming that the appropriate license is acquired.

Contents

Brief Overview of the Application

For my application, I have chosen to take a hybrid racing game approach where destruction is the key. The object of the game in not necessarily to win the race, but to cause the most damage thus giving you more points. At this moment, I am either going to make the app into a collision style game where the object is to wreak other vehicles, or I am going to develop a game where the object is to hit the pedestrians. Either way, the user will be operating a vehicle or cart of some sort and destroying other objects for points. Originally I wanted to devote the controls to tilting for turning left or right with a gas and brake “pedal” in the bottom corners for touch control. However, I’ve discussed these issues with various faculty members already[3][4], and I have decided to make two or three sets of controls. These controls will be selectable by the user, and I plan to do some testing to see which set of controls is preferred.

Project Team

  • Coty Breeding
  • Dr. Robert Hatch - Advisor [5]

Timeline

CSC 4990 - Senior Seminar Project Timeline/Outline - Spring 2010
February 1 – February 6
  • Research Objective-C, Cocoa Touch, and OpenGl Es
February7 – February 13
  • Read “Iphone for Programmers”[6]
February 14 – February 20
  • Get familiar with Mac, Xcode, and Iphone SDK with examples from “Iphone for Programmers”[7]
  • Draw up sketches and develop guidelines for rules, controls, and other non-code related aspects
February 21 – February 27
  • Start Coding
  • Develop main screen with instructions, start, high scores, etc.
February 28 – March 4
  • Develop main interface and draw up all graphical elements in OpenGl Es
March 5 – March 14
  • SPRING BREAK
March 15 – March 20
  • Start developing Code elements(controls, AI, high score system, collision detection)
March 21 – March 27
  • Finish Coding
  • Test in virtual environment and begin debugging
April 4 – April 10
  • Test on actual Ipod Touch assuming the appropriate licenses are acquired
  • Refine code to be as efficient as possible and make any fine tune adjustments
  • Test again to verify that the changes didn't create any new problems
April 11 – April 16
  • Perform some user testing and analyze those results
  • Make a user manual
  • Finish write up / Wiki for my App
  • Create and rehearse my presentation
  • Turn in Project(Due on April 16th)
April 18 – April 30
  • Give presentation sometime in here

Planning

Research

Research Topics

  • Objective-C
  • OpenGl Es
  • Cocoa Touch
  • Iphone SDK

New Area of Research (due to complications)

  • Applying OpenGL to a windows form
  • Optimizing OpenGL rendering
  • Quadtrees

Findings

OpenGL to a windows form

With my research on applying OpenGL to a windows form, I found an invaluable resource at http://www.codeproject.com/KB/miscctrl/OpenGLViewWinForms.aspx . This webpage provides a step by step tutorial for how to create an OpenGL view in a windows form using Visual C++ and Microsoft Visual Studio. This webpage also provides code examples to make the process a lot less painful.

Optimizing OpenGL

Also in my research to find more efficient ways to render OpenGL code, I stumbled upon Quadtrees. Before, I was drawing the entire game level every single frame which lead to a choppy frame rate and an unpleasant experience. After applying the concepts of a quadtree, my game rendered much smoother and appeared the same as before. However, the code underneath was changed completely.

Quadtrees

The idea of a quadtree is to subdivide the area to be rendered into four pieces. Then, you take those four pieces and only render the pieces that are in the view frustrum. The process then repeats itself by dividing into four, and choosing only the visible chunks. The end result is drawing a lot less of the map and doing less calculations by eliminating large chunks at once. The quadtree is a very efficient way to render a large 2D map and was very suitable for my application. Some useful web pages that can further your knowledge on quadtrees are http://www.gamedev.net/reference/programming/features/quadtrees/ and http://en.wikipedia.org/wiki/Quadtree .

Questionnaire

To further my research, I passed out and had several students at UVA Wise fill out surveys pertaining to my application. The original questionnaire was aimed towards an Iphone application, but I had to refine the questionnaire to a general application status due to the unavailability of the Iphone development license. The questionnaire contained questions pertaining to basic background, familiarity with similar products, and specific design and testing questions.

Modeling

Sketches

SeminarSketch1(s).jpg SeminarIphone1.jpg SeminarIphone2.jpg SeminarIphone3.jpg

Screen Shots

SeminarScreenshot1.jpg SeminarScreenshot2.jpg

Complications

3/3/2010 - The situation with the licensing issues dealing with our University and Apple is taking an unreasonable amount of time. At this point, I have decided to end all iphone related development and aim for a more basic platform. I have decided to take my application in the direction of a general windows based application. The game will now be developed in C++ and OpenGL using Microsoft Visual Studio 2008.

3/15/2010 – I have encountered some problems with the difficulty of rendering plain text with OpenGL to effectively create a GUI for my project. At this point, I have decided to look into using Visual C++ and translated my console OpenGL application to a Windows form application. However, I do not have any ideas of how to accomplish this, so I will add this to my list of things to research.

3/24/2010 – I have noticed that the more that I add to my application that the frame rate is getting rather slow and the game is appearing very choppy. I am going to research more efficient ways to render large maps in OpenGL.

4/6/2010 – I am having some difficulty getting the collision detection to work appropriately between the player’s car and other AI cars.

Final Plan for the Game

As the deadline quickly approaches, I have come to the realization that this program will not be a complete polished piece of work.

My goal for the game is to get a rough working prototype up according to feedback that I received in my questionnaires.

Future Plans

In the future, I plan to further my design and fine tune all the graphical elements of the game. I also plan to create and use more realistic physics calculations dealing the acceleration, braking, collision, etc. I also plan to add numerous extra features to the game.

The main focus for the future of this game is to port it to the Ipod Touch. This will not be a seamless port due to the slight language incompatibilities. The Ipod Touch requires that all the code elements that reference the Ipod Touch be written in Objective-C and the graphics need to be in OpenGL Es. The code shouldn’t be hard to convert since the language I chose and the destination language are both derived from ANSI C. The graphics on the other hand will require a large rewrite due to the embedded systems version of OpenGL drops all support of the GLU library which contains most of the geometric shapes that I use to draw all of my objects.

Knowledge Gained

This project has taught me numerous lessons dealing with time management, language specific tricks, and other useful things.

The unavailability of the Iphone Development License threw me for a loop, but it also taught me to continue on with my work and not to be discouraged by any difficulties that may arise in a build.

This project also furthered my knowledge of C++ and OpenGL by requiring me to research new topics dealing with the two.

I also learned a valuable lesson in dealing with the efficiency of rendering objects to the screen. Since the Iphone has even stricter limitation and far less memory and graphics capabilities, I think my knowledge of quadtrees will serve extremely useful in the future.

Special Thanks and Acknowledgments

I would like to thank Jason Ingles for the help setting up this wiki and allowing me to use his layout.

Personal tools