I'm beginning in iPhone/iPad game dev and I'm searching to set up my learning path.
The basic features I would like to learn (after the basic SDK iphone components programming) are :
using a board like interface where I can move pawn with my fingers
detect where the pawn was moved and triggers events in the game
The board will be constitute by 6 tiles that may be organised randomly when starting the game : may i use an sdk component with a delegate and datasource to determine where the pawn was left and on which tile ?
need to use dices (which kind of library may I use ?)
...
Do you have any idea about where to start ? ;-)
Many thanks,
Tib.
Jens Alfke has provided the GeekGameBoard framework for building Mac or iPhone board and card games. He talks about it here. I'd highly recommend that as a starting point for an inexperienced developer looking to create a board game.
Additionally, you might look at the answers to the similar question "iPhone board game: OpenGL ES or CoreGraphics?". As I recommend there, read up on Core Animation (what GeekGameBoard uses for layout and animation) for providing your layered graphics and animation, rather than jumping straight into the more complex OpenGL ES.
Related
I am going to make a 2D iPad game today, but I do not want to use a game framework. I am more interested in how the framework is created, how to program the physics, and other low level topics.
So, if I'm not using a framework, how do I start? Is the first step to create an OpenGL based app in XCode?
OpenGL would be a place to start, but i would look through the cocos2d source, and see how various things are being done in that.
To program a 2D game from the ground up, especially if you're new to iOS, I don't see any reason to use anything other than the CoreGraphics and CoreAnimation APIs. Any bitmap-based imaging is typically done via OpenGL behind the scenes.
I am new to iPhone dev and would like to write a game that involves 2d collisions. Would somebody give me a conceptual overview on how the various frameworks interact in a typical 2d collision game?
The candidates I see mentioned so far are 2d packages such as quartz and cocos2d and physics engines such as chipmunk and box2d. What I am not extremely clear is the relationships among these in my context.
Thanks in advance for answering!
Quartz is a 2D graphics API by Apple. It's usually not used for performance-intensive games, because you can get better performance by using OpenGL directly or by using some thin framework made for games. (Which is what Cocos2D provides.) The collision stuff is independent on this debate, since the collisions are usually calculated without knowing anything about the graphic representation of the colliding objects.
The relationship between collision (or general physics) engines and the graphic layer is exactly the relationship between a model and a view in the MVC pattern. In each frame you move the physical world a bit forward (physics) and then you draw the objects on their new positions (graphics).
In reality the model and view sometimes blend a bit to make things faster, but in principle they are completely separate things. Which means you can pick any of the possible combinations of OpenGL, Quartz or Cocos2D as the graphics engine and Box2D or Chipmunk as the physics engine and get a decent game. I'm not sure how well do the particular combinations work in practice - if that was your question, then I've just wasted a few minutes of your life :-)
zoul got it right, I would just add this :
Cocos2d for iPhone provides samples including Box2D and Chipmunk if you want to try them and see how easy or hard they are to use. So you can go ahead and download Cocos2d, then play with the samples a bit to see if it fits your needs.
I have some development experience of CocoaTouch Layer, Core Service Layer iPhone Applications.
Now, I have to migrate for some pure 2d and 3d graphical iPhone Applications.
For that as per my knowledge, I need following frameworks to learn :
1) Core Graphics
2) OpenGL ES
3) Quartz Core
I want to know that what should be the approach to learn this framework quickly.
Or else which framework to learn and which is not, and using which source I should learn this frameworks.
Thanks in Advance
Core Graphics
For this, I'd first recommend reading the Quartz 2D Programming Guide. It's the best set of documentation you'll find out there on the subject. Next, I'd read through some of the questions here tagged core-graphics, quartz-2d, or quartz-graphics. There are some great source code examples in the answers to those questions.
OpenGL ES
There are many "getting started with OpenGL ES" questions here, with links to many resources. These include:
Books on OpenGL ES targeted towards the iPhone
Learning OpenGL ES 1.x
What do I have to learn to get done with a 3D racing game for the iPhone? What Tools do I need?
Want to display a 3D model on the iPhone: how to get started?
I personally recommend the book "Mobile 3D Graphics: with OpenGL ES and M3G", as well as the "OpenGL ES Programming Guide for iPhone OS". My application Molecules is open source and it uses OpenGL ES. Finally, Jeff LaMarche has a great tutorial series on OpenGL ES.
Core Animation
By Quartz Core, you probably mean Core Animation. Again, I'd start with Apple's Core Animation Programming Guide, then take a look at the code examples you can find here under the various core-animation tagged questions. Beyond that, Bill Dudney's Core Animation for Mac OS X and the iPhone book is a very good introduction, and Marcus Zarra and Matt Long's Core Animation book looks to go into more detail on the subject.
I'm not sure there is a quick way really. The docs are pretty vast. And you need a pretty solid knowledge of fundamental graphics principles. I had trouble getting my head round the concepts and I have used a lot of graphics toolkits.
Couple of points that might be useful:
when trying to draw a rotated image, you need to translate the coordinate transformation back to the QUARTZ origin (bottom left) not some custom origin you set up eg top-left
SO you're best off (unless you know you and no one else maintaining your code will ever want to daw rotated images) accepting the possibly new to you ideas of using bottom left coordinates (where appropriate) rather than trying to override them by changing the context CTMs
don't assume that Core Graphics can do everything you want. You may need to manipulate pixels manually yourself for some tasks
design with the memory limitations and numbers and sizes of buffers to do a processing sequence firmly in mind
design with the texture size limitation of 1024 pixels in mind
make sure you use algorithms and approaches that are within the capabilities of the CPU and/or GPU; test with a mock-up first to sound out the performance issues
if doing 3D animations in OpenGL ES make sure that you have a way to reconcile and synchronize real time with the physics model of whatever you are animating
consider colour management, shading and highlighting, pay particular attention to the device's capabilities there
where possible use Core Animation instead of Core Graphics
OK, I'm still brand new to iPhone development. I have a free game on the app store, Winner Pong, but it's just a Pong clone (who would've guessed) that uses the standard UIImageViews for the sprites. Now I want to do something a little more complicated, and port my game for the Xbox 360, Trippin Alien, to the iPhone. I obviously can't keep using UIImageViews, so I was wondering which would be better to learn: the simpler, but performance-hindering Qurtz2D, or the smooth-running but dauntingly complex OpenGL ES.
My game is basically a copter game, with about 8-10 sprites on screen plus a simple particle system (video here). Not too complicated, but performance does matter. My only prior game programming experience is in Microsoft's XNA and C#, which has a built in SpriteBatch framework that makes it incredibly easy to draw, scale, and rotate pre-rendered sprites on screen. Is it worth it to learn OpenGL ES? How big is the performance gap? Is quartz really that simple?
Also, if anyone knows of any tutorials for either one, please, post them here. I need as much help as I can get.
Look through code samples of each to actually see the complexity. You might find that OpenGL isn't so daunting.
Regarding the performance. Core Animation, which Quartz2d is part of, uses OpenGL behind the covers, so for simple sprite animations, I would expect your game to perform fairly well.
I would also glance over the programming guide for each before making your final decision.
Another alternative is to use something like Unity. I recently just started playing around with the trial version of this development environment and if you're mostly doing game development with graphical objects and sprites, this may be one option to consider. You can script in C#, Javascript, or Boo. The development environment allows you to graphically setup your scenes and levels. You can then attach scripts to graphical objects for animation to handle user events, etc.
One downside for Unity, which I've heard from others is that if you want to use the familiar UI controls from UIKit, it's not so easy to instantiate them...I haven't verified this myself.
When you drag an iphone GUI element like a list, it scrolls in a physics correct way, and also has a nice bounce effect at the end.
I would like to write a GUI element in my game, without using UIKit. I wonder where is the code implementing this, and if I can use it instead of trying to write something similar.
Any ideas?
I think that a physics engine would be overkill for just animating a gui element (unless you already have a physics engine in your game).
You could try using animations but I've no experience of doing this without UIKit but I suppose you would start here?
If you didn't want to use Core Animation, I would take a look at Robert Penner's easing equations - they're in actionscript but are pretty simple to port to C and would be a good start to get your own animation code started.
Hope this helps,
Sam
You can perhaps use animations to achieve this, you can define animation paths for bouncing or doing whatever it is you need and activate them when needed. I think the example project MoveMe can help you out
I can recommend the O'Reilly book "Physics for Game Developers" by David Bourg, which has great coverage of algorithms and code for all sorts of simulations. You probably want to start with motion affected by drag for the flick and gradual slowing, then look at a spring model to simulate the damping at the end.
box2d is an open source project that provides a great 2d physics engine.
this library is used by Intel clutter, which is a nice physics oriented UI library that is capable of running on mobile devices. that means that box2d is already optimized for mobile platforms like the iphone.