Thesis – Adapting Box2D to Non-Euclidean Spaces

This thesis explores the challenge of adapting Box2D to simulate non-Euclidean spaces created using transformational portals. These portals are similar to those seen in games such as Portal II and Gateways, but in this case, the portals transform not only position but also orientation, scale, and handedness (left/right).

These transformations have implications for the physics simulation: there no longer exists only one shortest distance between two points and rigid-bodies can collide with themselves.

This thesis answers the question “Can Box2D, the leading 2D physics engine for real-time 2D games be adapted to simulate non-Euclidean areas stably, efficiently, and with high fidelity to normal Euclidean space?”

Non-Euclidean Sample Level

Sample Level: Super Mario Brothers 1-1

In this video I showcase how various non-Euclidean transformations could be used in the context of the first level from Super Mario Brothers. All images are ©Nintendo.


  • Position
    -The first warp-pipe connects directly to the underworld
  • Rotation
    -The underworld exit pipe rotates ninety degrees
  • Size
    -The level end connects to the beginning but scaled smaller
  • Mirroring
    -The first and last pits connect to each other mirrored left/right