mgerhardy / caveexpress

CaveExpress is a classic 2D platformer with physics-based gameplay and dozens of levels. CavePacker is a Sokoban game.
http://www.caveproductions.org/
Other
144 stars 20 forks source link

Add support for box2d 2.4+ #110

Closed akien-mga closed 3 years ago

akien-mga commented 4 years ago

Hi,

Box2D had a new 2.4.0 (and then 2.4.1) release recently, which breaks compatibility with earlier releases:

/usr/include/box2d/b2_api.h
/usr/include/box2d/b2_block_allocator.h
/usr/include/box2d/b2_body.h
/usr/include/box2d/b2_broad_phase.h
/usr/include/box2d/b2_chain_shape.h
/usr/include/box2d/b2_circle_shape.h
/usr/include/box2d/b2_collision.h
/usr/include/box2d/b2_common.h
/usr/include/box2d/b2_contact.h
/usr/include/box2d/b2_contact_manager.h
/usr/include/box2d/b2_distance.h
/usr/include/box2d/b2_distance_joint.h
/usr/include/box2d/b2_draw.h
/usr/include/box2d/b2_dynamic_tree.h
/usr/include/box2d/b2_edge_shape.h
/usr/include/box2d/b2_fixture.h
/usr/include/box2d/b2_friction_joint.h
/usr/include/box2d/b2_gear_joint.h
/usr/include/box2d/b2_growable_stack.h
/usr/include/box2d/b2_joint.h
/usr/include/box2d/b2_math.h
/usr/include/box2d/b2_motor_joint.h
/usr/include/box2d/b2_mouse_joint.h
/usr/include/box2d/b2_polygon_shape.h
/usr/include/box2d/b2_prismatic_joint.h
/usr/include/box2d/b2_pulley_joint.h
/usr/include/box2d/b2_revolute_joint.h
/usr/include/box2d/b2_rope.h
/usr/include/box2d/b2_settings.h
/usr/include/box2d/b2_shape.h
/usr/include/box2d/b2_stack_allocator.h
/usr/include/box2d/b2_time_of_impact.h
/usr/include/box2d/b2_time_step.h
/usr/include/box2d/b2_timer.h
/usr/include/box2d/b2_types.h
/usr/include/box2d/b2_weld_joint.h
/usr/include/box2d/b2_wheel_joint.h
/usr/include/box2d/b2_world.h
/usr/include/box2d/b2_world_callbacks.h
/usr/include/box2d/box2d.h

To keep this codebase future proof it would be great to update to latest box2d (both builtin code and compatibility with system libraries, as I guess it would be tricky to keep support for both 2.4.x and 2.3.x).

mgerhardy commented 3 years ago

Working on it - most of the stuff is already done and pushed to the master branch. But there is a problem left with the revolute joint. Will figure it out in the next few days.

mgerhardy commented 3 years ago

https://box2d.org/documentation/md__d_1__git_hub_box2d_docs_dynamics.html#autotoc_md86

mgerhardy commented 3 years ago

Ok, the player-not-moving issue is fixed now - thanks to Eric Catto who found it. The problem was, that I did not set a density to the circle body in Player::createBody(). And box2d 2.4 changed the behavior of zero density objects to mto make them behave like static bodies.

There is another problem left with the packages not pulled into the target. But I'll open another ticket for that one. As the update is done and the game is playable like it is now.