novelrt / NovelRT

A cross-platform 2D game engine accompanied by a strong toolset for visual novels.
MIT License
183 stars 43 forks source link

Create a plugin interface for physics #559

Open Pheubel opened 1 year ago

Pheubel commented 1 year ago

What is the current behaviour?

Currently there is no plugin interface for standardizing use of physics engines in NovelRT.

What is the expected behaviour/change?

There should be a basic plugin interface for any physics plugins to implement so that they can be easily swapped around.

What is the motivation / use case for changing the behavior?

With a standardised physics plugin interface, it will be easier for developers to implement a physics into their games, as it abstracts it away. It also allows them to try out different physics engines, like box2d or bullet without having to change their code base, as it would not have a specific implementation hard coded into their game.

Describe alternatives you've considered: Previously I attempted to implement Box2D more directly into NovelRT, but that caused more tight coupling that was not desired.

Are there any potential roadblocks or challenges facing this change?

As there are more than one physics engines out there, it might be hard to create a meaningful abstraction that can cover most use cases. Some engines might have different semantics that don't allow for easy unified abstractions.

Are there any downsides to implementing this change?

As mentioned above, it is most likely not possible to have the plugin interface be able to abstract over all features that a developer might want to have power over. However i do think that we'll be able to give them a solid base to work with.

Additional context This issue is related to https://github.com/novelrt/NovelRT/issues/84, as eventually there might be a plugin provider for box2d and bullet that would implement the physics plugin interface.

Pheubel commented 1 year ago

i'll make a little start with this.

RubyNova commented 1 year ago

Assigned, have fun