Learning iPhone Game Programming – available on Safari Rough Cuts
I’m really pleased to announce that my book “Learning iPhone Game Programming: A Hands-On Guide To Building Your First iPhone Game” is now available in Safari Rough Cuts.
The final book will also include video tutorials for many of the chapters in the same style as those on the blog. These are not available yet but will be once the book is in print.
I’d really appreciate any feedback or comments you may have and I hope you enjoy it as much as I have enjoyed creating it.
Mike
78 Comments
midnightlawson on March 9th, 2010
Excellent, gonna have to get my copy asap!
Tony on March 9th, 2010
Great work, Mike! I can’t wait to get my hands on a physical copy.
Keep up the great work.
mike on March 9th, 2010
Thanks guys :o)
@Submerged, the link looked like it was wrong so I’ve fixed it.
Mike
fredflinstone on March 9th, 2010
I do not have safari rough cuts, so I shall have to wait. If it’s as good as the tutorials online then it should be good.
This may sound stupid, but I am curious about if you buy the book from a shop how do you get the videos are they on a dvd included ? or a download link ?
mike on March 9th, 2010
@fredflintstone, that is not a stupid question at all :o)
All the source code and tutorials will be available as a download. There isn’t going to be a DVD with the book.
Mike
RoberRM on March 9th, 2010
Great work, Mike! You finally did it! :D
I have one question, though: if I buy now your book in Safari Rough Cuts, will I also receive the whole book when you finish it or will I have to buy it again?
Good luck now submitting your game to the app store. ;)
George on March 9th, 2010
Grrrreat Mike. Just purchased it. Now to read…
Scott on March 9th, 2010
Congratulations Mike!
You are a natural teacher. I hope your book does phenomenally well!
-Scott
mluelmo on March 9th, 2010
I’ve got it as I promissed. Waiting for download, the system is “watermarking” my copy… :-D
I’ll comment it when I can download and read. What I’ve read was so nice.
Congratulations Mike.
Learning iPhone Game Programming – available on Safari Rough Cuts … | Drakz Free Online Service on March 9th, 2010
[...] is the original post: Learning iPhone Game Programming – available on Safari Rough Cuts … Share and [...]
BW Griggs on March 9th, 2010
Bought! Mike, will the source code for available chapters be supplied on the Safari website soon?
mike on March 9th, 2010
Hi guys. If you check out the comments on the book on Safari you will find the link to the source. Differences between the source and book are being addressed at the moment during edit.
Mike
Peter on March 10th, 2010
Mike I’ve been around since tutorial 1 and just bought the bundle :)
The book looks great so far, certainly the best I have seen in terms of complete, understandable,and applicable content.
Can’t thank or congratulate you enough!
HK-Paul on March 10th, 2010
Well done Mike – looks good from what I’ve seen so far.
SteveMelvin on March 10th, 2010
Mike, good job on the book! I bought the rough cut and it seems like it’s going to be a good read. I downloaded the source dmg and noticed a problem with the Image class. When I tried to rotate an image, it always rotated at 0,0 and not the center of the image. In image.h there is a CGPoint rotationPoint, however it’s never being assigned a value. I changed the rotation code in the render method and it seems to work as expected:
mike on March 10th, 2010
Thanks for the great comments guys, I am SOOO pleased that you like what you see :o)
@SteveMelvin, thanks for the feedback. Within the Image class rotationPoint is a property that can be set. By default is is set to 0,0 but you can set the point around which rotation will take place to any point you like rather than just being limited to the middle of an image.
You could always set the rotationPoint during initialization of an image to be the center of that image and then change it later if you wanted too, so just moving the code you have added to the initializeImage method in the Image class.
You’ll see towards the bottom of that class that rotationPoint is set to CGPointZero, just replace that with your code and your done :o)
This also means if you needed to rotate around a different point you can just set the rotationPoint.
I will add comments to the code to make this more obvious so I appreciate the feedback.
Mike
Simon on March 10th, 2010
This is great news – well done Mike.
You must be pretty elated at the moment with a great sense of achievement.
I’ll be heading over to rough cuts now to check out your book :)
Is there an ETA on the final version – as while I love the web and it all brings I’m prefer the “printed word” to reading large chunks of text on screen – plus I don’t think it wise to read off my laptop in the bath lol
Very happy for you and I hope it’s as successful as your blog.
Simon
mike on March 10th, 2010
Thanks Simon and I agree, reading your laptop in the bath is NOT a good idea :o)
The printed version currently has a scheduled date for July. I’m doing the edits from Tech review at the moment then it moves into copy edit then production edit etc.
The book is going to be full colour with the code coloured as it is in Xcode, so I’m really looking forward to seeing the printed version myself :o)
Mike
FoxtrotF on March 10th, 2010
I waited for this Great News :)
“but Library account not allowed for country 95.56.***.***”
:((((
FoxtrotF on March 10th, 2010
Bought :))
But only after paid for subscription to “Safari Books Online”
Simon on March 10th, 2010
Having it printed in color is a nice tough. I look forward to getting that version : )
FoxtrotF on March 10th, 2010
Mike, Currently I’m watching Bitmap Video Tutorial, any recommendation on how to combine reading book and watching tutorials?
mike on March 10th, 2010
Hi FoxtrotF. The tutorials on the blog use a very different code base to the classes in the book. The book should be read independently from the blog tutorials. New tutorials will be available specifically for the books code when the book is in print for those who have purchased the book.
Hope that helps.
Mike
SteveMelvin on March 10th, 2010
@Mike
I see. From a usability standpoint, I would suggest setting the rotationPoint to the center of the image when the object is initialized, as this is what usually assumed when an object rotates. Then, if the developer needs to rotate an image about a different coordinate, they can use the property and change it. I have to be honest and say that I haven’t read that chapter in the book (I’ve watched all the tutorials though :) Can’t wait til July when I can pick up the real-deal.
Also, when downloading tutorial 12 source, it seems like it’s not the right source, but rather the joypad example.
Learning iPhone Game Programming Book | iPhone and iPad SDK Development Tutorials and Programming Tips on March 10th, 2010
[...] Mike Daley’s upcoming book iPhone Game Programming has been released as a rough cut (essentially a beta verson of the book). You can read about it here: Learning iPhone Game Programming – available on Safari Rough Cuts. [...]
louis002 on March 10th, 2010
k so I have been bouncing around from site to site for the past few months learning everything I can about programming for the iphone and at last! I have found a site that can really help! Thanks Mike & John!
Nick on March 10th, 2010
@fredflinstone and RobertRM: Go here, click on the Purchase Options button at the right side of the page, and choose the option you want:
http://my.safaribooksonline.com/9780321699565
You can buy just the book, just the online access and pdf, or the whole bundle, and you don’t have to be a registered Safari subscriber to do it. Great work Mike, if it was possible for a pdf file to look dog-eared, mine would be already. You have clarified all the stuff in the original tutorials, so now we don’t have to go hunting through them to look for changes, and heaps of new stuff too. Many thanks, but wait … where’s the t-shirt? Maybe you should sell a pdf with a large image of the 71squared logo so people can print one for themselves.
Nick on March 11th, 2010
Where do you want us to post suggestions/corrections/additions Mike? Here, or in Safaris comments section? All the comments I’ve seen in Safari so far are just general (and well deserved) congratulations. What about code ideas etc?
mike on March 11th, 2010
Hi Nick, any updates to the book should be posted on Safari as it makes it easier to see and deal with.
Thanks
Mike
Nick on March 11th, 2010
Have put one suggestion up, but I think I put it in the wrong place first. In the feedback section. Haven’t used Safari before I’m afraid, so I wasn’t aware that comments could be posted for each chapter in the on-line reader. Have now reposted in the chapter 13 section, but can’t remove the feedback post. Sorry for that.
fredflinstone on March 11th, 2010
@mike
thanks for answering my question and good luck with everything
@Nick
thanks i did not realise, will look into the options and see which is best
Trisect Development on March 12th, 2010
I tried to buy it, but I can not. I’m from Denmark and it ask me to select “State/province”.
What to do?
Tony on March 12th, 2010
Hi Mike,
I’m really enjoying the read. The detail is really good and the flow perfect. A few typos here and there, but the editor will take care of those. The occasional humour is welcomed. Having followed the tutorials, you have conveyed the same completeness in your explanations. This may well become THE bible for game developers.
I’ve purchased the print bundle. The web page said that the book would be shipped within two weeks of publishing. The confirmation email said three. Either way, it is too long a wait. Even though I understand most of what you cover in the book, thanks mostly to your tutorials, the book will be an invaluable reference in my library.
Many thanks for taking all this time to do the tutorials and write the book and answer our questions. Did you ever thank your parents for that Spectrum they got you for Christmas ’82?! Did you ever think you would have a book published because of it? Must be quite a ride for you. Congrats!
Tony
mike on March 13th, 2010
Thanks for the support Tony. I really never did think that the Spectrum my parents got me would lead to either a career in computing or to writing a book :o)
The book is coming along well. I’m getting some fantastic feedback on Safari and from the Tech reviewers.
It’s been a hell of a ride and I’m enjoying every minute of it. I’m starting to think about book two now ;o)
Mike
p.marturano on March 13th, 2010
Hi Mike,
i’ve purchased your book on Safari, it’s a great work, congratulations!!!
I’m enjoyng the read, i’ll send you my feedback.
i’m thinking about using the book in my classroom, during my new iphone game course in Italy (Turin/Milan). (www.iphonedeveloper.it)
Pierpaolo
Rookie on March 13th, 2010
Getting the book. Thx mike!
Simon on March 14th, 2010
I’ve bought the book – Thought that i’d get access to the code? Can’t seem to find details for that can you tell me what page to look on or maybe send me it?
fredflinstone on March 14th, 2010
@simon
http://my.safaribooksonline.co.....bfeedbacks
follow the link to rough cuts
go to the comments
there should be a link in the comment marked “sample projects for this book”
RoberRM on March 15th, 2010
@Nick Thank you very much for pointing me in the right direction. ;)
gary on March 15th, 2010
Great work Mike! Call me old fashioned but I like the ‘traditional’ way of reading, I see amazon have it slated for 28th August, some time away yet! I might just have to go the safari route and buy both the PDF and the hardcopy, o and an ipad to read the bloomin PDF on ;)
Ahhh Manic Miner such good memories, it was worth reading the sample chapters just for that. I started on a ZX81 and the big game on that was ’3d Monster Maze’ amazing how using very blocky pixels you could get a realistic (and scary!) looking T. rex!
Cheers
Gary
Craig on March 22nd, 2010
Congrats Mike. I’ve been working on my first iPhone game for a little while now, and have found some of your tutorials very helpful.
Bought the PDF and the book is looking really good. Good luck!
Craig.
Stormtrix on March 22nd, 2010
great news on book.. the tutorials are great, however is the book based on the latest version of Xcode ?
I was following along Tutorial 1 on your site but running latest version of Xcode it doesn’t match up.. there are ES1renderer.h and .m’s now vs. just EAGLView.m
thanks
mike on March 22nd, 2010
Hi Stormtrix
Yes, the book is using the the newer templates which include the ES1Renderer for working with OpenGL ES 1.1 and the ES2Renderer which is used when using OpenGL ES 2.0. The book is only using OpenGL ES 1.1 as that is easier to get to grips with when starting out and also means your game can be run by a much larger customer base.
Mike
nexus6 on March 22nd, 2010
@Mike
Hi Mike, it’s been awhile just bought the Rough Cut.
It looks really good! I knew it would.
mike on March 22nd, 2010
Hi Nexus, great to hear from you. I’m glad you are liking the book. The final version with all the edits from the tech reviewers and the input from people who have bought the rough cuts version will make the final version even better :o)
I’m really pleased that people at last can get to see the book and the code. I’ve been fit to burst wanting to get it out to people :o)
Mike
nexus6 on March 22nd, 2010
@Mike,
I can’t seem to find the code for download. Is there some other place to download it?
Thanks.
Peter on March 22nd, 2010
Hey Mike
Any idea when you’ll have more info on how you implemented the tile map stuff? It’s radically different from the original code and certainly difficult to figure out with no tutorials or material available.
mike on March 22nd, 2010
Hi Peter, which code do you mean. The only tile map code I have is that used in the tile map tutorial on the blog or the code in the book which is explained in the Chapter on tile maps?
Mike
Nick on March 22nd, 2010
@Nexus6
Click on the link to Safari Rough Cuts in Mikes first post on this page.
On the Safari page click on the feedback tab. Scroll to the bottom of the feedback listings and click on the entry
Sample Projects for this book by Chuck Toporek.
The link to the BIGDProjects.dmg is the download for the project source files. You’ll have to copy and paste, it’s written as text not a hyperlink.
Once it’s in your downloads just run it like any other install.
Peter on March 22nd, 2010
@Mike
The Chapter on Tile Maps is not available when you download the pdf from roughcuts. I forget what it says but the entire chapter is empty.
mike on March 23rd, 2010
Hi Peter, thanks for the info. I’m not sure why you cannot download chapter 9. I’ll check with the publisher to see what the problem may be.
Has anyone else who has bought the book had the same problem with chapter 9?
Mike
Craig on March 23rd, 2010
@Mike: Yes, Chapter 9 says “This content is currently in development.”. I just assumed it wasn’t finished yet.
The code examples only seem to run to Chapter 12, then the final project too, while Chapter 13, at least, refers to a Chapter 13 project.
Trisect Development on March 24th, 2010
Mine also says “This content is currently in development”
Nick on March 24th, 2010
Same here – Chapters 9, 17, 17 and Appendix A are all marked
[This content is currently in development]
Nick on March 24th, 2010
Sorry, that 2nd 17 should be 18
JohnnyB on March 25th, 2010
Hi Mike, been following the videos now for a few months just bought the complete bundle and just built the project. Have to say you really did a great job with the videos and book! Thank you!
I do have a questions: I see the game is setup to run in landscape but I see you refer to a sample project in chapter 13 but I didn’t see a chapter 13 sample in the source projects, will this be out at a later time? I am interested with changing from landscape to portrait using OpenGL, but any examples I see do not work I did see in the OGLGame tutorial 11 project that you do define a flag: PORTRATE_MODE in the initOpenGL function but when I set it to NO the menu and game scene are way off. Not really a big deal because your latest source runs in landscape mode, but would like to figure what I did wrong, I know the touch coordinates are reversed which is a easy to deal with.
But really thanks again Mike!
George on March 25th, 2010
Yep me too have empty Tile Maps Chapter. But.. Loving this book!!!
mike on March 25th, 2010
Thanks for the feedback guys. I’ve got a query in with the publisher about Chapter 9 so that it can be loaded up ASAP. That chapter did go in a little later than the others as I was making some last minute changes, so it looks like its not been opened up yet, but should be very shortly.
@JohnnyB, the rotation of a view is all down to rotating the GL_MODELMATRIX. In SLQ this is done using
// Switch to GL_MODELVIEW so we can now draw our objects
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// Rotate the OpenGL model view to the left 90 degrees so that everything is rendered in landscape
// mode
glTranslatef( 160, 240, 0);
glRotatef(-90, 0, 0, 1);
glTranslatef(-240,-160,0);
This moves to the center of the unrotated screen, rotates it 90 degrees and then translates to the new origin of the screen. As the width and height are now swapped the last translate moves to a different point that the first.
With that done you now just draw as normal. If you wanted to rotate to portrait you would reverse what is shown above and manually work out in your code how to render items now the screen is narrower and taller than in landscape.
Hope that makes sense.
Mike
EricQ on March 26th, 2010
Hi Mike,
Before i buy the book, do you or anyone else feel that this would be fine for someone new to programming? I have a few game ideas i’m dying to make for the iphone but new to programming.
By profession i am a network engineer for a manufacturer of switches, wireless, storage and more so i’m not new to technology just programming. My take is that as i go through your book and follow your instructions and game code, i’ll get a good feel for how to do this and branch off to my own design
thanks,
eric
Simon on March 26th, 2010
I don’t think mike will mind me saying this but if you don’t know any programming then this is not the book for you to start with.
If you’re looking to programm specficly for the iPhone I’d recommend starting with objective-C or C. I used Steve Kochans books to get me started, this made mikes tutorials a hell of a lot easier to understand. His site is classroomm.com Steve also does vids to support his book along with online lessons.
Peter on March 29th, 2010
Hey Mike,
Just wondering why when creating a new map I am unable to use a tile size of less than 32×32? It crashes when the player comes in contact with any tile that is smaller than 32×32. The crash happens on a memcopy either in the image manager or when building the map. Was this done on purpose as some kind of performance tweek?
Thanks
mike on March 29th, 2010
Hi Peter
There is no restriction on the tile size, so tiles smaller that 32×32 should be fine. Do you have any more details on the crash?
Have you changed the tile size entries in the Global.h file? Is you map larger than 200×200 and if so have you changed the Layer class and Global.g files to define the size of map you are using?
Are you maybe trying to render more images to the screen that the maximum configured in the ImageRenderManager?
Not sure if any of those questions will help but its a start :o)
Mike
Peter on March 29th, 2010
Thanks for the quick reply Mike.
I have made the updates to the global.h file, the map size is 100×100. I don’t see any errors in the output window indicating I have exceeded the image limit but I have not amde any changes to the layer class. I am assuming based on your reply that I have obviously missed something there?
Thanks again,
Peter
Peter on March 29th, 2010
Got this figured out. You were right about trying to render more images than was configured in the ImageRenderManager. This begs the question what in your opinion do you think the “absolute” maximum should be for images and textures? Right now I have them at around 800 and 80 but most of the images are 16×16 pixels
Thanks again!
mike on March 29th, 2010
Great question. It really depends on the size of the textures more that the images. The image class is just storing data which doesn’t take up that much space really. The textures are what take up the real space hence using sprite sheets to make the most use of textures is a good idea.
I don’t think there is any problem setting the max images to 2000 to give yourself plenty of headroom. For textures I would leave it at around 20. Unless you have lots and lots of small images you are loading in which case you can just up that value. It’s only increasing the size of an array which uses very little memory.
Hope that helps.
Mike
Peter on March 29th, 2010
Big Help, I actually only have about 3 textures so I can dramatically lower that one :)
Thanks again
Nick on March 31st, 2010
Hi Mike,
Is there any chance that chapter 9 or even the other 2 as well (17 & 18) will be available in Rough Cuts, before the publisher closes for Easter?
JohnnyB on April 3rd, 2010
Hi Mike, I see chapter 9 has been added, thanks! Don’t know if this is the proper place to post this but I have been playing around with the chapter 9 code and was wondering why it seems to be a little choppy. When I run the complete game on the sim or iphone the tiles appear to move around much smoother. Has the tilemap class changed since the chapter 9 example was created?
Thanks again!
John
icubix on April 11th, 2010
Hi Mike,
I found the rough cuts book on Safari a few days ago, and I’ve read up to the end of Chapter 3. It’s really very good so far, and it’s exactly what I’ve been looking for in terms of an iPhone Game Programming book. I’m sure the final product will be great! When’s it coming out in print?
George
Dan on May 11th, 2010
Hi Mike:
Just dived in and bought your book after watching a few of the tutorials (Which are fantastic by the way, just find them to be a bit muddled). I find the book to be as informative and easy to understand as the tutorials and very well structured. Look forward to the final release.
Dan on May 11th, 2010
Hi Mike:
Just dived in and bought your book after watching a few of the tutorials (Which are fantastic by the way, just find them to be a bit muddled). I find the book to be as informative and easy to understand as the tutorials and very well structured. Look forward to the final release.
Now, just a quick question with regards to the service. I originally signed up for the free trial to have a read before purchasing it the next day. I have bought the book and then cancelled my membership. I am, however slightly concerned that I will now not be able to download the future updates and / or final copy of the book from the site. Just wondering if that is the case or not?
Oh, and seeing as I cant now add it to my email subscription lists, please could you update us all if and when a new version is up?
Once again, excellent stuff. So glad I found this website. So much great content on here :)
Cheers.
strohtennis on May 18th, 2010
Hi Mike:
I’m a java teacher that is trying to jump over to writing a game app with the iPhone. I’ve just recently downloaded the latest SDK 3.2.2 and am having compatibility trouble with any tutorials or books that are even a few months old.
I purchased your book yesterday in hopes that it would be compatible. I’m only in Chapter 3 right now but I found one method header that doesn’t match the default in the AppDelegate.m
The applicationDidFinishLaunching now returns a BOOL and has a NSDictionary as a parameter.
Will you be updating the book and source code for the current SDK?
Will the tutorials for the book be available to those that purchased the pdf through Safari Rough Cuts?
Thanks
Will the
mike on May 18th, 2010
Hi Will
The code for the book was tested up to the latest SDK at the time which was 3.1.3. There are some small differences such as the applicationDidFinishLaunching but they should not stop the code working correctly. That should in fact be the only difference between the books code and the current SDK.
The book is currently going through product edit and I will try to get the code updated to match the latest method signature.
I will need to check how the process will work with the publisher, but I am planning on making the tutorials available to those who purchased the rough cuts version of the book.
I hope that helps and let me know if you have any other problems.
Regards
Mike
stahlmanDesign on May 28th, 2010
Mike, are you going to use TBMXL to parse your XML data in your book? In your Tile-map tutorial #6 you used something else and it seemed convoluted to install and use…
Never mind, I just found your post where you said you were indeed going to use TBXML. Excellent.
SpaceAce on July 13th, 2010
Hi Mike,
Just stumbled across this site, the tutorials and the book. Absolutely great job, Mike.
I purchased the rough cuts version right away and are following your tutorials. Your way of explaining things is so excellent!
Please keep up the good work!
Cheers,
SpaceAce





Submerged on March 9th, 2010
Great news! I seem to be getting page not found, however