1
\$\begingroup\$

I'm making a modular system for a 2D spaceship arcade like game, the user builds their own ship with equilateral triangles to make more complex shapes. When the ships are small it's no problem, but as you make bigger ships you would have to add more bodies to the physics engine, so I think I should just combine all the bodies and make a polygon outlining the shape I'm making and simply render it as multiple. But I've also heard it's really computationally expensive to use shapes other than squares, triangles, and circles.

Tldr: I have a compound of triangles, should I just leave it as is? Or make a polygon outlining the overall shape? Which is better performing? Is there anything I'm missing?

\$\endgroup\$
  • \$\begingroup\$ Do you need to be able to blow the ship apart? (Also, I'm curious - are you really using equilateral triangles, or perhaps right triangles? It's harder to handle equilateral ones, but could lead to some interesting configurations!) \$\endgroup\$ – A C Jun 29 '19 at 2:42
  • \$\begingroup\$ How many ships of this style are to be checked each frame? \$\endgroup\$ – Vaillancourt Jun 29 '19 at 2:51
  • 3
    \$\begingroup\$ Have you tried building a ship-sized object out of simple primitive shapes, and out of larger polygons, and profiling both cases to compare their performance? This looks like a question you can answer for your own specific needs through your own testing. \$\endgroup\$ – DMGregory Jun 29 '19 at 3:31
  • \$\begingroup\$ @AC yeah, that's the idea, and yeah I'm using all equilateral triangles \$\endgroup\$ – Jaacko Torus Jun 29 '19 at 19:55
  • \$\begingroup\$ @AlexandreVaillancourt less than 4. with an average of 30 equilateral triangles per ship \$\endgroup\$ – Jaacko Torus Jun 29 '19 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.