Zshandi / ScalingPuzzler

Scaling Puzzler game for the 2024 GMTK Game Jam
0 stars 0 forks source link

Allow more scaling without physics breaking #55

Open Zshandi opened 2 months ago

Zshandi commented 2 months ago

To allow for the ability to scale down even further, we need a way to scale more without physics breaking. The current limit to the scale is around 14 "zoom" (log scale), which corresponds to an actual scale value of 2^14. It scales exponentially, since otherwise it would feel like it slows down or speeds up as you get bigger or smaller.

  1. Log scale as first-class scale

One problem with the current system is that it calculates the log scale based on the current scale, by taking the logarithm of the scale value. This means that as the scale approaches the limits of precision, the log scale becomes less accurate as well. This also has an extra performance cost of calculating the log.

To solve both of these problems, we can actually store the current log scale as a variable, then calculate the scale from it using 2^log_scale. This should be added as a variable within the "Transformable" class (which should really be renamed something like "ScaleTarget"), to account for the second point below.

  1. Allow separate scale values for different parts of the level

Each level could be made of separate pieces, at least for the parts where you need to shrink down more. This way, the smaller parts of the level can be designed at a large scale and the start off scaled down. This way, there can be an area in the smaller structures within which you would safely be able to scale further without the physics going crazy (due floating point imprecision).

  1. Create variations of level components for different scales

This builds on the point 2, but also includes larger pieces as well. As you zoom in (i.e. scale the level up), the level itself becomes much larger than originally designed. It would be helpful to have the level, then, be made of smaller pieces once you get closer, which