Parallel levels and composites.

The basic idea for the game I'm thinking about making includes multiple parallel stages per level. Imagine two worlds, 2m by 2m, called world A and world B. Upon hitting the spacebar (or some other key), the player is transported to a "composite" world.something like this:


(1,2) (2,2)

(1,1) (2,1)


(1,2) (2,2)

(1,1) (2,1)

Composite when character is standing on (1,2) or (2,2) from either A or B:

(1,2)A (2,2)A

(1,2)B (2,2)B

Composite when character is standing on (1,1) or (2,1) from either A or B:

(1,1)A (2,1)A

(1,1)B (2,1)B

How would I do this? Everything on the block would need to stay the same. For example, if the player hit the spacebar when the character was standing on (1,2)A and there was a wooden block on (2,2)A, both would need to be transported to the composite world and be on (1,2)A and (2,2)A respectively.

There are basically three ways: move everything to the new world, or move the new world to you, or move nothing. It depends on how different the worlds are, what stays the same and what changes.

To move nothing, the two worlds would coexist but you would deactivate and activate game objects. You could also swap textures and shaders to change the appearance of things that aren't moving, but that look different. Scripts could behave differently depending on which world was active. Etc.

To move the player, you'd have the 2nd world off-screen (displaced along the z-axis maybe). When the player swaps, translate the camera, player, and block to the new location.

To move the world, you'd keep the camera, player and block in one spot and move everything else.

That's the idea, and you may have gotten that far in your thinking already. But there's not much more to it than that. For your example you'll need a way to detect what the player is standing on; raycasting from the player downwards is probably the way to go, or maybe you could track which block(s) the player last collided with as they walked around.