Fabrique.gml (BETA)
BETA disclaimer
Fabrique is currently in BETA, offered at a discounted price for the time being. Expect issues but rest assured this is a work-in-progress.
About
Fabrique is a 3D, gpu-accelerated particle physics library for GameMaker 2.3 written in standard GML and GLSL-ES. Its solver is packed with features, simple to use and standalone production-ready. Intermediate users will find it easy to integrate, while more advanced users can have a blast extending it to fit their use.
IMPORTANT: Vertex texture fetching (VTF) is required to render models that rely on fabrique mesh lookups. Currently this is not natively supported in GM:Studio across all platforms, particularly HLSL 11 ANGLE translation. Other platforms might be affected as well. For these cases it is required to utilize an external library that allows VTF on the target platform. Fabrique solver is fully cross-platform and doesn't rely on VTF for simulation, only the rendering step requires it.
Features
Particles and Bonds
Particles are non-parametric nodes that can be edited in real-time and baked into a mesh. Fabrique does this in parallel by encoding and editing mesh data in vram. Particles are defined by their properties and bonds to other particles, Their parameters include position, speed, direction, mass, restitution, drag, pressure, tension, group, state and more. Fabrique allows a safe maximum of 65536 nodes and 524288 bonds per body.
Meshes
Visualized mesh transformation in 3d
Meshes generate buffers from particles and bonds added to it. Meshes and their output are modular, they can be saved, loaded, cached and reused at user's discretion. This allows the user to give their mesh any form they desire, either by embedding it to a model or generating procedurally.
Procedural softbody mesh
Bodies
Fabrique bodies are baked out of generated mesh data. Multiple meshes can be baked into a single body which the user can then reference and draw multiple models. This means a whole level's worth of physics data can be baked into a single solver,
Cloth body with structure-preserving bond colliders
Solver takes a stack of wanted transformations (deltas, collisions, force maps, etc.) and computes the next state. Each transformation can be limited to only affect a group of nodes, or even affect nodes depending on their current state.
Dragging nodes currently in their "pull" state
Fabrique bodies can save/load their whole states blazingly-fast via snapshots. User can visually edit them in their game or editor, then take snapshots for reuse of desired results.
Force Mapping
Fabrique simulates particles in parallel. Forces and other affecting behaviors are defined inside force maps that can be applied to fabrique bodies individually or collectively. Hundreds of these can be stacked together and applied on local/global scale, making some very complex simulations possible at great performance.
Nodes tearing under pressure passed by force collider
Batch Buffers
Batch buffers allow the user to quickly read or write to individual nodes. It's primary use is being an interface between ram and vram, allowing the user to pin bodies to other objects dynamically, check if specific parts are still alive or at desired location, etc.
Curtain scripting using batch buffers
Batches can be declared, written and read from dynamically on demand. Keep in mind encoding/decoding thousands of particles in real-time on the cpu will not provide great results no matter how it's approached.
2D Pixel Colliders
Tangled
2D pixel colliders are built directly from surfaces. They can be normalized in real-time relying on distance fields to push colliding nodes in parallel. Fabrique allows the user to downscale the resulting texture, so bigger maps can be baked without losing any meaningful detail.
Colliding softbody
Planned features
- 3D Voxel Colliders
- Self-collision and feedback with other bodies (once compute shaders are available)
- Integration with GM native box2d implementation (compute shaders)
- Export fabrique meshes directly from Blender
- HLSL 11 VTF solution for Windows and Xbox
Known limitations
- Vertex-texture-fetching (VTF) is necessary for rendering fabrique bodies
- Bodies cannot interact with each other in parallel (compute waiting room)
- Extreme conditions may break simulations
- stay away from self-colliding soft-bodies that are too congested as they can get stuck in themselves and (violently) push back
- using too long of a time-step (delta_time)
- GameMaker Studio 2.3 and above
Purchase
In order to download this library you must purchase it at or above the minimum price of 19.99€ EUR. You will get access to the following files: