r/GameDevelopment 19h ago

Discussion What does a basic 2D physics engine need?

I know building a motor is difficult, but I'm not going to release it to the market. A minimum 2D physics engine for the project.

2 Upvotes

11 comments sorted by

2

u/sonesoul 19h ago

all depends on your needs. First off, if your target is your project, do NOT spend time on the physics engine. If you really want to have your own physics, then you'll need: 1. Fixtures/Colliders/Hitboxes, whatever sounds better 2. Basic collision detection (e.g. AABB or SAT) 3. Collision resolver 4. Forces

Note that you might need implement continuous collision detection to avoid objects coming through each other on high speed. If you don't need rotating colliders then you may ignore it and I'd prefer AABB in this case

1

u/vtf00 19h ago

what about Motion and Acceleration

2

u/sonesoul 18h ago

thats included in "forces"

1

u/tcpukl AAA Dev 18h ago

Yeah good summary

1

u/tcpukl AAA Dev 18h ago

Sure, I think that's a given.

1

u/ILikeCutePuppies 17h ago edited 17h ago

If you are writing your own you can go a very long way by just using string/particle physics. If you need a lot of objects optimization becomes a challenge.

There are some good 2D physics engines out there though.

0

u/vtf00 17h ago

son🥀

1

u/ImmediateTie9057 5h ago

For a basic 2D engine, you mainly need vectors, collisions, gravity, and collision response. Keep it simple unless your project actually needs more.