Skip to content

Create a 2D physics engine #211

@Dawoodoz

Description

@Dawoodoz

2D games generating distance maps from pixels for collisions with the world would consume too much memory when the maps are big, and only colliding with square tiles would prevent designing diagonal obstacles. Many 2D games abuse 3D physics engines with constrained depth, which is terrible for both performance and numerical stability. So the SDK folder needs a 2D physics engine as an example of how it can be implemented using the math types that already exist in the framework.

Trying to store a complete copy of the entire world using physical shapes would be highly inefficient use of memory, or error-prone procedural creation and destruction of nearby obstacles. It would be easier to just provide a function pointer asking the game for collision shapes overlapping with a rectangular region in the world directly from the data structure already used to compress the level in memory.

Useful features:

  • Rigid bodies
  • Rounded convex polygon shapes
  • Connections between rigid bodies, for hanging bridges and vehicles
  • Line intersections and collision sweeps for visibility and bullets
  • Adjustable relative velocity at point of impact for conveyor belts, wheels and walking characters

A 2D physics editor with a script engine would allow quick prototyping of game concepts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Big taskThis can take months to complete and may generate sub tasks.Low priorityNo rush to have this done, because other things are more urgent.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions