Generate Tilemap Physics Collision Shapes with Cocos2D

On June 1, 2013, in idevblogaday, by Steffen Itterheim

Screen Shot 2013-05-31 at 00.59.01 You have a tilemap and you want physics collisions on it? The solution seems obvious: create a rectangle shape for every blocking tile.

But ouch! This solution is not just hugely wasteful and unnecessarily slows down the physics collision code, it also introduces the well known problem of characters getting stuck even on flat surfaces.

This is in particular a problem for Box2D because its collision mechanic doesn’t work well with flat surfaces subdivided into smaller segments (rectangle shapes in this case).

A workable but still very awkward solution to work around this behavior is to create characters with bevelled edges at the character shape’s bottom at the risk of bopping characters as they walk about the map.

Lupines in the Moore Neighborhood

A good solution to generate physics collisions is to implement the Moore Neighborhood algorithm to generate chain shapes which are more suitable for tilemap collisions. The downside is that adding or removing individual blocking tiles at runtime requires updating the shapes - this is not implemented in this project.

Every flat surface, no matter how many tiles form the surface, will then consist of only one straight collision segment. Here’s a quick demo video of the project discussed in this post that shows the algorithm at work and the resulting “game”:

Continue reading »

I wrote iCanSleep after I couldn’t find a tool that matched my requirements.

Both Caffeeine and InsomniaX rubbed me the wrong way - the former does not allow the display to sleep (WTF? Who would want that?) and the latter prevents sleeping altogether (WTF? I can set Energy Saver settings to “Never” myself, thank you).

To be fair: both tools have some merit, just not for me. Specifically InsomniaX has features for MacBook Pro users.

What I wanted was a tool with customizable “no sleep” duration, and not the 5-30 minutes, 1, 2 and 5 hour option of Caffeine, or none as with InsomniaX.

One that

Continue reading »

Tagged with:  

Learn Cocos2D v2.0 Book: It’s done …

On August 7, 2012, in book, cocos2d, Kobold2D, by Steffen Itterheim

… but not quite out yet. If you can’t wait until August 29 you can always buy the Alpha eBook version now (as PDF) and receive the final eBook version for free (as PDF, ePUB and MOBI) when it’s available.

I’ve updated the book’s product page and included links where you can download the source code for the 3rd edition.

Learn cocos2d 2 (Third Edition)

Release Date: August 29, 2012

What’s New

Cocos2D v2.0 is used throughout the book. To my knowledge this makes the Learn Cocos2D 2 book the first book to cover cocos2d-iphone v2.0.

ARC (automatic reference counting) is used exclusively in the book. All descriptions and source code projects have been updated to ARC, and 12 Cocos2D ARC-enabled Template Projects are included in the source code download. The book contains a description on how to enable ARC in a cocos2d project. Working with ARC means having to write and learn less code while being able to write faster code with fewer bugs. Win, win, win.

You can now also follow the book while using Kobold2D. Any differences between cocos2d v2.0 and Kobold2D v2.0 are explicitly mentioned in the book. In fact, you’ll have to work through less text and code if you use Kobold2D.

The book’s source code is compatible with Xcode 4.4, Mac OS X 10.8 Mountain Lion and iOS 6. It is of course also tested to work with Xcode 4.3, Mac OS X 10.7 Lion and iOS 5.

Learn more about the Learn Cocos2D 2 book here.

Tagged with:  

The Starting Point for a Train Game with Freeform Tracks

On July 12, 2012, in idevblogaday, by Steffen Itterheim

If you ever wanted to build your own 2D top-down view train driving game, here’s … well, the things you need to consider plus a rudimentary source code example. Because a train following tracks is not as simple as it might seem, unless you restrict curves and switches to 90° angles and allow only very short cars and locomotives.

Here’s a video of my example project. Any stuttering is due to the screen recording software taking a toll on my system combined with the video playback framerate not rendering 60 fps (I assume it’s the standard 24 or 30 fps for Youtube videos). The video shows a sequence of three runs with a medium curve radius, a large curve radius and a ridiculously small curve radius. The yellow line indicates the track being followed by the axles, the purple line indicates the car chassis position (center point between axles).

Continue reading »

Here’s a crazy thought: with commercial game kits (game source code products) being popular and financially rewarding – why not crowd-fund an iOS game by selling it’s source code, resources and development insights while you’re creating it?

Marcus and I will give this idea a spin. Marcus is a game designer I worked with at Electronic Arts Phenomic for 6 years. I’m sure you know me. Together we’re going to create a tilemap-based physics game using cocos2d and KoboldScript (Lua scripting for cocos2d). And we are going to sell everything we’ll create practically from day one.

If that sounds even slightly intruiging to you, we’d love to get your feedback!

Visit the launch page and take our survey which has already helped us tremendously to focus on what’s important for you. For example I’ve converted the entire KoboldScript library to use ARC seeing how important ARC is to you.

But do keep on reading for more details …

Continue reading »

Affiliate Store Opened

On November 13, 2011, in Announcements, by Steffen Itterheim

I opened an Affiliate Store page to be able to promote and sell other developer’s products.

Recently I decided to write one big post every other week (bi-weekly on Thursdays) as my iDevBlogADay post. I also wanted to create something exceptional each time. In particular the Compiler Directives list worked great. It bothered me that there was no such list. And apparently I wasn’t the only one looking for that.

That made me start regarding the iDevBlogADay posts essentially as paid writing jobs. Regardless of how little that payment may be, it is adding to my bottom line and it is a welcome additional incentive to put my best efforts into it.

Continue reading »

Tagged with:  

Affiliate Products

On November 10, 2011, in , by Steffen Itterheim

I did not create the following products. But I help sell them through ads and affiliate links because they’re high quality and highly recommended. I get a commission for each sale made through these links, which in turn helps me spend more time on this website and on Kobold2D.

Paralaxer Platformer Game Kit

Paralaxer runs on iOS, Android, Windows, & Mac using the same C++ game code. Thanks to the ultra-awesome, open-source Cocos2D-X game engine, Paralaxer is a cross-platform platformer.

      

The iPhone RPG Engine

Rapidly create your own RPG or action-adventure game with this complete starter kit. Includes an ebook, game source code and a royalty-free art package.

Commander Cool Game Kit

This starter kit includes the complete source code of “Commander Cool” for iPhone / iPad / Mac build with Cocos2d & Box2d, extensive code documentation and video documentation (accessible online or offline) covering every beginning step to modifying the app for yourself.

      

Angry Ninjas Starter Kit

Ride the wave of success that sling shot games are seeing in the App Store and create your own popular game. All thats required is a bit of time on your part to build some fantastic levels and add your own artistic twist. We’ve done the hard part. Now you get to do the fun part!

Visit the Ray Wenderlich Store!


Learn about the APIs that were introduced in iOS 6 like Auto Layout, Collection Views, and Passbook. Over 1,500 pages of high quality content!

Also check out Sprite Kit by Tutorials!


The Starter Kit Bundle: Full Cocos2D source code and tutorials for creating a side-scrolling space shooter game, a platformer game and a beat ’em up game for iPhone and iPad!
Ray Wenderlich and his team provide awesome iOS Tutorials and excellent Starter Kit source code.

TexturePacker

Create sprite sheets and optimize images for your Cocos2D, Kobold2D, Corona and other game engine projects.

      

PhysicsEditor

Edit collision shapes for Box2D and Chipmunk based physics games. Supports Cocos2D, Kobold2D, Corona, and other game engines.

Learn Cocos2D 2nd Edition: What’s New & Release Date

On September 30, 2011, in book, cocos2d, Kobold2D, by Steffen Itterheim

Scheduled for release on November 7th, 2011.

Continue reading »

Page 1 of 41234