Audiosurf 2

Audiosurf 2

perfection redux
43TH3R  [developer] 13 Jul, 2016 @ 11:05am
How the track works
You may be surprised that the road gets rendered along the entire track, even on long songs.

As with all rails, you can set the fullfuture option to true, which does exactly this - makes them render all along the track. But with one exception. When the track is long, AS2 overrides fullfuture for performance reasons. Very long rails are made up from a lot of polygons, which becomes fairly resource-intensive to render.

I was messing around a bit with this and found out, that the override has one key feature:
  • It's done on a per-rail basis - The more complex rails might get cut off while simpler rails still get to keep their fullfuture on.

What is a "more complex rail"? Simply, it's a rail that has more complex cross-section.

Rails are defined by setting a number of points, which specify the rails shape. This shape is then extruded along the track. If you define 4 points, there will be 4 lines extruded. The actual amount of polygons the rail is made of will be even larger (because the rail twists with the track), but that does not matter.

The important part is, that rails with lower number of points have less polygons, and thus get cut off on longer songs than more complex rails.

As an example, the road in this skin could be made out of 2 parts - white surface (2-point rail) and the black shell (8 points because of the "walls" on the sides). On short songs (around 3 minutes) the road surface rendered in fullfuture, but the shell got cut off.

However, the shell is not made out of a single 8-point rail. It consists of seven 2-point rails (don't need the extra under road surface). Since the rails have only 2 faces each, they don't get cut off even on 8 minute songs.

This workaround makes the track still render in fullfuture, but it has one serious drawback. The 8-point rail had 8 faces - 7 between the points and the last one to close the shape. Seven 2-point rails have 14 faces in total (the shell also has faces on the inside). Even though you manage to trick AS2 to render a rail that would normally get cut off, in the end it has more polygons than the original one.

Taking my low-mid spec laptop as an example: 8-point rail had well above 150 fps on all lengths of songs, but it wasn't fullfuture at all. Seven 2-point rails are fullfuture on almost everything, but the performance reduces. 4 minute songs still play on ~140 fps, but 6 minute songs drop down below 90.