Looks like I have more than one follower now looking forward to see chapter 3 source port. So I was compelled to write an update at least to show where I am!
Somebody (@Jawzapps:) pointed out that chapter 3 is lot more code than what you see in the book. And was he right! I have been slogging through the code for more than a month. There was no easy way to do incremental coding and build so I decided to go all out and port the entire source code without any concrete build or run phases until the end.
But I had to take another detour, especially into mathematics for graphics. I have always been interested in math (at one point contemplated a doctorate in math) but refreshing math, including vector math, geometry and some basic physics while reading, I would say an almost companion book for Mat Buckland's book, 3D Math Primer for Graphics and Game Development, I found out that there really is a lot of code if you are coding from scratch just to get to SteeringBehaviors class. From scratch would mean coding all the support logic code needed (Vector and Matrix classes and everything else that goes with them).
Not only that, you also need to refresh a number of concepts which you may or may not have studied in your school/college. 3D Math Primer is the book I found that is much better than other math books for graphics in terms of gently introducing many concepts without sounding like a college text book in math. There is actually a second edition out which covers some more physics concepts I believe but I do not know for sure. I am reading the first edition which is still very relevant.
So, I think I have about 70% ported. Most of my problems are with the fact that Mat uses C++ operator overloading and class and template functions a lot. I really feel the need for operator overloading very much in Objective-C for math.
Although, I am not coding for an iOS 5 target for now, most of the Vector and Matrix functions are now part of the GLKit which was introduced in iOS 5. But still knowing the foundations of graphical games is I would say priceless. Maybe I am going in too much detail, trying to understand too much, instead of just whipping out a game in Cocos2d or Corona SDK(provided I can think of a game concept:). But then, thats just not me. I cannot come to Cocos2D until I know how the basics of such frameworks work.
0 comments:
Post a Comment