What are the "gotchas" when developing an iPhone Game? [closed] - iphone

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Am used to developing business and reference apps. Now I have to do an iPhone game. What tips can you share to help me with:
understanding the scope of the project
defining the deliverables
specifying the game play and other parameters
estimating the development effort
testing the game
A big question, I know. Thanks!

My answer is not following the waterfall methodology response you were looking for because I think you will need to learn the skill of game programming before you can plan, design, implement and test it. Game programming is VERY different to business programming and a whole other field in and of itself.
Due to your lack of experience in programming games there are a few concepts that you will need to learn before you can program a game period, let alone one on the iPhone.
Some of these things will depend on whether you are programming a 3D game or going for the 2D platform style.
OpenGL ES
The first thing you will need to learn is the OpenGL ES programming language. This is basically a 3D API which enables you to do drawing of 3D primitives. You will still need to use this if you are coding a 2D game as it is quick due to using the GPU for acceleration.
There are some good tutorials on the Google that you should begin with.
Vector Math
If you are doing anything 3D, you will need to learn about 3D vector math, vectors are basically used for everything in games, camera look direction, position of characters, speed, collision detection, etc. 2D vectors (x,y) minus the z component are still needed for 2D games programming.
Collision Detection
How do I know when my ball hits the wall? The answer is collision detection. There are many forms of collision detection such as Sphere to Sphere, AABB, OOBB, Convex Hulls, Triangle Mesh, etc.
AI
How do I get the enemy to attack my player character? Artificial intelligence is another large field essential to give NPCs/Enemies the ability to make intelligent decisions. AI can be simple such as if else statements but usually requires Finite State Machines or Fuzzy logic to be effective.
Pathfinding
If you want to move a character from Point A to Point B while avoiding enemies and moving obstacles, you will need to use a pathfinding algorithm. A Star (A*) is one of the most popular.
Scene Graph
If you wish to have 10-20+ enemies on screen at a time, you will need to code a scene graph to manage the dynamic drawing, logic and creation and deletion of resources. If you don't know what polymorphism is you will need to know it as it is essential for your game objects to adhere to and it ties in with the scene graph.
Physics
Position, Speed, Acceleration, Gravity and Rays are all represented using vectors and you may need to brush up on your physics math in order to code any game. Start with Newton's Second law of motion F=MA (Force = Mass * Acceleration). An open source physics engine such as Bullet, ODE, Newton, Tokamak will make things easier, meaning you won't need to write these physics rules yourself.
Objective-C++
This is optional although recommended. If you don't know C++ this is essentially a mixture of C++ and Objective-C. I tend to use C++ for the core game engine and programming because of the speed of C++ and availability of third party libraries in C++.
Sound
If you need sound you can just go ahead and use the simple audio frameworks that Apple provide, however 3D positional audio is going to require something better. I would recommend learning the FMOD SDK for iPhone. As #Stowelly mentioned, FMOD requires a license for commercial distribution but there are others you can look for which are royalty free.
Use a Game Engine
There are game engines available for the iPhone at the moment which will make it much easier for you to get a game going, in your case this will be faster although you will still need to learn the concepts I mentioned above.
Here are some game engines I know of:
Unity3D
This probably the most popular one that I know of. Unity is a PC/Mac game engine that lets you write code on the Mac and compile for Windows/Linux/Mac OS X. I doubt the iPhone building is compatible directly with other platforms, I would imagine you'd be restricted to iPhone if you started a new project. This engine does however have a commercial deployment cost of $199-$399.
Cocos2D
This one is an open source 2D game engine that might be useful for a lot of games. Worth taking a look at. Hosted on Google code.
Here are some others to check out:
Ston3D for iPhone
OOlong Engine
SIO2Engine
iTGB for 2D Games

The main difference between business apps and games, especially on mobile devices, is the importance of performance. An app that puts up a form and waits for user input probably isn't doing anything in the meantime. A game loop, on the other hand is going all the time and probably doing alot. Business programmers are not used to thinking in these terms, but games draw down battery power and, believe it or not, how you implement your game will have a great effect on how quickly that battery is drawn down.
So, one question is, what is this game that you "have to" develop? If it is sudoku, no worries. If it's a real-time 3D space battle, that's another story.
If your business apps were on the iPhone, then you probably used 100% Objective-C. (If you were doing C# or Java apps on desktops, then welcome to managing your own memory.) There are those who will tell you that the runtime type management of Objective-C is too slow for complex games. People certainly make OK games using it with Cocos2D and other engines, but again it depends on the game. There are professional developers who will only work with C++ or even straight C.

Related

Objective-C Game Programming [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
i'm starting game programming (for iPhone) and i'm would love to know more about it.
From what i seen i can choose 3 different ways:
1) Lua on Kobold 2D
2) Cocos 2d
3) Basic UIKit
Which ones are the real differences? For the ones that already have tried them, why should i pick one technique instead of another?
Do you know witch style was picked same the most game like: Angry Birds, Fruit Ninja, Ruzzle, Draw Something, Candy Crush, Words whit friends, Temple Run, Four pic one word, Song Pop, Fun run, and so on.
Are there any other ways to programming game to iPhone? Such as other Kit or API that i didn't mention?
Thank's
Cocos2D is a proper 2D game engine. You can find so many tutorial sources on the net. you can also use cocos2D with box2d or chipmunk physics engine if you need physics simulations or accurate collisions in game world. Beware though there are 2 versions of cocos2D one that uses openglES 1.0 ; which is used for older ios devices and the one that uses openGL ES 2.0; which has a support for shaders. Also there is a flavour of Cocos2D called Cocos2D-x which is written with c++. so if you planning for cross plaltform go for Cocos2D-x. be warned though cocos2D-x doesn't have as much tutorial as the Cocos2D.
Kobold 2d is actually suppose to be extended and improved version of cocos2d that acts as a wrapper arouund cocos2D, so that creating games are a bit more simpler compare to creating in cocos2D. However this is more likely based on personal view of the author of the Kobold2D. Personally I haven't tried it but I believe its going to cause more headache to me then it would help or more likely it will limit me down since I already started grasping the idea of developing games. Also there is less amount of tutorials on the web for Kobold2.
Basic UIKIT. erm... this is the hardest choice you can make. UIKIT is composed of OPENGL ES and QuartzCore framework and uses these to draw the your game on the scene. So its not a game engine. if you are going for UIKIT you will be reinventing lots of things from scratch. rendering textures, managing your scenes, handling your sprites, and resources.
Obviously rendering is not the only thing the game does. if you going for UIKIT you also have to find solutions for collisions "such as when a paddle hits a ball" and user interactions "such as how player controlls the game with touch screen". So my suggestion is keep away from UIKIT and start with Cocos2D. it will make the life simple enough to get you going yet complex enough to let you have freedom and think.
lua is a different programming language than objective-c, but you can use it in objective-c with the Wax api.
Kobold2d is an extended version of cocos2d, but i haven't tried so can't say much.
cocos it's like a wrapper that help you drawing lines, using collisions etc.
unity it's most used with 3d games
open gl it's more raw and you have to customize everything, it's more powerful but it require way more work
all of them are pretty much just wrapper frameworks that help you writing games because they include different functions that you normally would write on ur own. unity it's usually chosed for 3d games, open gl for bigger project but will require way more work. if you want to do a simple 2d games the real choice is between lua( throught wax api ), kobold and cocos.
personally i prefer kobold, because it's still objective-c ( lua uses it only with wax ) but still has many helpful functions and uses arc ( which cocos doesn't ) but try to see if other programmers give you different advices.
i don't know which is best to chose but i know that Angry birds is done with Lua ( which is a cross-platform programming language )
read more on this link
http://www.learn-cocos2d.com/2011/08/comparison-lua-scripting-corona-sdk-wax-kobold2d/
http://www.kobold2d.com/display/KKSITE/_Kobold2D+vs+Cocos2D+Comparison+Chart

Unity 3D vs. UDK 3 for iOS

I have a couple ideas for some 3D games/apps and need to know which 3D engine to go with. I like the high-level approach of Unity and UDK. I have done some 2D games using cocos2d before, but I'm entirely new to the 3D world, which is why i think Unity or UDK are a good choice. I know about the differences in licensing, and i am more concerned with the learning curve instead of the licensing cost.
Plans:
A 3D "side scroller" that goes forwards (up) instead of to the side. Third person space ship. This would primarily be for learning. Tilt to steer, tap to jump. Very simple graphics, vertex coloring would be enough.
A 2.5D "side scroller" like the above one but with a car. This game would generate the levels randomly out of a couple prefab blocks of a certain length that fit together seamlessly.
A 3D augmented reality display for pilots with a terrain mesh loaded from DEM data. Accelerometer and GPS access required.
Other important points:
Must be able to tie in to In-App purchases.
The more community content like tutorials and forums the better.
Ability to add third party libraries like Flurry Analytics is a big plus! But i guess this isn't possible?
Which engine would you recommend for these projects, and why? Preferably, i'd like to pick one and stick with it.
You’re going to have a way, way better time developing with Unity. UDK’s got a fantastic, incredibly capable engine, but its tools don’t have the ease-of-use of Unity’s, its developer documentation leaves a lot to be desired, and the community hasn’t been using it for long enough for there to be much help to be found there. Some quick Googling suggests you can write your own Objective-C plug-ins for Unity games, so in-app purchases and third-party libraries are definitely a possibility. I think Unity’s your best bet.
What about cryengine? it free for non commercial use and also provides mono c#.
Check it out CryEngine

Game platform/engine for inexperienced/solo developer? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
There are a number of discussions on stackoverflow.com about what is the best iPhone game platform/engine. My question is not necessarily what is the best, but what is the best for an experienced iPhone developer but not not experienced in game design. This will also be a solo project plus a graphics designer. Consider I will be working full-time at my day job and will need to support a number of other iPhone apps. In other words, designing the game will be very much a part-time project but needs to go out in 2 - 4 months(?). Ramp up time needs to be quick. I'd like to build 2D in the beginning and then go to 3D.
I lean toward Unity 3D since it has lots of documentation and help. From what I can see, the iPhone basic version is $399 and you get the IDE for free. Can anyone confirm?
Unity3D is for 3D but I've read you can still do 2D. I'm trying to find out what is involved there. One drawback with Unity3D is the 8-15 second Unity splash screen. I've also read this doesn't get much better with the higher priced version. But I suppose that is the price you pay for the convenience of having a simpler framework available.
Cocos2d is a great framework and free but lacks documentation. It also requires much ramp up time to learn its framework and choose a suitable physics engine. I don't see this route as practical. I can see learning it across a long timeline as a side project but then you eat into getting your game out the door fairly quick. If I go with Unity, I probably abandon Cocos2d altogether since I will have invested so much into Unity.
Does my reasoning for Unity sound feasible?
---EDIT---
Based on some of the comments, here is the type of game I'm referring to initially: A 2D shooter similar to Zomebieville but most likely without its large feature set.
I'll vote for Unity 3D. It contains a very nice interactive development environment and supports a variety of platforms (including the iPhone). If you don't have experience writing game loops or any of that, then you will depend heavily on such development environments - you might as well get the best.
If your game is worth it, people won't mind the wait screen.
This will also be a solo project plus a graphics designer.
designing the game will be very much a part-time project but needs to go out in 2 - 4 months(?).
Two words:
Forget it!
Yes - Unity3D is $399 for the basic iPhone license.
Using Unity to create 2D games works in most simplistic terms as follows:
The Camera views a 3D world and creates a 2D game when the camera is directly facing a platform from the side. I guess you could also aim the camera straight down (birds eye view) on a surface as well.
The difference is as follows: In Cocos2D you are still running an openGL ES app. You have the ability to have layers in the Z coordinates.
Unity however would be best used when using 3D objects to be animated as the art. If your art is already 2D then in Unity you would be placing your art onto a flat plane. If you are concerned about the quality of the artwork when it comes to your game - if the art is 2D then there really is no point in using Unity and spending the money.
Also consider that Unity3D's basic package will not give you access to your own methods outside of it's framework - if you have some objective c you would like in your game from say another project or you have a special server you want to connect to using your own code that will not work. This kills it for me.
I understand there is a lack of documentation however - There are a lot of tools and tutorials to help.
First consider that Unity3D has a WYSIWYG approach with actions built in for physics.
Cocos2D allows you to use several different physics libraries including the one in Unity3D.
Youtube Cocos2d iphone box2d and chipmunk - mix the tags up
One nice thing about 2D art in cocos is SVG and tiles - see this tutorial / video - not much work - not much at all.
http://www.youtube.com/watch?v=yvZM-YPPbII
Cocos is actual simple - it is python and the documentation is poor - however there are plenty of small open source games out there using cocos - a quick google code search will reveal a few - open one up in xcode and it becomes quite clear and if you are a developer who knows an actual programming language it should look as easy as html form there.
I am convinced after working on several projects opening a few games that are out there will make complete sense of all of it.
I don't know much about Unity3D. But I know of a very nice game engine witch you can use it's called Game Maker. I think it's very useful for the inexperienced/solo game developer. With it you should be able to create good quality games in about two to three months. The last I checked it's about $20 for the full version of the software. So, I guess it's light on the wallet too.
2D games are easy with Unity. Its as simple as changing the view mode of the camera. Technically the game is still 3d but seen as 2d. If your looking to solo make a game in a short time then Unity is the way to go. Unity can make a 2d game for a iPhone to a super advanced MMO. Also there are hundreds if not thousands of tutorials out there that can teach you pretty much anything you need to know.
Unity is easy to make games for every platform and gets rid of the heavy lifting. I like Unity because you see the results fast and its cross-platform compatibility.

Game engines for iPhone vs. native iPhone sdk development

What are people's opinions and/or experiences with game engines such as Unity or Torque Engine? If one were new to iPhone game dev is it worth it to learn one of the engines? What is the performance difference between apps generated by those engines vs a natively built App using the sdk?
Both will equal the performance of what most people could write themselves (i.e. if you're not an experienced game engine developer).
Whether it's worth learning (and buying since both Unity and Torque cost for iPhone development) you'll have to ask yourself two questions:
Is my game idea suited the engine?
Is my passion for programming or game design?
Looking at the range of games made with Unity, it seems very flexible because although it is a 3d engine, lots of 2d games have been made with it. The downside of using Unity for something very simple (say, a match-3 tile game) is that it's a bit over the top in terms of download size.
On the passion issue, some people like programming a lot and will always feel it's better to write the engine themselves. And that's OK. But if you have a great idea for a game and just want to 'bring it to market' as soon as possible, and it requires 3d rendering, character animation, that sort of thing, using Torque or Unity is going to get you there a lot faster.
If you want to do 2d development you should have a look at cocos2d iphone it is implemented in cocoa free open source and very easy to pick up
I think time to market is important to consider - if your going to burn out after a short time and of the engines mentioned above will allow you to build and launch a game quickly compared to writing the engine & game from scratch.
Like U62 said, where is your passion?
Currently I'm building a framework/engine and a game. Its a great learning experience, but we had to understand that it would take a long time (we have day jobs) and that we have to just keep chipping away at it. So far, the experience has been an eye opener and I've learned a great deal ... however, would I do it again? Probably not - I think I prefer designing the game and coding game specific logic - not engine specific.
I've done a lot of research on the platforms and I personally really like Unity. You can email them and request the iphone trial license.
Anyways, good luck!

Quartz 2D vs OpenGL ES Learning Curve

I have been developing iPhone Applications for a couple of months. I would like to know your views about the Quartz vs OpenGL ES 1.x or 2.0 learning curve. You can tell your perspective. My Questions are
*I am a wannabe game developer, So is it a good idea to first develop in quartz , then move
on to OpenGL ES or does it not make an difference
*Can you please tell your experiences when you were having the similar question
Thanks :)
Quartz 2D is not applicable for game development IMHO. It is a software rendering API. It won't give you realtime rendering speed. It's good for drawing charts or vector text with shadows, or for blending several images together. Just not for games. Unless you want to make a game where few images are moving against a monochrome background and even in that case I doubt it will be really smooth on older devices. I've seen some games obviously coded with Quartz. A pitiful sight.
Sooner or later you'll end up using Open GL ES or a game framework build on top of it. I recommend you to check cocos2D, SIO2 engine, or examples from SDK.
With careful programming it is possible to make an Open GL ES game with parallax scrolling and relatively small amount of objects work at 60 FPS even on 2nd gen devices. Tiny Wings is an example of such game. And maintaining stable 30 FPS is not a problem at all.
I skipped Quartz and went right to OpenGL ES. I started with a 2D sprite based game. Thought it was pretty easy.
The key is having a good example to look at. I used the Lunar Lander clone (Crash Lander), but I don't think that's easy to find anymore. Maybe someone who has done it recently knows of a better, newer example that uses current best practices.
I'm in the same boat as you describe, although I have no programming background. (Although I don't know what your background is either) Currently, I am in the process of learning to code as I learn the various API's that are available. I'm an objective-c guy going backwards to the c-based Quartz API, and it's a little bit of a challenge. Luckily, Programming in Objective-C 2.0 by S. Kochan has a great chapter on underlying C features to keep you afloat.
I have taken a couple of stabs # OpenGLES, and I have to say, that from a conceptual standpoint, I'm not ready for it. The Quartz2d API is a bit easier to learn conceptually because it's very easy to get up & running with a few commands. Right now, I'm at the point where I can define shapes and point to point images with out too much trouble.
OpenGLES is going to be something in my future, but it takes such an enormous amount of code to configure the drawing view, set up buffers, etc. If you are familiar with everything the code is doing, then it's a bit easier. However, from a learning perspective, Quartz is an easier way to get going, quickly.
Resources I'm using: The aforementioned book, and an anemic amount of blogs containing tutorials, which are limited # best. At this point, make an appointment with the apple docs and get cozy, because it's about the best (free) stuff that's out there (& exhaustive) With that said, I'd love for someone to prove me wrong on this site by posting a great resource for learning, but that's about it. Good Luck.
I have been looking for the fundamental differences so I can decide between OpenGL (ES) or Quartz or a hybrid. The good news is that the hybrid is an option. Clearly Quartz is easier to master for O-O programming and the answer from Apple appears to be that OpenGL, "...is ideal for immersive types of applications..."
http://developer.apple.com/library/ios/#DOCUMENTATION/General/Conceptual/Devpedia-CocoaApp/DrawingModel.html
I don't want to limit the category to games as I believe any game UX can be applied to a business App, a productivity App, entertainment viewing, etc. By the same token, I fully expect the technology (both h/w and s/w) to advance to make either a choice.