mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
No description
1f5835c985
The previous fade system used only one variable, the amount of volume to fade per frame. However, this variable was an integer, meaning any decimal portion would be truncated, and would lead to a longer fade duration than intended. The fade per volume is calculated by doing MIX_MAX_VOLUME / (fade_ms / game.get_timestep()). MIX_MAX_VOLUME is 128, and game.get_timestep() is usually 34, so a 3000 millisecond fade would be calculated as 128 / (3000 / 34). 3000 / 34 is 88.235..., but that gets truncated to 88, and then 128 / 88 becomes 1.454545..., which then gets truncated to 1. This essentially means 1 is added to or subtracted from the volume every frame, and given that the max volume is 128, this means that the fade lasts for 128 frames. Now, instead of the fade duration lasting 3 seconds, the fade now lasts for 128 frames, which is 128 * 34 / 1000 = 4.352 seconds long. This could be fixed using floats, but when you introduce floats, you now have 1.9999998 problems. For instance, I'm concerned about floating-point determinism issues. What I've done instead is switch the system to use four different variables instead: the start volume, the end volume, the total duration, and the duration completed so far (called the "step"). For every frame, the game interpolates which value should be used based on the step, the total duration, and the start and end volumes, and then adds the timestep to the step. This way, fades will be correctly timed, and we don't have potential determinism issues. Doing this also fixes inaccuracies with the game timestep changing during the fade, since the timestep is only used in the calculation once at the beginning in the previous system. |
||
---|---|---|
.github | ||
desktop_version | ||
mobile_version | ||
third_party | ||
tools | ||
.gitattributes | ||
License exceptions.md | ||
LICENSE.md | ||
README.md |
This is the source code to VVVVVV, version 2.0+. For more context about this release, see the announcement on Terry's blog!
License
VVVVVV's source code is made available under a custom license. See LICENSE.md for more details.
In general, if you're interested in creating something that falls outside the license terms, get in touch with Terry and we'll talk about it!
Authors
- Created by Terry Cavanagh
- Room Names by Bennett Foddy
- Music by Magnus Pålsson
- Metal Soundtrack by FamilyJules
- 2.0 Update (C++ Port) by Simon Roth
- 2.2 Update (SDL2/PhysicsFS/Steamworks port) by Ethan Lee
- Beta Testing by Sam Kaplan and Pauli Kohberger
- Ending Picture by Pauli Kohberger
Versions
There are two versions of the VVVVVV source code available - the desktop version (based on the C++ port, and currently live on Steam), and the mobile version (based on a fork of the original flash source code, and currently live on iOS and Android).