Floating Sandbox Simulator is a realistic two-dimensional mass-spring network, which simulates physical bodies floating in the water.
See what happens when different objects interact. You can draw your own objects using different colors and materials in the library. The material has its own unique properties such as mass, strength, stiffness, other properties that reflect real life.
You may also use a handy template image that you can use to quickly select the right materials for your object.
Developing using C++ by Gabriele Giuseppini.
This game is a C++ implementation of a particular class of particle systems, namely a mass-spring-damper network. With a mass-spring-damper network, it is possible to simulate a rigid body by decomposing it into a number of infinitesimal particles (“points”), which are linked to each other via spring-damper pairs. Springs help maintain the rigidity of the body, while dampers are mostly to maintain the numerical stability of the system.
At any given moment, the forces acting on a point are:
- Spring forces, proportional to the elongation of the spring (Hooke’s law) and thus to the positions of the two endpoints
- Damper forces, proportional to the relative velocity of the endpoints of the spring and thus to the velocity of the two endpoints
- Gravity and buoyance forces, proportional to the mass and “wetness” of the points
- Forces deriving from the interactions with the user, who can apply radial or angular forces, generate explosions, and so on
Water that enters the body moves following gravity and pressure gradients, and it adds to the mass of each “wet” point rendering parts of the body heavier.
Thermodynamics controls how heat is transferred among particles and their surroundings, and combustion controls what happens when particles reach their critical burning points.
Bodies are loaded from png images; each pixel in the image becomes a point in the simulated world, and springs connect each point to all of its neighbours. The color of the pixel in the original image determines the material of the corresponding point, based on a dictionary containing tens of materials; the material of a point in turn determines the physical properties of the point (e.g. mass, water permeability, electrical conductivity) and of the springs attached to it (e.g. stiffness, strength).
An optional texture map may be applied on top of the body, which will be drawn according to a tessellation of the network of points.
Users can interact with a body in different ways:
- Break and repair parts of the body
- Slice and smash the body in pieces
- Deploy and detonate bombs
- Pin individual points of the body so that their position (and velocity) becomes frozen
- Add or remove water to and from the body
- Add or remove heat to and from the body – and let it catch fire!
- Apply radial forces and angular forces
- Move individual parts
As Always, Good Luck and Have Fun.