5
\$\begingroup\$

I started making my simple 2D runner game with a splash of physics (particularly, rope physics). It's in Love2d, project is targeting mobile platforms. Development goes fine, though I meant to ask one thing. Referencing this page: https://love2d.org/wiki/love.physics

The message at the top warns against using the physics engine for a platform game, and has an anology to heavy-lifting, but no good explanation as to what might go wrong, what exactly is so hard about it and why should I stay away from it. Because so far I have my basic idea implemented and no bad experiences here. As to good ones, I was able to abstract all the collision handling and let physics engine just do it for me.

Given that using the physics engine for my platformer seemed to work well in my initial test, why do many people consider it a bad idea? I mentioned some upsides but what are the downsides?

\$\endgroup\$
  • 2
    \$\begingroup\$ I disagree with the close vote for this question, because I think it's kind of a special exception. The vote reason is "primarily opinion based" and I actually agree that this is an opinion-based issue, but I think despite that, this question has value and should remain open. It's a common opinion that's commonly expressed with little explanation, so people could legitimately wonder what the pros and cons are for this issue. \$\endgroup\$ – jhocking Jul 5 '17 at 16:11
  • \$\begingroup\$ I agree that this is a primarily opinion based question that adds value; however, we do not discount major close voting precedent on the basis of value. If it is that valuable, we should work out a way to reform this to not be primarily opinion based. Stack Exchange as a whole does not want questions based off opinion. \$\endgroup\$ – Gnemlock Jul 6 '17 at 5:18
  • \$\begingroup\$ That makes sense, I'll edit it to hopefully fix that. \$\endgroup\$ – jhocking Jul 6 '17 at 15:20
3
\$\begingroup\$

It's not necessarily a completely terrible idea but there are significant cons to weigh against the pros you mention. In particular, the physics in a platformer character usually isn't totally (or even very) realistic, but a physics engine handles realistic and consistent physics. You may end up fighting against the physics engine to implement things like, say, one-way platforms that you can jump through from below but collide from above.

Myself, I actually just implemented a basic 2D platformer in Unity using the built-in physics (for the upcoming second edition of my book) and it worked out pretty well, but then Unity comes with special components to help deal with platformer physics.

\$\endgroup\$
2
\$\begingroup\$

This is a matter of opinion.

The reference you gave seemed to arguing that depending on what you wanted, using a physics engine could be overkill. I think many of us that have used a physics engine would agree with that opinion if for instance the design of a game didn't need to deal with collision responses. And I interpret what the linked text said as just trying to say that. On the other hand, if the game has collisions that should be dealt with, a physics engine can be easier to use than reinventing all the code necessary to do it yourself.

Hope this helps.

\$\endgroup\$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.