Is there an efficient and standardised code for multiple OpenGL ES Views on Iphone? - iphone

First of all thanks for taking the time to read through and attempt to help with the problem I'm having. First question posted here and after reading through the startup agreement I'll try and be descriptive as possible =)
I'm currently working on a Game for the Iphone as my final year university project. This game is one I hope to continue working on and expanding after I leave and use as a springboard for my CV into the industry. I've got a good few months left, so plenty of time to take things slowly and carefully plan it out.
I have a background in Java and OpenGL in C++ so I understand some of the basic fundamentals. I'm not that experienced in Objective C yet, need to start somewhere =), so I apologise for any obvious mistakes I'm making. The current state of code is i've got multiple items rendering to a single OpenGL ES view based on the OpenGL ES 1.1 model. I feel since the project is primarily 2D I shouldn't need to go to the higher version. I would post up the code I have but it's full of prototyping and misc code and is incredibly messy. In fact I wouldn't mind restarting the code as a multi view template then moving over the blocks of code as I get them working.
I've done research through many different mediums as to the ideal way to create a multi view application with each view being OpenGL-ES based. I've seen many tutorials on using the UI-kit view with an OpenGL view, but I've decided the best way for my project to ensure full dynamic and customisation I'd be happier using openGL for all the views.
TL;DR:
The question I'm trying to ask is if theres a good tutorial or template anywhere I'm missing that will allow me to start up a new multi view project that will allow me to switch between multiple views (Menus etc)?

You can't go far wrong with cocos2d if you're making a 2D app but want it to be openGL accelerated.

Related

Does my *Entire* game have to be remade, to use Cocos2D?

I have been making my game in a pretty conventional manner. I just created a new window based application and have built off of that using my own images, table views, etc. Now I am about to begin programming the gameplay, and I just recently discovered Cocos2D. My question is this: In order to use Cocos2D for the actual gameplay (Which would take place in a single view) do I need to recreate my app from scratch? Or can I just make the one view using Cocos2D?
You could go down the mix-and-match route, but it would likely drive you insane.
If you want to embrace Cocos2D, you will likely be better off moving to it fully. More likely than not the time invested will be yield improvements in your existing code that you'll find surprising (certainly, I've found that rewriting something pretty much always yields a better solution in fewer lines of code).
You do not want to keep using the standard SDK in your game, if you're going to use Cocos2D for the game view (which you totally should).
Re-do the entire app in Cocos2D -- you'll have way more possibilities to make your game menus awesome and much less headaches; both while developing and while maintaining your game.

water effect in cocos2d

I'd like to have a water effect on a background layer in my app. The effect doesn't need to react to touch or anything - it just needs to wave an image a little bit.
CCWaves3D seem ok, but leave have nasty black artifacts around the edges when I run it. Similarly CCShaky3D. CCLiquid brings my app down from 20fps to 5fps..
Is there any other effect I might want to try out? Or perhaps I'm using the current effects in a wrong way?
id shaky = [CCShaky3D actionWithRange:4 shakeZ:NO grid:ccg(15,10) duration:4];
id liquid = [CCLiquid actionWithSize:ccg(15,10) duration:1];
id wave = [CCWaves3D actionWithWaves:18 amplitude:80 grid:ccg(15,10) duration:10];
Bonus question - where can I find any good documentation for cocos2d effects? I found default cocos2d docs utterly useless & wasted a couple of hours trying to google before asking this question :/
I have noticed performance issues when building/running in debug mode. Have you tried to build/run in release mode? Also, are you experiencing this on the device and not just on the simulator?
Unfortunately, I have not found alternate documentation specifically for cocos2d effects. Here are a few links to posts and sites I have gathered for many different resources including tutorials, tools for making tile map games, using zwoptex for making sprite sheets, using vertex helper for making a verticies plist file for box2d/chipmunk collision detection instead of just rectangles, and sites for images & sounds:
Cocos2d Resources
Need 2D iPhone graphics designed
http://www.learn-cocos2d.com/knowledge-base/tutorial-professional-cocos2d-xcode-project-template/
I have found Ray's Tutorials especially helpful along with viewing the test applications included with cocos2d.
Happy coding!

Getting better at drawing in code for Cocoa?

What are some suggested "paths" for getting better at drawing in code in Cocoa? I think at this point, that's my biggest weakness. Is drawing in code something general, or Cocoa-specific?
Thanks!
- Jason
The best way is probably practice. Try drawing some simple things at first: a calendar (basically a grid), a custom button, or a digital clock.
Its also worth noting that a lot of 'custom' controls are made from images, so not that much of the drawing is done in code -- the only thing the code does is stitch those images together.
You might want to look at Opacity, a drawing app for OS X (I'm not affiliated with these folks, just discovered the app a few days ago). What sets Opacity apart from other drawing apps is that it can create Quartz code directly from your drawings. Naturally, the generated code is not perfect but in the few days I've been trying this app I've found it to be quite helpful in understanding how to use Quartz more effectively.
Drawing in code is need for creating custom controls no matter what UI toolkit you pick. Drawing in code certainly has its advantage, for example the application/framework that you are building is really lightweight come production time, cause there will be lot let resources(images/fonts/etc) to worry about.
Also if a problem arises changing drawing in code is a lot easier than to redo code and images together.
If you are doing Cocoa drawing start by looking at source code of BGHudAppKit and reading Cocoa Drawing Guide by Apple.
I'm in the same boat as you; I'd like to learn more about drawing code.
It's a big document, but the Quartz 2D programming guide on the developer website seems like a good place to start from. They introduce Graphics Contexts and Paths and include plenty of images.
There's also a book referenced in that document, Programming With Quartz: 2D and PDF Graphics in Mac OS X which looks good. The APIs for iPhone and OSX are almost identical, so there's no problem using a Mac OSX book.
So I'd suggest start with the Apple documentation (you don't need to read past the section on CGLayer drawing), try some sample code and figure out how it's working. Then move on to either that book or find more sample code on the web. Good luck!

Interface Builder vs Cocos 2D - how choice the best for your app

I was a flash developer for 3 years, and in the last 5 months, i begin the iphone development, i do 2 applications with interface builder for clients, and now i really want to do a little game, is quite simple, one match 3! I made the engine in interface builder, and seens good to me! But after i read some posts, i really want to try it in the cocos2D! So, in 2 days i rewrite all my first engine for cocos2D, very annoying upsidedown coordinates but ok, i really do! But the performance side by side with interface builder version is really scare! Many Many slow downs at the cocos2d side! And the animation seens bugged to me! I really scare! I really don't know what is the best choice for a simple game.
And i want some opinions:
Using cocos2d when need some physics? When we have many objects at screen? What is the performance boost i have with cocos2D?
I have how to share this 2 applications with you guys?! Without your UID?!
cocos2d uses chipmunk, which IMHO is a great physics library if all you need is 2d! Apple doesn't support ad-hoc distribution without knowing the Device ID of the test device!
I think baDa is asking when to use cocos2D and Interface Builder. Since you can develop games using Interface Builder, is it advisable to do so? What are the performance differences between this two approach (cocos2d vs Interface Builder)?
I also had a confusion and ask this to my self when i was just starting to program. After working with several games. I reallized that you can actually combine this two approaches. The big BUT is, when working with objects dynamically (specially with bunch of images) using IB, it totally removes the flexibility of the code. Adding/removing images, adjusting coordinates and replaceing scenes is just too awkward, bulky, and wastefull to implement.
My simpole rule is to use coocs2d for game developemnt and IB for other apps that is reach in interfaces.

Can i use pickerview in my iphone application using cocos2d?

Duplicate:
How can i use picker view in iphone application using cocos2d ?
Hello everyone i am working on iphone gaming project.In this game i want spin some image (like reel spin).But i can not do this.Can i use picker view in this application using cocos2d.If can then give some instruction how can i do that or any different solution for this project.
You can use anything your want. I am constantly amused by the number of people who think that Cocos2d is some sort of world that you enter where you cannot bring any of your old friends. Cocos2d is just a library that makes OpenGL easy for games, and that is all it is. All it is.
I think you might benefit from trying a few easier projects first. I have made the mistake of trying to jump into something beyond my understanding, and while in the end it may have been beneficial, I sometimes wish I had learned in a more systematic manner.