The Stretch Tech of Stretchmancer!




In Stretchmancer you use your powers to warp the world around you. Can't squeeze through a tight gap? No problem - touch your magic little gecko hand against a wall to stretch the world along that axis.


To keep with the theme Limited Space when you stretch along an axis the other dimensions shrink. There's always the same amount of space but it's how you use it that counts! But how to achieve that in a game engine?

Maths!

Space is about volume. The volume of a box is: width x height x depth. 

v = w.h.d

We want volume to remain constant as we stretch in one dimension - multiplying it by a scale value (s). This means we care about the multipliers for the other dimensions.

To keep things straight forward lets say the other dimensions scale down the same amount each (c):

s.w.c.h.c.d = v

We know this volume is the same as the original volume so substituting in v = w.h.d we get:

s.c^2.w.h.d = w.h.d

Eliminate and rearrange:

c = sqrt(1/s)

That's the value that can adjust the other axes and produce:


Space has been limited!

Stretchy Spaces!

Now 3D game engines tend to support scale in their transform systems. We can group objects under a single scalable parent and they'll inherit the scale themselves. Neat!

Though what if the player capsule is standing on something that scales? If we don't inherit the scale the floor will slide from underneath us. But we don't want to be a child of the group as we'll scale our size with it.

The trick is to apply the scale to the player's position only, not the player's scale.

In fact this trick can be used on anything that wants to ignore the scale of the world but keep its relative position. Notice how the blue blocks (compactonium floaters!) don't change size as the level scales but do adjust position. Now we can have lots of little scalable islands that all track their positions with each other (no sliding!). Tasty puzzle ingredients to torture our Agora hero with!


Get Stretchmancer

Comments

Log in with itch.io to leave a comment.

(+1)

I was hoping to find out how it was made, thank you!