Kobold2D v1.0 Preview 5 released!

On October 12, 2011, in Announcements, cocos2d, Kobold2D, by Steffen Itterheim

To put it in Apple’s words: “Taking Cocos2D to a whole new level.” I can’t brag with 200+ new features though I have a few in store that should make a big bang for no bucks! 😀

So, here speaketh the market crier for Kobold2D. What’s new and noteworthy about this version of Kobold2D, you ask?

Built-In Gesture Recognition

Recognizing gestures has never been this easy. No (speak: zero) iOS SDK knowledge required! All gesture recognizers provided by the iOS SDK are implemented:
Tap, Double-Tap, Long-Press, Swipe, Pan, Rotation and Pinch.

Continue reading »

Kobold2D Preview 4 now available!

On September 28, 2011, in cocos2d, Kobold2D, by Steffen Itterheim

Without further ado:

Download Kobold2D Preview 4

Enjoy it!

The Most Important Changes & Additions:

Continue reading »

Kobold2D: Polling User Input with KKInput

On September 15, 2011, in cocos2d, Kobold2D, Programming, by Steffen Itterheim

Kobold2D is about solving annoying, recurring problems, or simply making all things Cocos2D more convenient. The new KKInput class does both! (*)

Continue reading »

Linkvent Calendar, Day 17: Controls & Usability

On December 17, 2010, in Cocos2D Linkvent Calendar, by Steffen Itterheim

Nikita Gazarov is the developer of Chopper Defense HD for iPad, a fast-paced Tower Defense meets Arcade game … type of game. Hard to describe, better see for yourself:

For the Linkvent Calendar he wrote two articles about gameplay usability. In his first post Virtual Controls Usability he describes the dual-stick implementation he used in Chopper Defense, and what the problems and solutions to that were. In his second post he goes into detail about The Sins of Accelerometer Controls, as experienced in games like Fly Effect Real 3D while Tilt to Live does almost everything correctly.

Accelerometer in Simulator

On October 21, 2010, in Programming, tools, by Steffen Itterheim

AccSim written by Otto Chrons is an App (download on iTunes) that allows you to control your game running in the Simulator with your iOS device. Meaning, the game plays in the Simulator but accelerometer input is actually coming from your device! You can learn more about it on the Built.By.Me website, which includes a sample video:

Hmmm … somehow this game seems strangely familiar. 😀

AccSim doesn’t pack the same punch as iSimulate does, which can also be used for sending multi-touch input, GPS and Compass events to the Simulator, plus a lot more. But the good thing about AccSim is that it’s not just free but the AccSim source code is open source!

Tagged with:  

cocos2d Book, Chapter 5: Getting bigger and better

On July 23, 2010, in Announcements, book, by Steffen Itterheim

Chapter 5 - Getting bigger and better

The gist of this chapter will be to discuss the simple game project from the previous chapter. I threw everything into one class, clearly not what you want to do for bigger games. But getting from one-class to real code design is a big step which some hesitate to take. I’ll make that easier and discuss common issues and their solutions, such as what to seperate, what to subclass from and how you can have all the seperated objects communicate with each other and exchange information in various ways.

A big topic will of course be how to take advantage of cocos2d’s scene hierarchy and which pitfalls it may have when moving from a single-layer game to one which has multiple layers and even multiple scenes.

As for the chapter title I’m not so sure if that’ll be it. Maybe along the way while I’m writing I’ll change it. Suggestions welcome!

The chapter will be submitted on Friday, July 30th.

What’s your take on good cocos2d code structure?

Did you ever struggle with cocos2d design concepts? Or the cocos2d scene hierarchy? Or how to layout a scene and divide your game into logical parts? Tell me about it.

I know theses questions are somewhat generic to ask. It’s about the things that don’t feel right but there doesn’t seem to be a better, more obvious way. I think we all know some of those, if you do, be sure to tell me! Leave a comment or write me an email.

Summary of working on Chapter 4 - First simple game

The game I chose to make is called Doodle Drop and features dropping spiders and an accelerometer controlled alien trying to avoid the spiders. All in all it got divided into 8 concrete steps. Lots and lots of code comments, too.

It starts simple enough, adding resources to Xcode and adding sprites. It gets more gameplay-esque when the accelerometer-driven player controls got tweaked to provide acceleration and deceleration of the player object. In contrast, the spiders movements are driven only by actions.

I introduce you to two undocumented features of cocos2d, namely CCArray which is since v0.99.4 used to store all children of a node. The other are the CGPointExtension class which has all the functions normally provided by a physics engine, however not every game should link a physics engine just because one needs those math functions. That’s why CGPointExtension comes in handy.

With the ccpDistance method the collision checks are done. Simple radial collisions, and in debug mode the collision radii are drawn too.

In between the CCLabel for the score got replaced with a CCBitmapFontAtlas, because it killed the framerate. I shortly mentioned Hiero and how to use it in principle but for all the details there was no room. But while I was at it I created the Hiero Tutorial.

At the end of the project I added some polish which isn’t described in the book (too many details) but really adds to the game’s look and feel. The spiders drop, hang in there, then charge before dropping down, all done using actions. I’ve also added the thread they’re hanging from using ccDrawLine. And then there’s a game over label which shows even more action use.

One of the principles I followed is to stay away from fixed coordinates as much as possible. So the project, once finished, did run just fine on an iPad. Although the experience is a different one, there’s more spiders dropping and they drop faster but there’s also more safe space to maneuver to.

Oh and, the game art is all mine. Yes, I know … but Man-Spiders do have just six legs! :)

cocos2d Book, Chapter 4: First Simple Game

On July 17, 2010, in Announcements, book, cocos2d, by Steffen Itterheim

Chapter 4 - First Simple Game

After Chapter 3 covered the fundamentals of the cocos2d game engine, this chapter will put to use what you’ve learned. The simple game is all about droping enemies that you have to avoid via accelerometer controls. Sort of like an inverse Doodle Jump. But it’s not just about the gameplay itself, I want the game to be reasonably complete with a main menu, scene transitions, game over and of course audio.

The chapter will be submitted on Friday, July 23rd.

Do you have any suggestions for the game?

What do you think should be in a first cocos2d game? Let me know!

Summary of working on Chapter 3 - Essentials

When I started the chapter I wasn’t really sure about its focus and progress was a little slow. Eventually it clicked and I found myself ending up having written more pages than needed and still having a great number of things left untold. The key was looking at the cocos2d API reference documentation and remembering what it was like when I was a beginner. Sure, every class, method and property is there but for a beginning cocos2d developer the API reference is just a huge list of names. In other words, if your experience was or is anything like mine was, it’s frustrating to work with the API reference.

I ended up writing about the cocos2d engine design and its scene graph first, the remaining 80% of the chapter explain in detail with lots of code samples how to use those darn CCNode classes. All the important ones are covered: CCNode, CCScene, CCLayer, CCSprite, CCLabel, CCMenu, CCMenuItem* as well as the Director, Transitions and Actions. Besides the code samples and how-to I’ve added numerous caveats, common mistakes, best practices and other nodes which are so very much needed to make any documentation complete.

For example, how Layers are best used for grouping other nodes together and of course how to enable touch and accelerometer input by adding the required functions which aren’t mentioned in the API reference since they are part of the iPhone SDK API. There’s also some weird recommendation floating around not to use too many Layers because they’re slow. I can’t find the source but what I did find was that this is only true if the Layers enable touch or accelerometer input, because that’s what costs a lot of performance. So what you don’t want to have is several layers accepting input, otherwise use as many Layers as you need - which shouldn’t be many anyway. And if you do need multiple Layers accepting input, why not just use one master Layer (possibly using a Targeted Touch handler) which forwards the input events appropriately to the other Layers?