Sprite Kit, Box2D, Performance and LiveCode's Approach to Game Coding

Mark Wilcox m_p_wilcox at yahoo.co.uk
Wed Aug 21 08:54:56 EDT 2013


Box2d is definitely fun to play with but it's really only good for games that inherently need physics simulation - Angry Birds is a good example. (BTW, box2d is also the physics engine in Sprite Kit, which is basically Apple's cocos2d Lite - since the cocos2d developers started focussing on the cross-platform C++ cocos2d-x rather than the Apple only Objective-C original.)

Here's a recent article on why you don't want to use a physics engine for a lot of 2D games:
http://www.learn-cocos2d.com/2013/08/physics-engine-platformer-terrible-idea/


I've personally been having lots of similar issues with Unity3D building some micro-games recently. The games involve some "magic" and thus objects that don't obey physics. Their interaction with objects that do obey physics needs quite a lot of tweaking. Also physics simulation at high performance on a mobile device is quite CPU intensive, so they turn down the accuracy (this is much more of a problem in 3D than 2D) - that results in lots of tweaks just to avoid simple things like falling objects going straight through the floor! All in all I think it's debatable whether I'd have saved time simply ignoring the physics engine and coding my own limited physics for the little parts of it I needed. You get a lot working quickly by plugging into the physics engine but it then takes ages to polish it to an acceptable quality.

I few years ago I ported a successful side scrolling platform game from iOS (cocos2d) to Qt. It did all of its own physics for gravity and collisions and that probably added up to significantly less than 100 lines of code - all very simple maths and not optimised. That still ran comfortably at 60fps on the early iPhones and iPod Touches.

I'm not saying box2d isn't a good thing to have for LiveCode, I'm just suggesting we shouldn't expect it to turn the platform into a gaming powerhouse. :)

Mark


________________________________
 From: John Craig <john at splash21.com>
To: use-livecode at lists.runrev.com 
Sent: Wednesday, 21 August 2013, 12:26
Subject: Re: Sprite Kit, Box2D, Performance and LiveCode's Approach to Game Coding
 

I'm also interested in creating games with LiveCode and looking forward 
to box2d integration.  I've been checking out Corona and (more recently) 
- Unity (3D), to familiarize myself with physics stuff.  It makes a 
massive difference having a physics engine taking care of collisions, 
gravity, etc.  I assume that box2d performance with LiveCode will be on 
a par with other platforms using the same engine, so it will really open 
up a lot of possibilities :D

The following Unity demo only required a couple of hundred lines of 
code, since all the physics was taken care of, so I'm really looking 
forward to seeing what LiveCode is capable of in the coming months.
http://youtu.be/XuA5xbsdx_M

Since Unity has a web player, you can have a play around with the demo here;
http://splash21.com/Buggy/


More information about the use-livecode mailing list