Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework module structure, and improve documentation and Rotation #370

Merged
merged 9 commits into from
Jun 14, 2024

Conversation

Jondolf
Copy link
Owner

@Jondolf Jondolf commented Jun 13, 2024

Objective

Note: This PR targets the avian branch instead of main. This is intended, as this is a part of an ongoing rework.

The current module structure is not ideal.

Old module structure

  • components just contains a bunch of components with no clear separation of concerns, and some components are still stored elsewhere, so it's not even comprehensive at all.
  • resources has the same issue; no separation of concerns, and it's pretty random which resources are there vs. elsewhere.
  • Why is constraints a top-level module? It's mainly a solver implementation detail.
  • plugins is weird, because it has sub-folders with sub-plugins, and really it's just a folder for basically all functionality in the engine.

The lack of separation of concerns harms the modularity of the engine and can make it harder to find things. For a project at this scale, modules like components are bad.

Solution

  • Yeet plugins, components, and resources, flatten the module structure.
  • Organize everything by logical concerns.
    • Components and resources related to colliders and collision detection are in collision.
    • Components and resources related to rigid bodies, gravity, and so on are in dynamics
    • Resources related to scheduling are in schedule.
  • Add dynamics module for encapsulating rigid body dynamics (solver, sleeping, rigid body components, etc.), which also gives a nice place for more high-level docs.

New module structure

This PR also contains some other miscallaneous improvements:

  • Split the PhysicsSetupPlugin into PhysicsSchedulePlugin and PhysicsTypeRegistrationPlugin
  • Fixed broken doc links.
  • Generally improved some docs.
  • Improved the Rotation type, making it closer match Bevy's new Rot2.
    • This is very unrelated, but it's a part of the ongoing rework anyway and annoying to split out :P

Migration Guide

  • The internal module structure has changed significantly, and types have moved around. Most imports from the prelude should work like before, but explicit import paths may be broken.
  • The PhysicsSetupPlugin has been split into PhysicsSchedulePlugin and PhysicsTypeRegistrationPlugin.

@Jondolf Jondolf merged commit 5081acf into avian Jun 14, 2024
4 checks passed
@Jondolf Jondolf deleted the rework-structure branch June 14, 2024 10:09
@Jondolf Jondolf added the C-Breaking-Change This change removes or changes behavior or APIs, requiring users to adapt label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Breaking-Change This change removes or changes behavior or APIs, requiring users to adapt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant