[Reusable] Kart Slipstream / Drafting

This thread contains content that may be reused, modified, or ported by anyone.

Ashnal

Member
This adds Mario Kart styled Slipstreaming/Drafting to SRB2Kart!

Draft (follow) behind another racer to gain a tiny speed boost and gain small grey speed lines.
Do this for long enough, and you'll charge a full Slipstream, resulting in a boost to your top speed, and character skin colored speed lines.

The attached gifs explain better than words can, so take a look!

A common Slipstream slingshot:
BlazeSlipstream.gif
But watch out, following other players can be dangerous. Risk vs. reward:
LilicSlipstreamJawz.gif

Mechanics to be aware of:
- The default angle tolerance is 10 degrees. This means the person in front of you can be at most 10 degrees off from your heading for drafting to occur.
- Slipstream mostly increases your speed, but not acceleration. This means acceleration characters tend to make better use of it.
- Pre-Slipstream drafting gives a small speed boost scaled by speed stat to help acceleration characters with tailing speed characters. It scales from 15% at 1 speed to 0% at 9 speed.
- The full Slipstream speedboost is 50% (sneaker) for a speed 1 character and 25% (miniturbo) for a speed 9 character. Other speed stats fall linearly between. This may seem powerful, but since the acceleration boost (10%) is minimal it takes a second to kick in, and is less instant than a sneaker or miniturbo, which boost your acceleration a lot.
- You can't charge Slipstream while either racer is ghosting or airborne, or while you are drifting.

Almost all aspects of this script can be tweaked.
Full cvar list, with defaults:
- slipstream_enabled, on: Turns the whole script on/off
- slipstream_colorized, on: makes the full slipstream colored with skin color. Off will make the full lines grey like the small ones. not a netvar.
- slipstream_reminder, on: A chat reminder of the mechanic, not a netvar.
- slipstream_maxdistance, 1500: Max distance between you and another racer for valid slipstreaming. In Fracunits.
- slipstream_t2chargedist, 1050: At less than this distance you charge a full slipstream twice as fast. In Fracunits.
- slipstream_t3chargedist, 400: At less than this distance you charge a full slipstream thrice as fast. In Fracunits.
- slipstream_maxangle, ANG10: Angle from your heading any racer must be for valid slipstreaming, expressed as a fixed number.
- slipstream_chargetoboost, 122: How much drafting time is required to charge a full slipstream. 1 per tic at max distance.
- slipstream_boosttime, 70: How long the Slipstream boost lasts after you're no longer drafting, -1 per tic.
- slipstream_minimumspeed. 32: The minimum speed in FracUnits/Tic that both you and your opponent must be going for drafting to occur.
- slipstream_maxspeedboostpercent, 50: The speed boost a speed 1 character gets when Slipstreaming.
- slipstream_minspeedboostpercent, 25: The speed boost a speed 9 (or higher) character gets when Slipstreaming.
- slipstream_accelboostpercent, 10: The acceleration boost all characters get when Slipstreaming.
- slipstream_maxdraftspeedboostpercent, 15: The speed boost a speed 1 character gets for drafting.
- slipstream_mindraftspeedboostpercent, 0: The speed boost a speed 9 (or higher) character gets for drafting.

I originally modeled this after Mario Kart Wii, before tethering in Kart was announced. Any similarities to the tethering teaser are coincidental.
Thanks to Purpsky, who helped me test this in the later stages, and DarkyBenji, who recorded the nice gifs you see here.
 

Attachments

  • Slipstream03.gif
    Slipstream03.gif
    7.2 MB · Views: 276
  • Slipstream04.gif
    Slipstream04.gif
    6.3 MB · Views: 212
  • KL_Slipstream-v3.lua
    12 KB · Views: 582
Last edited:

Ashnal

Member
Updated to v2.
- Fixed speed stat scaling to work as intended.
- Removed colorized flashing.
- Added dust to wheels ... Thanks Purpsky for adapting this code.
 
Last edited:

Ashnal

Member
Small tuning update for v3,
some defaults adjusted:

- slipstream_maxangle adjusted up to 14 degrees from 10
This should make it a little easier to get slipstream without pointing directly at another racer

- slipstream_chargetoboost to 3 seconds from 3.5 seconds
get the impactful boost a little sooner

- slipstream_minimumspeed adjusted down to 30 FU/T
just makin it a little easier
 
Top