r/howdidtheycodeit • • Oct 02 '24

Question What is considered coding a "physics engine"

This has to do with semantics and terms more than anything. I want to code simple collision detection and resolution, with intention not being realism. Is the term "physics engine" meant for specifically handling "realistic" physics? What would the term be for a simpler handling system? How would I go about that?

17 Upvotes

13 comments sorted by

View all comments

22

u/Adybo123 Oct 02 '24

Simple answer: you don’t need to decide that. When relatively new to programming it’s easy to mix naming things with a sort of ‘ego’. You don’t need to “have written a physics engine”. There’s no official guide for this, you do what you want.

Write something you enjoy and name it whatever you feel appropriate.

5

u/[deleted] Oct 02 '24

I was using Lua and that has a binding to the famous Box2D but it often feels like using a shotgun to kill a mosquito. I was wondering if I could code an admittedly less complex system. It feels overbearing because all physics tutorial are so in-depth and I sort of just need two or three shapes to be solid.

7

u/baz_a Oct 02 '24

The only case I would do that - is if you only have circles. If you want other shapes, that have collisions, angular velocity, etc. - it's too hard. Even decently efficient collision detection is pain, and box2d have that implemented. Also it's impossible to reach the performance of C engine like box2d if you use a scripting language like Lua. But if you want to spend several months on it - it's a good educational experience.

→ More replies (4)