AdamsLair / duality

a 2D Game Development Framework
https://adamslair.github.io/duality
MIT License
1.41k stars 287 forks source link

Improve Physics API #21

Closed AdamsLair closed 7 years ago

AdamsLair commented 11 years ago

Problem:

Solution:

Armitage1982 commented 11 years ago

Think I will adopt Duality as soon as this is implemented cause it will bring something new on the table compared to engine like Unity3D & Co. They all include a physic engine but most of the time it's an half baked old version of Box2D.

Farseer is also going to receive an update soon http://farseerphysics.codeplex.com/discussions/401007 No idea if this 3.5 will be commercial but the SPH feature sounds very tempting !

lukaspirkl commented 10 years ago

Also I think that you can separate the whole physics stuff into individual plugin. I am learning how to write advanced editor plugin from that part and it looks like there is nice border between Duality's core and the physics part. I am considering the stuff which is adding the windows/panels as a core because they are really necessary. But I would say that physics is optional. For example if someone want to create Mario-like platformer or Bejeweled-like logic game or classic point&click adventure, the physic is not necessary.

AdamsLair commented 10 years ago

Although you are correct that physics is not something every game needs, I would still include physics in the core, because almost everyone will use at least a certain part of the physics API.

Point is: Physics is not only "bouncing rigid bodies around", but can also serve as a pure collision detection framework. You can configure all of your RigidBodies as sensors and just react to collision events yourself - either by applying forces, or by hard-setting velocity and position as you see fit. You can also do raycasts and point-shape collision checks / "physical picking", which both are valuable features - even when doing some "Super Mario" style game.

Another reason to keep standard RigidBodies around is that other - optional - plugins can safely rely on it in the future. Think of a pathfinding plugin that will automatically create a navigation mesh based on the free space between static RigidBodies in the current level. Or think of a tilemap plugin that can automatically generate a RigidBody of a tilemap based on solid and non-solid tiles.

The overhead of keeping physics around in the core is considerably small, and most of the users will probably use the API in some way. It's just infrastructure, on a certain level.

lukaspirkl commented 10 years ago

You are right. My mind is still locked in fact that physics is the "bouncing stuff".

Your example is exactly what I am playing with. :-) I am trying to create navmesh editor which should be able to calculate the mesh from the RigidBodies. Than I would like to put together some AI plugin with pathfinding, behavior tree... something like http://rivaltheory.com/rain/

AdamsLair commented 10 years ago

Your example is exactly what I am playing with. :-)

Still waiting for a local co-op multiplayer topdown 360° shooter - or a chance to build something like that myself. I'll rejoice if someone else is taking care of the required Navimesh stuff before I can :D

[/OT]

ilexp commented 7 years ago

Closing this as it partially overlaps with issue #54 and is way to broad to be useful as an issue to resolve. Create separate issues for smaller sub-tasks as their need arises instead.