On Mon, Feb 1, 2010 at 9:47 AM, Jan-Paul Bultmann < [email protected]> wrote:
> Hey, the GlobalGameJam is over and there are some lessons learned. > > One of them was, that a build in physics engine would be very practical for > cocos. > My proposion would be the integration of the Pymunk physics wrapper for > Chipmunk in form of a new layer (maybe a util layer) named MunkLayer wich > wraps the pymunk model( a space ), as well as a MunkNode class, wich > subclasses CocosNode and wraps the pymunk model objects(bodies). > In my opinion the layer would be pretty lightweight, as shapes for exaple > would still be declared through pymunk, but it would abstract functionality > that has to be reimplemented every time. > There should be the ability to draw the primitves of the physics model for > debugging puposes, so the implementation of primitive objects would be on > the list again^^. > > Some open questions are how Actions would be handled, should it be > prohibited to use them on MunkNodes, or should they perform the > corresponding actions in the pysics simulation. > > Im currently implementing the above for my own use, and I think it would be > very usefull with cocos. > > What do you think? > > Greets Jan > > My first approach to use cocos + phys engine would be in the line of model-view-controller. Because: 1. easy to upgrade actor presentation. You start with a square, then refine visuals without need to perturb the phys part 2. your model actors and world would be much more compact and simpler 3. decoupling Two cocos MVC examples (with ad-hoc physics, not chipmunk or box2d): 1. tetrico, in the docs and examples for cocos 2. http://code.google.com/p/pigeonsgame/ Also for physics by the way of box2D see this, (quoting riq) """ Hi, here is another game done for pyweek using cocos2d. download: http://media.pyweek.org/dl/9/GasMan/gasman-1.0.tar.gz technical details: It uses pybox2d. The integration between pybox2d and cocos2d was done with the gamelib/box2d_callbacks.py This file is heavily based on the pybox2d testbed example. But some modifications were made in the fwDebugDraw class, like adding pixel to meters ratio. If you are planning a cocos2d + box2d game, this file (box2d_callbacks.py) is good starting point. The game also uses SVG levels. The .svg files contains the physics information like: - bodies and shapes - static or dynamic shapes - shapes data: restitution, friction, density - plus sprite info so coding new levels was relatively easy. If you are interested in the details, the gamelib/svg_box2d_parser.py has the implementation. """ (end quote) -- claudio -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en.
