|
| 1 | +# Munk2D |
| 2 | + |
| 3 | +## FORK INFO |
| 4 | + |
| 5 | +The main purpose of this fork is to be a companion for the Python 2D physics |
| 6 | +library [Pymunk](https://www.pymunk.org) which is built on Chipmunk2D. Given the |
| 7 | +slow pace of development of Chipmunk2D, and some unique requirements and |
| 8 | +opportunities of Pymunk this is something that have grown over a long time. What |
| 9 | +really made me consider making this fork more formal was the discussion |
| 10 | +[here](https://github.com/slembcke/Chipmunk2D/issues/237) with Slembcke, the |
| 11 | +creator of Chipmunk2D. |
| 12 | + |
| 13 | +I do not foresee that I have the time, motivation or skills to really revive |
| 14 | +Chipmunk2D. However, I hope to incorporate minor new features, and a bunch of |
| 15 | +fixes. Any changes are driven by what make sense from the Pymunk use case. |
| 16 | +However, I do think many of these changes are useful also to users outside |
| 17 | +Pymunk, and you are of course free to use the fork for other projects / |
| 18 | +languages as well. |
| 19 | + |
| 20 | +At the moment I don't have any formal release of this fork, but I plan to make |
| 21 | +some kind of rename and a release if/when enough changes are accumulated. Until |
| 22 | +a proper release is out I do not recommend usage of Munk2D, since I will force |
| 23 | +push file structure changes while I try to make the documentation ok! |
| 24 | + |
| 25 | +/Victor 2025-01-25 |
| 26 | + |
| 27 | +## ABOUT |
| 28 | + |
| 29 | +This is a fork of the 2D physics library |
| 30 | +[Chipmunk2D](https://github.com/slembcke/Chipmunk2D). Munk2D is a simple, |
| 31 | +lightweight, fast and portable 2D rigid body physics library written in C. It's |
| 32 | +licensed under the permissive MIT license. I hope you enjoy using Munk2D! |
| 33 | + |
| 34 | +### Expectations from Munk2D |
| 35 | + |
| 36 | +- Munk2D will add fixes for various issues, especially issues affecting Pymunk. |
| 37 | +- Munk2D will add or improve features useful for Pymunk. |
| 38 | +- Munk2D does not aim for ABI stability between versions. |
| 39 | +- Munk2D will try to avoid API breaking changes, but ultimately be less strict |
| 40 | + than Chipmunk2D. |
| 41 | +- While Munk2D will not try to actively break features or targets, breakage is |
| 42 | + more likely than with Chipmunk2D. Testing of Munk2D will mainly happen through |
| 43 | + Pymunk, parts not useful from Pymunk (e.g ObjectiveC support), will be |
| 44 | + untested and therefor likely to break over time. |
| 45 | +- While Munk2D is focused on Pymunk, I will happily accept PRs to fix or improve |
| 46 | + other parts of the code, or improvements to tests, documentation and so on. |
| 47 | + |
| 48 | +## FEATURES |
| 49 | + |
| 50 | +- Designed specifically for 2D video games. |
| 51 | +- Circle, convex polygon, and beveled line segment collision primitives. |
| 52 | +- Multiple collision primitives can be attached to a single rigid body. |
| 53 | +- Fast broad phase collision detection by using a bounding box tree with great |
| 54 | + temporal coherence or a spatial hash. |
| 55 | +- Extremely fast impulse solving by utilizing Erin Catto's contact persistence |
| 56 | + algorithm. |
| 57 | +- Supports sleeping objects that have come to rest to reduce the CPU load. |
| 58 | +- Support for collision event callbacks based on user definable object types. |
| 59 | +- Flexible collision filtering system with layers, exclusion groups and |
| 60 | + callbacks. \*\* Can be used to create all sorts of effects like one way |
| 61 | + platforms or buoyancy areas. (Examples included) |
| 62 | +- Supports nearest point, segment (raycasting), shape and bounding box queries |
| 63 | + to the collision detection system. |
| 64 | +- Collision impulses amounts can be retrieved for gameplay effects, sound |
| 65 | + effects, etc. |
| 66 | +- Large variety of joints - easily make vehicles, ragdolls, and more. |
| 67 | +- Joint callbacks. \*\* Can be used to easily implement breakable or animated |
| 68 | + joints. (Examples included) |
| 69 | +- Maintains a contact graph of all colliding objects. |
| 70 | +- Lightweight C99 implementation with no external dependencies outside the Std. |
| 71 | + C library. |
| 72 | +- "Many language bindings available":http://chipmunk2d.net/bindingsAndPorts.php. |
| 73 | +- Simple, read the "documentation":https://viblo.github.io/Munk2D/ and see! |
| 74 | +- Unrestrictive MIT license |
| 75 | + |
| 76 | +## BUILDING |
| 77 | + |
| 78 | +Mac OS X: There is an included Xcode project file for building the static |
| 79 | +library and demo application. Alternatively you could use the CMake files or the |
| 80 | +macstatic.command script inside the xcode/ directory to build a static lib and |
| 81 | +package up the headers for you. |
| 82 | + |
| 83 | +iPhone: A native Objective-C API is included. The Xcode project can build a |
| 84 | +static library with all the proper compiler settings. Alternatively, you can |
| 85 | +just run iphonestatic.command in the xcode/ directory. It will build you a fat |
| 86 | +library compiled as release for the device and debug for the simulator. After |
| 87 | +running it, you can simply drop the Chipmunk-iOS directory into your iPhone |
| 88 | +project! |
| 89 | + |
| 90 | +UNIXes: A forum user was kind enough to make a set of CMake files for Chipmunk. |
| 91 | +This will require you to have CMake installed. To build run 'cmake .' then |
| 92 | +'make'. This should build a dynamic library, a static library, and the demo |
| 93 | +application. A number of people have had build errors on Ubuntu due to not |
| 94 | +having GLUT or libxmu installed. |
| 95 | + |
| 96 | +Windows: Visual Studio projects are included in the msvc/ directory. While I try |
| 97 | +to make sure the MSVC 10 project is up to date, I don't have MSVC 9 to keep that |
| 98 | +project updated regularly. It may not work. I'd appreciate a hand fixing it if |
| 99 | +that's the case. |
| 100 | + |
| 101 | +## GET UP TO DATE |
| 102 | + |
| 103 | +If you got the source from a point release download, you might want to consider |
| 104 | +getting the latest source from GitHub. Bugs are fixed, and new features are |
| 105 | +added regularly. Big changes are done in branches and tested before merging them |
| 106 | +in it's rare for the point release downloads to be better or more bug free than |
| 107 | +the latest code. |
| 108 | + |
| 109 | +Head on over to "GitHub":https://github.com/viblo/Munk2D and experience the |
| 110 | +future TODAY! (Okay, so maybe it's not that exciting.) |
| 111 | + |
| 112 | +## GETTING STARTED |
| 113 | + |
| 114 | +The C API documentation is in the docs/ directory. |
| 115 | + |
| 116 | +A good starting point is to take a look at the included Demo application. The |
| 117 | +demos all just set up a Munk2D simulation space and the demo app draws the |
| 118 | +graphics directly out of that. This makes it easy to see how the Munk2D API |
| 119 | +works without worrying about the graphics code. You are free to use the demo |
| 120 | +drawing routines in your own projects, though it is certainly not the |
| 121 | +recommended way of drawing Munk2D objects as it pokes around at the |
| 122 | +undocumented/private APIs of Munk2D. |
| 123 | + |
| 124 | +## SUPPORT |
| 125 | + |
| 126 | +There is a forum for Chipmunk2D at http://chipmunk2d.net/forum/ Unfortunately |
| 127 | +its very inactive nowadays, but much of the discussions are still relevant. |
| 128 | + |
| 129 | +The best way to get support is to visit the "Chipmunk |
| 130 | +Forums":http://chipmunk2d.net/forum/. There are plenty of people around using |
| 131 | +Chipmunk on the just about every platform I've ever heard of. If you are working |
| 132 | +on a commercial project and want some more direct help, Howling Moon Software is |
| 133 | +also available for "contracting":http://howlingmoonsoftware.com/. |
| 134 | + |
| 135 | +## CONTRACTING |
| 136 | + |
| 137 | +Howling Moon Software (company of Chipmunk2D) is available for contracting if |
| 138 | +you want to make the physics in your game really stand out. Given their unique |
| 139 | +experience with Chipmunk2D, they can help you use Chipmunk (and likely Munk2D) |
| 140 | +to its fullest potential. Feel free to contact them through their webpage: |
| 141 | +http://howlingmoonsoftware.com/ |
0 commit comments