From Dogfooding to Catfooding

On September 22, 2011, in idevblogaday, Kobold2D, by Steffen Itterheim

Most developers have heard of the phrase “Eat your own dog food”. It refers to the habit of actually using what you’re creating.

A typical example would be a company building Yet-Another-Issue-Tracking-Tool™ while using said issue tracker to manage their Yet-Another-Issue-Tracking-Tool™ project. And you’ll surely have heard of a game engine that was initially only developed as a necessity to build a game, then polished and released to the public to great success, while the developer continued to create games with his own engine.

Dogfooding is considered a good practice, actually a best practice. You know that the tool you’re building works, and that it satisfies your needs.

But “your needs” is also the achilles heel of dogfooding, and it’s just a small step away from forever “perfecting” your product (known as “gold plating”). So sooner or later, you’ll have to do some catfooding, too. Meaning: to feed the user’s needs.

Continue reading »

Cocos2D Podcast: Earn Additional Revenue

On June 21, 2011, in cocos2d, podcast, by Steffen Itterheim

The latest episode of the Cocos2D Podcast is out!

This time Azam and I talk about the options you have to earn additional revenue from or with your apps, using iAd ads, In-App Purchases, selling your source code and other ideas.

Cocos2D Podcast: Earning Additional Revenue

Cocos2D Podcast on iTunes

You might also want to read my blog post How to make over $18,000 in six months selling source code about the financial success of my Line-Drawing Starterkit. By the way, I’ll be releasing a new game kit in autumn. More details in the coming weeks.

Tagged with:  

Cocos2D Sources: Zynga Copyright Added

On May 28, 2011, in Games, by Steffen Itterheim

As @GeekAndDad pointed out on Twitter the majority of the cocos2d source code has been updated with a Zynga Copyright. This is in reference to two commits (1) (2) on github in the develop branch of cocos2d-iphone.

The MIT License header now begins with:

* cocos2d for iPhone: http://www.cocos2d-iphone.org
*
* Copyright (c) 2008-2010 Ricardo Quesada
* Copyright (c) 2011 Zynga Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the “Software”), to deal
* […]

Meaning?

This just means that changes made in 2011 to the cocos2d source code are copyright by Zynga. Which is to be expected, now that Ricardo is an employee of Zynga.

It doesn’t change anything regarding the MIT license. And it doesn’t imply a transfer of copyright. In fact, since Ricardo is still listed as copyright owner for the years 2008-2010 it is suggesting that there was no transfer of copyright.

Also note that some of the source code in the cocos2d-iphone project is copyright by other developers or companies, whose copyright has not been changed. This includes classes like CCActionEase, CCActionGrid, CCActionPageTurn3D, CCBlockSupport, CCGrabber, CCMotionStreak, CCTexture2D - just to name a few.

Learn Cocos2D Book Source Code Update

On May 26, 2011, in book, cocos2d, by Steffen Itterheim

The most frequent questions I get from readers of my Learn Cocos2D book:

  • “Where can I download the source code?”
  • “Why do I get compile errors in CCLabel?”
  • “Is there an updated version of CCAnimationHelper?”

They all boil down to the fact that the book was written against cocos2d-iphone v0.99.5 with some projects using v0.99.4 and a few even had used v0.99.3.

Unfortunately this is also why some readers deducted one or more stars in their Amazon book reviews. Even more unfortunate because the changes that break the code were entirely cosmetic (renamed classes, function parameters removed or re-ordered, deprecated functions in favor of others). All changes required only fixing the lines using one of these outdated classes (CCLabel, CCLayerColor) or functions (bitmapFontAtlasWithString, frameWithTexture, …).

Quick List of Changes

I kept track of the changes I made to the source code. This is what it boils down to:

  • remove: EAGLView viewWith… -> remove last parameter: preserveBackBuffer:NO
  • remove: CCSpriteFrame: frameWithTexture -> remove last parameter: offset:CGPointZero
  • remove: CCAnimation: animationWithName -> animationWithFrames & remove last parameter: frames
  • rename: CCLabel -> CCLabelTTF
  • rename: CCBitmapFontAtlas -> CCLabelBMFont
  • rename: CCBitmapFontAtlas: bitmapFontAtlasWithString -> labelWithString
  • rename: CCXxxxxTransition -> CCTransitionXxxxx
  • rename: CCColorLayer -> CCLayerColor
  • rename: CCQuadParticleSystem -> CCParticleSystemQuad
  • rename: particle system: centerOfGravity -> sourcePosition
  • change: particle system: use NSUInteger instead of int for initWithParticleCount

These are the changes affecting the book’s source code. There were some more changes in the cocos2d-iphone engine, for example some actions have been renamed as well.

Good News: Updated Source Code for v1.0

I updated the book’s source code to use cocos2d-iphone v1.0.0 rc2. Once the v1.0 final is released I’ll make another update.

You can get the book’s source code from the Learn Cocos2D Book product page (scroll to the bottom), or via this direct download link. The download is about 100 MB and contains all the chapter’s source code plus some extra projects not mentioned in the book, and all of them (over 70!) are now using cocos2d-iphone v1.0.

Note: This code obviously differs slightly from the code described in the first edition of the Learn Cocos2D book, so you should get the unmodified v0.99.x book source code as well.

Upgrading to Cocos2D v1.0

I also recently wrote a tutorial outlining the steps to update an existing cocos2d-iphone v0.99.x project to v1.0 in case you have an existing project that you’d like to upgrade to the latest Cocos2D version.

Learn Cocos2D: Second Edition

All these changes will be reflected in the second edition of the Learn Cocos2D book.

The second edition will be released summer 2011, likely around July to August. This is my estimate based on the fact that my work is scheduled to be completed on June 27th, and I’m working hard to keep that (tight) schedule.

Actually, make that we are working hard. The second edition of the Learn Cocos2D book will have contributions from a co-author. Someone who is well-known in the Cocos2D community! To be unveiled. :)

Book: Learn Cocos2D 2

On May 26, 2011, in , by Steffen Itterheim

Learn Cocos2D 2 (Third Edition)

Release Date: August 29, 2012

Explains both Cocos2D 2.0 and Kobold2D v2.0 side-by-side. All source code projects and descriptions have been updated to fully utilize ARC (automatic reference counting). ARC makes learning Cocos2D even easier and results in faster code with fewer bugs.

Also explains TexturePacker, PhysicsEditor, Tiled, Glyph Designer, Particle Designer and other tools. Source code is compatible with Xcode 4.4, iOS 6 and Mountain Lion (Mac OS X 10.8).

Download Source Code (3rd Edition):

Cocos2D Source Code (ARC) (Cocos2D v2.0; includes 12 Cocos2D ARC templates)
Kobold2D Source Code (ARC) (Kobold2D v2.0; uses Cocos2D v2.0)
Download Kobold2D and install it to get the Kobold2D & Cocos2D Xcode documentation.

Exact game engine versions used by the book:
Download cocos2d-iphone v2.0 and/or download Kobold2D v2.0.4


Second Edition

Release Date: November 9, 2011

Explains Cocos2D v1.0, introduces Cocos3D and Kobold2D. Also explains TexturePacker, PhysicsEditor, Tiled and other tools. Source code is compatible with Xcode 4 and iOS 5.

Download Source Code (2nd Edition):
Source Code (Cocos2D v1.0.1)
Download Kobold2D

First Edition

Release Date: December 2, 2010


Explains Cocos2D v0.99. Source Code is compatible with Xcode 3 and iOS 4. Explains tools like Zwoptex, VertexHelper, Hiero, Tiled and others.

Download Source Code (1st Edition):
Original Source Code (Cocos2D 0.99.x)
Updated Source Code (Cocos2D v1.0.1)


Full Description

Create compelling 2D games with Learn cocos2d 2: Game Development with iOS. This book shows you how to use the powerful new cocos2d, version 2 game engine to develop games for iPhone and iPad with tilemaps, virtual joypads, Game Center, and more. It teaches you:

  • The process and best practices of mobile game development, including sprite batching, texture atlases, parallax scrolling, touch and accelerometer input.
  • How to enhance your games using the Box2D and Chipmunk physics engines and other cocos2d-related tools and libraries.
  • How to add UIKit views to cocos2d and how to add cocos2d to UIKit apps.
  • The ins and outs of the Kobold2D development environment for cocos2d and its pre-configured libraries, including Lua.
  • Best of all, this book will have you making games right from the very start. It guides you step-by-step through the creation of sample games. These fun examples are modeled after popular App Store games and teach you key concepts of the new cocos2d 2 game engine and relevant tools like TexturePacker (texture atlas), PhysicsEditor (physics collision shapes), Particle Designer (particle effects), Glyph Designer (bitmap fonts), and others.

This book offers a rock-solid introduction to creating games made entirely with cocos2d and little or no iOS SDK and OpenGL code. It also details alternative implementations, identifies the best free and commercial tools for cocos2d game development, features coverage of the author’s improved cocos2d game engine (Kobold2D), and even helps you enhance your game’s marketability on the App Store.

Who this book is for

The book is aimed at beginning game developers looking for an easier and even more powerful way to create compelling 2D graphics using OpenGL and Objective-C. It is assumed that the reader will have some knowledge of object-oriented programming and the Apple and iPhone/iPad developer environment.

Learn Cocos2D Book Reviews

Tagged with:  

Game Kit Data Send/Receive Demo Project

On January 22, 2011, in cocos2d, Programming, by Steffen Itterheim

An ongoing discussion about how to correctly send/receive data with Game Kit on Cocos2D Central prompted me to write a demo project to complement the Learn Cocos2D book’s Game Center chapter. The resulting working code is in this post, and also reprinted below.

The Game Kit Data Send/Receive Demo Project (download here) is based on the Learn Cocos2D book code made for the Game Center Chapter. It’s called Tilemap16 just to stay in line with the naming scheme.

You control the little Ninja as usual, but this time anytime you move it, it will also move on all other connected devices because the tile coordinate is sent via Game Kit to all connected players but only when it actually changes. The demo even allows you to move the Ninja on any device, and all others will follow, so it truly works in every direction. In addition, a score variable (int) is transmitted every frame just to show how to send different types of data at different times.

I wish I could have made a movie to show how cool this is but alas, my iPod was busy running the demo, so all I can show as proof is my iPod and iPad running the game with both Ninjas at the same position (mushy image made with my already-ancient iPhone 3G under perfect programming but terrible lighting conditions):

Source Code Example

In summary this is the code that’s used to send/receive data with the help of the GameKitHelper class I wrote for the book (also included in the download and free to use for anyone and any purpose):

[cc lang=”ObjC”]// add this to the header
typedef enum
{
kPacketTypePoint,
} EPacketTypes;

typedef struct
{
EPacketTypes type;
} SPacketInfo;

typedef struct
{
EPacketTypes type;

CGPoint point;
} SPointPacket;
[/cc]

Sending a packet:

[cc lang=”ObjC”]
-(BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
CGPoint location = [touch locationInView: [touch view]];

SPointPacket packet;
packet.type = kPacketTypePoint;
packet.point = location;

gkHelper = [GameKitHelper sharedGameKitHelper];
[gkHelper sendDataToAllPlayers:&packet length:sizeof(packet)];
}
[/cc]

Receiving the packet:
[cc lang=”ObjC”]
-(void) onReceivedData:(NSData*)data fromPlayer:(NSString*)playerID
{
// first, assume it’s the general SPacketInfo, that way we can access type
SPacketInfo* packet = (SPacketInfo*)[data bytes];

switch (packet->type)
{
case kPacketTypePoint:
{
SPointPacket* pointPacket = (SPointPacket*)packet;
CCLOG(@”received point: %.1f, %.1f”, pointPacket->point.x, pointPacket->point.y);
break;
}

default:
CCLOG(@”received unknown packet type %i”, packet->type);
break;
}
}
[/cc]

Requirements & Setup

You need:
- 2 devices which are Game Center capable, eg they must have the Game Center App installed. If it isn’t, that device is not ready for Game Center. 1st & 2nd Generation devices up to iPhone 3G do not support Game Center. In addition Simulator will not work due to Matchmaking/Invites not being supported on the Simulator.
- 2 Game Center accounts (you can create dummy accounts via the Game Center App)

What you have to do:
- Create a new App on iTunes Connect, enable Game Center for that App, and replace the Bundle ID of your App with the one in the project’s info.plist. Please refer to the Game Center section in the iTunes Connect documentation.
- Make sure Push Notifications are enabled on all devices via Settings App.
- Run the Game Center App on both devices, login and make sure each device is logged in with a unique account. Then invite the other device’s account as friend and accept the friend request, this makes it easier to join each other’s matches.
- Build the Tilemap16 App and deploy it to both devices. Whenever you make a change to the code, you must deploy the App to both devices again, to make sure they run the same code.
- Run the App on one device, wait for the matchmaking screen to appear. Invite your other device’s friend account to join the match.
- Wait on the other device for the match invite to pop up. Tap Accept. The Tilemap16 game will launch.
- Tap Play Now on the first device once the other player has successfully connected and is ready.
- Move the Ninja on either device and watch it move on the other.

Enjoy!

I almost forgot about the Cocos2D-Project on github. While it works flawlessly with the latest v0.99.5 stable release of Cocos2D, it was still bundled with only the RC1 (release candidate). So I’ve updated the cocos2d version in the repository.

In case you don’t know what Cocos2D-Project is:

Cocos2D-Project is a great way to start any Cocos2D-iPhone based project.

It eases up- and downgrading the Cocos2D game engine at any time. It includes additional source code as well as multiple targets and build configurations for Ad Hoc & App Store distribution (creates the necessary IPA/ZIP files) and debugging of memory leaks and related issues.

Cocos2D-Project is free, open-source, uses the MIT License and comes already bundled with the cocos2d-iphone version that it currently works with “out of the box”.

It’s not affiliated with or endorsed by cocos2d-iphone.org and Ricardo Quesada. You will get support for Cocos2D-Project on Cocos2D Central.

Future updates

With the help of others, the Cocos2D-Project development has taken on a life of its own. The current work in progress is much more than a simple Xcode project referencing just the Cocos2D game engine. I’m looking forward to announce a big update in a couple weeks. Stay tuned.

Tagged with:  

You may remember
from 6th of December,
when I did promote
the BATAK Duel source-code.

Ok, ok, I hear you … enough of the rhymes. :)

Dan Nelson has informed me that he is in the Xmas spirit for whatever reason (weird, right?), and that means for you that the price of the BATAK Duel source code is now reduced to $197 (down from $297, about 33% off). From what Dan told me sales are going good for him, so congratulations to the well-deserved success!

BATAK Duel is available on the App Store for $.99 and this trailer should give you an impression of what this game is about (no, not cheesy voice-overs, don’t let the first impression fool you):

Tagged with:  
Page 2 of 41234