Matt's Game Framework
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
mgf_demo
src
.gitignore
CHANGELOG.md
Cargo.toml
LICENSE
README.md

README.md

MGF: Matt's Game Framework

Documentation Version License Downloads

MGF is a collision detection and physics library for use in 3D video games.

MGF is intended to very light weight and uses cgmath as a math backend.

The library provides various features such as:

  • structures to define shapes: Ray, Segment, AABB, Rectangle, Triangle, Sphere, Capsule
  • dynamic shape types: Component, ComponentConstructor
  • structures to define aggregate shapes: Mesh, Compound,
  • discrete collision detection: Overlaps, Contains
  • continuous collision detection: Intersection, Contact, LocalContact
  • a bounding volume hierarchy: BVH
  • rigid body physics: RigidBodyVec, ContactConstraint, Solver
  • dynamic containers: Pool

MGF is very much in its infancy and is therefore not feature complete. If you notice any errors or poorly thought out interfaces be sure to let me know.

3D only

For the time being MGF is solely designed to handle 3D video games. This reflects my own use of MGF. If there is enough demand for MGF to support 2D games, it may in the future.

Differences between other collision detection/physics libraries

Most collision detection and physics libraries provide similar to functionality to MGF, what differs is how they are implemented. Most libraries use the GJK algorithm to perform every type of collision, including continuous ones. MGF focuses on providing fast and accurate exact collision detection for moving geometries commonly found in games, such as Spheres and Capsules, and does not and cannot provide fast and accurate moving mesh on mesh collisions.

As of version 1.1, MGF provides a limited form of GJK discrete collision detection, although in its current form it is quite limited.

Things to keep in mind

One interesting result of the implementation is that the direction of the normal of a polygon determines the "side" it is facing, in a similar manner to how back-face culling is performed. This allows us to determine inter-object penetration much more accurately than we would be able to otherwise. The normal force essentially acts as the direction of propulsion for the object during physics resolution.

Examples

You can find working examples in the mgf_demo folder. Demos require gfx and gfx_glutin to display visuals. Be sure to build the demos in release mode to get adequate performance:

cargo build --release

Here is a link to a video of the demo in action.

Contributing

MGF is welcome to anyone's contribution, and any part of the interface is open to discussion. Although if you are going to contribute new features please do be sure to include unit tests.

License

The open source version of MGF is available with the GNU GPL version 3 license. This license is quite inconvenient for game programming, so if you would like to request a custom license for your comercial product please contact map@maplant.com and we can assign you a custom license free of charge.