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”:
KoboldTouch v6.2.2 is now available.
New features are a iOS Storyboard template project and support for Arcade controllers like iCade (all variants), GameDock (2 Players) and compatible controllers.
Storyboard Template
There are plenty of Storyboard + Cocos2D tutorials but none seem to get it quite right. After I wrote my Cocos2D Storyboard tutorial I went in for the kill, made it work with KoboldTouch and a couple improvements along the way, too.
One of the advantages of this Storyboard implementation is that you can return to a previous scene, continuing where you left off. You can of course also change scenes whenever you segue into a KoboldTouch scene. And you can have several KoboldTouch scenes side-by-side and differentiate easily which one was segue’ed into.
Here’s the KoboldTouch Storyboard Documentation which explains how to start a Storyboard project, which classes to use and the things that are different compared to a regular fullscreen KoboldTouch app.
Arcade Controller and Joypad Input
You may have heard of the iCade cabinet (pictured) to play arcade games like in the Arcade with joystick and 8 buttons. Maybe you already own one. And then there’s Kickstarter-backed GameDock, which features two gamepads for 2-Player action and HDMI output to your TV.
Here’s a quick demo of the iCade Core working with the (admittedly barebones) KoboldTouch arcade input controller demo:
iCade and GameDock are fun and exciting devices which already have hundreds of games supporting them! And those aren’t the only ones, there are several other Bluetooth joypad controllers compatible with iCade, like the Snakebyte idroid:con.
KoboldTouch makes it super-easy to use iCade, GameDock and compatible Bluetooth controllers!
There are many Cocos2D + Storyboard tutorials, it’s about time to do another one that’s done right. Also, this one’s backwards: we’ll start with a Cocos2D template and then add Storyboards to it. The tutorial will work for existing Cocos2D projects to which you wish to add Storyboards, too!
I’ll show you how to add Storyboards to a Cocos2D v2.1 project, with ARC enabled of course. This approach will take a little more work, but the solution will be complete and you gain a fair understanding of how things work together. Plus two custom but reusable View and Navigation controller classes, and I’ll show you what changes you need to make to the AppDelegate.
The resulting project will work with iOS 5 and iOS 6 and autorotation. The navigation and cocos view controllers are separated, and you will be able to subclass them for code customizations as is customary in Cocoa. Cool? Cool, cool, cool!
As usual you can grab the example project (Cocos2D + Box2D + Storyboards with ARC enabled) from github. I’ll also be adding a Storyboards template project to KoboldTouch in the next update, and document what’s special about the KoboldTouch solution.
Oh, only one thing … this tutorial is part of Essential Cocos2D. Head on over and enjoy!
KoboldTouch v6.2 marks the third major milestone for KoboldTouch. It also marks the longest development cycle between two updates: exactly 30 days.
That’s 30 days packed with new features, improvements and bugfixes, there’s a new development blog for the work-in-progress “Angry Trains” starterkit and slowly but surely the documentation is coming together.
So let’s check out the exciting new features in KoboldTouch v6.2:
Objective-C Box2D Physics wrapper
The Objective-C wrapper for Box2D (aka “Boxjective2D”) is now in a state that I feel very comfortable with. And proud. It’s the only Box2D Objective-C wrapper that’s both fairly complete and supported and will be continuously improved. It’s also stable, super-slick and easy to use, highly efficient without compromising integrity (ie no @private vars) and you can always access the underlying Box2D objects.
The following Box2D components are wrapped in Objective-C classes, which is about 80% of the public API of Box2D (and I won’t stop there): Continue reading »
KoboldTouch has been on sale for exactly 5 months (released: Nov 1st, 2012). Time for a “numbers post”.
Let’s start with new user signup rates and popular pricing plans before I get to reveal actual and projected revenues.
New User Signup Rate
With a build-up of anticipation, the first month is always noticably on the positive side. If you ignore that first month, you’ll notice that signup rate has been very steady from December through February when it suddenly doubled in March.
This chart shows the number of new users who signed up to any of the pricing plans, with refunds already deducted:
The actual “new user” numbers (not including refunds) for each month are:
- Nov 12: 44
- Dec 12: 15
- Jan 13: 15
- Feb 13: 16
- Mar 13: 33
I believe the reason for the influx of new users in March is two-fold: first I introduced the 1-Month billing plan in Mid-February. And around the same time frame I started hosting the KoboldTouch documentation and KoboldTouch Sales Pitch on www.koboldtouch.com. Continue reading »
In order to write Tiled’s TMX file format I needed to do exactly this: figure out how to compress data, encode it as a string, and write it to XML.
I wrote down what I learned from using zlib, base64 and xswi - XML Stream writer for iOS (a single Objective-C class) while writing KoboldTouch‘s TMX writer.
I split it into two articles in the Essential Cocos2D section of the www.KoboldTouch.com homepage:
- How to compress and encode data with zlib and base64
- How to write XML on iOS with xswi (XML Stream Writer)
I was positively surprised how relatively painless zlib and base64 encoding worked (I expected the worst!) and how simple and effective xswi is for writing XML compared to any other XML library.
I’ll probably continue to add those articles to Essential Cocos2D rather than posting them on this blog. Confluence is just so much more convenient for writing technical documentation than WordPress.
Final word: Enjoy!
I added two additional Plans to KoboldTouch:
- NEW: 1-Month Support & Updates: $19.95
- 3-Months Support & Updates: $39.95 (same as before)
- NEW: 12-Months Support & Updates: $119.95 (4 quarters for the price of 3)
All plans are now non-recurring / not auto-renewing. No more subscription plans.
The 1-Month plan is for trying out KoboldTouch, or getting or updating it cheaply. Lowering the barrier of entry. I want to increase the user base to gather more feedback, requests and suggestions.
The 12-Month plan is for supporters and early adopters who are willing to invest into KoboldTouch while saving money in the long run.
Note: You can continue using and publishing apps built with KoboldTouch even after your support & updates plan has expired.
Learn more about KoboldTouch and sign up.
Target Audience
At this point KoboldTouch isn’t for everyone (yet). I decided to narrow the focus to the type of users I seem to have convinced and the type of users I like to work with and attract more. I summed it up like so:
KoboldTouch is a custom-built game engine for demanding iOS & Mac OS X developers.