Destructive Terrain (worms, tanks etc..)

Official forum for the Chipmunk2D Physics Library.
Post Reply
jastanton
Posts: 1
Joined: Wed Jan 25, 2012 4:42 pm
Contact:

Destructive Terrain (worms, tanks etc..)

Post by jastanton »

How would I go about making destructive terrain using Chipmunk (or anything)? e.g.
Image
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Destructive Terrain (worms, tanks etc..)

Post by slembcke »

Chipmunk Pro can do that sort of thing: http://chipmunk-physics.net/chipmunkPro.php
Demo project (using the Objective-C API): http://chipmunk-physics.net/tutorials/D ... ipmunk.tgz
Demo video: http://www.youtube.com/watch?v=QObxwXH6Ri8

It's not free but it's very efficient and pretty easy. Currently the tile cache which allows very efficient deformable terrain is written in Objective-C only if you aren't on an Apple platform. Using the C API, you'd have to extract the entire image or each deformation (not great for realtime if you have rapidly changing terrain) or port the tiler code (not impossible, but not trivial). I plan to port it to straight C eventually, but haven't gotten to it yet.

If you want to implement it yourself, it's sort of a lot of work (but obviously can be done). The vanilla marching squares algorithm is a good place to start. I know some people that have implemented similar things using CSG operations as well, although they struggled with it for a long time.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
chenhongsg
Posts: 4
Joined: Wed Feb 08, 2012 4:44 am
Contact:

Re: Destructive Terrain (worms, tanks etc..)

Post by chenhongsg »

Hi slembcke, I also keen for this feature , but I can only found demo project "Deformable Chipmunk" for Mac, may I know is this work in iOS platform and where can I download the demo for iOS ? Thanks a lot a advance !
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Destructive Terrain (worms, tanks etc..)

Post by slembcke »

Except for my debug rendering code, you could run the same code on iOS without changes. You can get a trial copy of the ChipmunkPro library here: http://chipmunk-physics.net/downloads.php
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
chenhongsg
Posts: 4
Joined: Wed Feb 08, 2012 4:44 am
Contact:

Re: Destructive Terrain (worms, tanks etc..)

Post by chenhongsg »

Thanks slembcke, start to try it !
chenhongsg
Posts: 4
Joined: Wed Feb 08, 2012 4:44 am
Contact:

Re: Destructive Terrain (worms, tanks etc..)

Post by chenhongsg »

Hi slembcke,
I'm using "ChipmunkPro-Trial-6.0.3/ChipmunkPro-iPhone-Trial" and try to move the code of DeformableBitmapDemo.m to a iOS project, encounter a linking error as below , but I already have the QuartzCore.framework linked. the libChipmunkPro-iPhone.a is modified at Saturday, December 17, 2011 6:55 AM
Thanks !

Code: Select all

Undefined symbols for architecture i386:
  "_CGImageSourceCreateWithURL", referenced from:
      +[ChipmunkImageSampler loadImage:] in libChipmunkPro-iPhone.a(ChipmunkImageSampler.o)
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Destructive Terrain (worms, tanks etc..)

Post by slembcke »

You also need to link to the ImageIO framework. That's where the CGImageSource* functions reside.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
chenhongsg
Posts: 4
Joined: Wed Feb 08, 2012 4:44 am
Contact:

Re: Destructive Terrain (worms, tanks etc..)

Post by chenhongsg »

Oops , my negligence, thanks !
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests