Graphics for a iOS 2D Game - ios

I've already published a 2D game on the App Store, but I've noticed that when I add too many objects, the fps drop down, and it's a quite simple game, so I believe it shouldn't happen.
So I think that I'm not rendering the graphics properly.
What should I use, OpenGL ES, Quartz 2D, ...?
I've been reading Apple's documents about OpenGL ES for iOS, but they hardly ever mention 2D, so I'm not sure if it can be used for this.
I'm now using Quartz 2D, (I guess it's UIView, UIImages, UIImageViews), but in fact, I'm not using the drawRect method of the views, ever. I create the images or graphics within the init function of the view, and a save them into a variable if I need to modify their properties later.
Any suggestion, recommendation, pdf would be highly appreciated! :)
PS: Here's a link to the game, if you want to have a better idea about it: http://itunes.apple.com/es/app/kipos/id494638587?mt=8

I recommend you use Cocos2D. Its features will make game development a lot easier for you. If you think you're up for a challenge, try OpenGL ES. I'll warn you though: it has a very steep learning curve.

Related

How to draw lines on the screen for an iOS game

I am working on a game where I need to draw a bunch of lines to create a wireframe sort of object, I can do this in sprite kit using nodes but adding a bunch of nodes to the screen will drop the frame rate down a lot. I don't know how to use OpenGL Es at all so that's not an option for me. Is there anything that would just allow me to draw lines on the screen in Sprite kit without adding nodes or is there another framework that will allow me to do that?
If you want a 3D wireframe then your choices are sprite kit (which is built on top of OpenGL), OpenGL, or Metal. Or I guess you could use somebody's 3rd party framework that is also built on top of OpenGL or Metal.
I tend to agree with nhgrif's comment that you're "I don't know xyz so I can't do that" is needlessly limiting. If you can't do anything that involves learning new APIs then you're never going to get very far as a developer.

up-to-date simple OpenGL ES tutorial / template for iOS

At the moment i can draw a route on a map.
On the map i can zoom and i can pan. If the route is very big it goes really slow.
Therefor i want to do it with OpenGl.
From the map i can convert coordinateToPixel and get the current zoom.
I thought it would be the best to base the translation and zoom on that for the transformation matrix.
I never worked with OpenGL before. I have been reading stuff for the last few hours but most stuff i read is outdated or goes into things i don't care about for now like shaders.
Can someone provide me with resources for simple stuff like on the image?
I never worked with OpenGL before.
You are asking a lot, and I do mean a lot, of work from yourself if you want to switch from using native iOS drawing methods to using an advanced real-time rendering system that you don't even know yet.
I agree with Brad Larson that you are going to go much further and faster by leveraging the tools in iOS for your purpose. However, that does not mean you can't improve performance while using them.
I have found that when using Core Graphics for complicated drawing, you can dramatically reduce the time it takes to render a drawing by drawing it on a background thread. And Apple makes it much much easier to learn and use Grand Central Dispatch than the time it would take you to do all of this in OpenGL.
I learned how to use dispatch queues also for the single purpose of making drawing go faster. The simple technique is to render in the background, then take the results to the main thread for displaying them. Since you already have your drawing code figured out, you won't have to do much extra work to take this extra step, and I think you will be impressed with the performance.
I saw an improvement of at least 5 - 10 times in drawing speed when I implemented Core Graphics drawing with dispatch queues. They are really awesome.

IOS GLKit Textures for Cube

new to IOS OpenGL programming. I have worked through a few tutorials that talk about the basics of OpenGL ES and been able to create a small demo program that draws cubes in a scene at positions I want. Id like to apply a texture to the faces of the cube but for some reason this seems to be a near impossible task to figure out. Im using GLKit , Ive searched all over and can't find a dead simple tutorial on how to do this without a lot of other fluff. Can anyone point me in the correct direction or have a tutorial on this? It doesn't seem like this should be hard thing to do. I must be missing something..
Go here for many tutorials bout this http://www.raywenderlich.com/
or here
http://www.raywenderlich.com/5223/beginning-opengl-es-2-0-with-glkit-part-1
this one explains about textures in detail:
http://db-in.com/blog/2011/02/all-about-opengl-es-2-x-part-23/
Id recomend not to use glkit directly (maybe some helper methods) since even tho it is easier as it works like opengl 1 most of the tutorials for gl es 2.0 wont use it and you will get confused.
Use this one for glkit to load textures
https://developer.apple.com/library/ios/#documentation/GLkit/Reference/GLKTextureLoader_ClassRef/Reference/Reference.html#//apple_ref/doc/uid/TP40010922
Try google with something like glkit texture example
this is what i got :
https://github.com/jlamarche/iOS-OpenGLES-Stuff/blob/master/GLKit%20Stuff/GLKBaseEffect%20Drawing%20Example%20with%20Texture/blah/MCViewController.m
around line 119 you can see how to use the texture, i havent checked it but it seems valid. I usually prefer to just use normal opengl since even when you have a simple program the shader file is ridiculously simple, (like less than 10 lines).

Unity for 2D games

Ignoring price for the moment, would using Unity for a 2D game be better than building one natively in iOS, i.e. faster and more powerful because of the underlying OpenGL usage, or is it either not supported well, complete overkill, not much better than just using UIImages and/or Quartz, or for some other reason worse?
Depends on the game. If you have under 100 or so sprites, you can just use UIViews without any big issue. Over that and you're starting to get in the realm where OpenGL will matter.
If I were doing a game with with lots of sprites or particles, I'd certainly look into Unity. Then again, I'd also look into Cocos2D. (I'm not directly familiar with either, my games are all UIView-based.)
Building any game using Unity instead of just UIKit/Quartz has the advantage that it will be easier to port it to other platforms if you want to.

What options for decent particle effects engines do I have for iOS?

The core question is "what are my options for decent particle effects in an iOS app?"
I wrote an iPad app where I wanted to use a large amount of UIKit objects in the UI and just keep to a native iPad codebase feel. However I wanted nice particle effects, so instead of going with cocos2d and distancing myself from using native objects directly, I wrote my own particle effects engine utilizing quartz. It works, but the performance is very underwhelming.
Do I have to go with an openGL ES solution to get any good performance at all (openGL and uikit view don't play nicely together); Are there any libraries out there that will let me simply add a UIView that contains the particle effects systems layered in my app as I see fit to place it (pretty much what I've tried to do with pretty bad performance)?
(Forgive me if my usage/knowledge of GL is rusty; I've been out of sight for a few months and do not have a strong handle on it.)
I believe they've added particle effects to Core Animation as of iOS 5. Try this video or look up CAEmitterLayer.

Resources