Trigonometry for Game Programming: Part 1/2

Discussion of the official tutorials published on raywenderlich.com. Please only discuss the official tutorials here - for general questions, use the General Discussion forum instead.

Trigonometry for Game Programming: Part 1/2

Postby rwenderlich » Wed Apr 24, 2013 11:00 am

This is the official thread to discuss the following blog post: Trigonometry for Game Programming: Part 1/2
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ray Wenderlich
Blog: http://www.raywenderlich.com
Twitter: http://twitter.com/rwenderlich
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
User avatar
rwenderlich
Team Member
Site Admin
 
Posts: 2248
Joined: Thu Dec 23, 2010 4:14 pm
Has thanked: 28 times
Been thanked: 373 times

Re: Trigonometry for Game Programming: Part 1/2

Postby Hannu » Wed Apr 24, 2013 6:14 pm

You guys keep surprising me and it is just amazing what kind of high quality stuff you release :o :shock:

Awesome work! Will have a read trough over the weekend, just skimmed it now, and found it very enlighting
Hannu
Uber Haxx0r
 
Posts: 58
Joined: Sat Jul 16, 2011 12:39 pm
Has thanked: 5 times
Been thanked: 0 time

Re: Trigonometry for Game Programming: Part 1/2

Postby Orochi_X » Wed Apr 24, 2013 6:50 pm

Thank you for this tutorial. It was a very interesting read and actually proved to be an inspiration to a problem I was facing in a current project!

Thanks again!
Orochi_X
Uber Haxx0r
 
Posts: 54
Joined: Sat Jul 02, 2011 1:14 pm
Location: Kidderminster, United Kingdom
Has thanked: 0 time
Been thanked: 1 time

Re: Trigonometry for Game Programming: Part 1/2

Postby aeberbach » Thu Apr 25, 2013 12:13 am

The ability of modern hardware to handle this kind of thing really surprised me. Coming from a background of doing browser software on mobile devices, where OEMs would refuse to allow any floating point code and even decoding animated GIFs was a major optimization hurdle, I set about my first game project - which was moving units around a map following a path traced by a finger, like Flight Control - with the expectation that no floats or trigonometry could be used. I started doing things with approximated integers and lookup tables for sin and cos functions like I used to.

I was amazed when I tried an experiment and couldn't detect any slowdown at all, not with way more units and paths than I ever expected to need. The power in our pockets...
User avatar
aeberbach
Team Member
Forum Subject Matter Expert
 
Posts: 1407
Joined: Sat Feb 19, 2011 5:37 am
Has thanked: 13 times
Been thanked: 192 times

Re: Trigonometry for Game Programming: Part 1/2

Postby Hollance » Thu Apr 25, 2013 7:42 am

aeberbach wrote:The ability of modern hardware to handle this kind of thing really surprised me. Coming from a background of doing browser software on mobile devices, where OEMs would refuse to allow any floating point code...

Interestingly enough, even OpenGL ES 2.0 has support for devices that cannot do floating point. On the iPhone, however, using fixed point instead of floating point is a lot slower.
Like card games? Play my new game Mahjong Cards for iPad.
User avatar
Hollance
Team Member
iOS Tutorial Team Member
 
Posts: 5208
Joined: Wed Mar 09, 2011 8:33 pm
Location: The Netherlands
Has thanked: 0 time
Been thanked: 813 times

Re: Trigonometry for Game Programming: Part 1/2

Postby wags » Thu Apr 25, 2013 6:34 pm

Hi Matthijs!
I'm not sure what I'm doing wrong but I can't even complete the "convert to ARC" step of the tutorial. I realize I could skip ahead and use your sample project but I was hoping to build it from scratch. I'm using Xcode version 4.6.2 and the latest Cocos2d (2.1-rc1). I was able to build and run the basic "game" without any issue. When I attempt to refactor for ARC, I get 21 errors and 8 warnings. It says I have to fix all ARC readiness issues and try again. Is there a simple fix for this? Thanks!
wags
n00b
 
Posts: 3
Joined: Tue Mar 26, 2013 2:35 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Trigonometry for Game Programming: Part 1/2

Postby wags » Thu Apr 25, 2013 7:21 pm

In case anyone else is having trouble with the ARC conversion, the beginning steps of the guide here seem to clear things up.
http://www.raywenderlich.com/23854/arc-and-cocos2d-v2-x
wags
n00b
 
Posts: 3
Joined: Tue Mar 26, 2013 2:35 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Trigonometry for Game Programming: Part 1/2

Postby Hollance » Fri Apr 26, 2013 7:54 am

wags wrote:When I attempt to refactor for ARC, I get 21 errors and 8 warnings. It says I have to fix all ARC readiness issues and try again. Is there a simple fix for this? Thanks!

Are you trying to convert the entire project? You're only supposed to convert main.m, AppDelegate.m, HelloWorldLayer.m and IntroLayer.m.
Like card games? Play my new game Mahjong Cards for iPad.
User avatar
Hollance
Team Member
iOS Tutorial Team Member
 
Posts: 5208
Joined: Wed Mar 09, 2011 8:33 pm
Location: The Netherlands
Has thanked: 0 time
Been thanked: 813 times

Re: Trigonometry for Game Programming: Part 1/2

Postby wags » Fri Apr 26, 2013 2:24 pm

Hollance wrote:
wags wrote:When I attempt to refactor for ARC, I get 21 errors and 8 warnings. It says I have to fix all ARC readiness issues and try again. Is there a simple fix for this? Thanks!

Are you trying to convert the entire project? You're only supposed to convert main.m, AppDelegate.m, HelloWorldLayer.m and IntroLayer.m.


Yes, I believe I was. Perhaps I'm using the "refactor" option incorrectly. I thought that it always affected the entire project.
wags
n00b
 
Posts: 3
Joined: Tue Mar 26, 2013 2:35 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Trigonometry for Game Programming: Part 1/2

Postby Hollance » Fri Apr 26, 2013 2:36 pm

wags wrote:Perhaps I'm using the "refactor" option incorrectly. I thought that it always affected the entire project.

It does. It converts the entire project to ARC. However, for the files you do not select, it adds a compiler option that tells the compiler not to use ARC for these files. That's what you want to have happen for the files from Cocos2D. So even though the project is now ARC, the files from Cocos2D are treated as an exception and are compiled with ARC disabled. :-)
Like card games? Play my new game Mahjong Cards for iPad.
User avatar
Hollance
Team Member
iOS Tutorial Team Member
 
Posts: 5208
Joined: Wed Mar 09, 2011 8:33 pm
Location: The Netherlands
Has thanked: 0 time
Been thanked: 813 times

Next

Return to Official Tutorials

Who is online

Users browsing this forum: Baidu [Spider] and 10 guests