\$\begingroup\$

Background:

I'm trying to make a segmented/portal-based game engine that supports impossible (non-euclidean?) geometry.

By segmented/portal-based I mean the world is divided into segments which are connected by portals. This technique was used by the engines for classic shooters like Doom and Duke Nukem 3d.

The portals do not look or function like the portals in the game Portal, which is unfortunately what most of the results that queries containing "portal" bring up.

Each area is in its own coordinate system with each portal defining the transformation between the portal entrance in the origin segment and the portal exit in the destination segment.

It is possible for there to be multiple portals connecting the segments and for those portals to have different transformations. If I understand correctly, this makes the world non-euclidean and precludes storing a transformation for each connected segment on a segment.

Objects have transforms for each segment they are present in. So instead of the usual transform setup of objects having a local transform, a parent transform, and a world transform there is no world transform and it is possible to have more than one "parent" transform.

Advanced math is not my strong point. I understand the basics of the transformations but there are some details I don't fully grok and almost certainly some important or useful properties that I am not aware of.

Questions:

Where do I "store" or "collect" the results of applying transformations to an object?

Do I apply them to the object's local tranform or do I apply it to the object's transforms relative to "parent" segments?

It seems like a bad idea to accrue transformations on the local transform, but perhaps I don't understand the purpose of the local transform.

Research before asking question:

tutorial on simple portals in unreal that helped with outlining the transformation logic, but is focused on unreal and does not answer my questions.

flipcode portal rendering tutorial which gets brought out anytime there is a question about portal-based rendering. I have read through it a couple times, although the small font is hard for me to read so it is very possible I missed some details.

related question

related question

discussion on gamedev subreddit