Page 1 of 1

Destructive Terrain (worms, tanks etc..)

Posted: Wed Jan 25, 2012 4:44 pm
by jastanton
How would I go about making destructive terrain using Chipmunk (or anything)? e.g.
Image

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

Posted: Wed Jan 25, 2012 10:58 pm
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.

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

Posted: Wed Feb 08, 2012 4:56 am
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 !

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

Posted: Wed Feb 08, 2012 11:24 am
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

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

Posted: Thu Feb 09, 2012 5:30 am
by chenhongsg
Thanks slembcke, start to try it !

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

Posted: Sat Feb 11, 2012 5:14 am
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)

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

Posted: Sat Feb 11, 2012 10:00 pm
by slembcke
You also need to link to the ImageIO framework. That's where the CGImageSource* functions reside.

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

Posted: Sun Feb 12, 2012 2:03 am
by chenhongsg
Oops , my negligence, thanks !