3
\$\begingroup\$

I have in mind a 2d, side-scrolling game which requires the construction of vehicles and/or structures built of conjoined rigid structures, like beams or platforms. These structures will be impacted from various angles.

What algorithms and data structures are used typically in, say, bridge-building games, to determine the force dispersal between such attached, rigid objects, and at what point the joints bend or break?

\$\endgroup\$
5
  • \$\begingroup\$ World of Goo also handles algorithms similar to what I'm looking for. \$\endgroup\$ Dec 16, 2015 at 18:25
  • 1
    \$\begingroup\$ Check out mass spring systems. \$\endgroup\$
    – EvilTak
    Dec 16, 2015 at 19:46
  • \$\begingroup\$ Are you using box2d? \$\endgroup\$ Jan 21, 2016 at 17:33
  • 1
    \$\begingroup\$ If you use a nice library (like box2d) all that stuff is built into the physics and you just have to program the logic for coordinating the joints/fixtures and forces. It's a great library, popular on pc and android (I'm pretty sure). It was written in c/c++ but has also been translated into java \$\endgroup\$ Jan 21, 2016 at 17:35
  • \$\begingroup\$ A good suggestion. I was considering box2d or matter.js for interactions between larger objects, but the stress-bearing interiors may potentially bear thousands of connections, each. Writing said stress algorithms myself would be the only way to precisely optimize the balance between accuracy and speed. The force dispersal algorithms in bridge-building games would be a good start. \$\endgroup\$ Jan 22, 2016 at 23:59

1 Answer 1

1
\$\begingroup\$

If you are content with equilibrium cases (just finding distribution of forces in a static structure, possibly detecting destructive overload), and all your structures are discrete (e.g., built from trusses not cast from iron), and all your joints are pins (cannot support torque, so you only solve for forces), then you can use the method of joints.

https://en.wikipedia.org/wiki/Structural_analysis discusses both the method of joints and the method of sections.

If your structures are even more regular (e.g., built from axis-aligned trusses), then it is possible to optimize algorithm even more.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .