Yesterday, 04:00 PM
Hello all,
I am in the process of implementing a speed lines shader to the stk-codebase. With this post I'm hoping to discuss the possibility of adding it to the game.
Intro
Speed lines (aka wind streaks) (see the videos below for more info) are quite a common feature in kart racing games, as the name suggests they come on screen when the player experiences a speed boost of some sorts, usually through an upgrade. I personally noticed them first in Mario Kart, but I've since gone and checked a few other kart racers (Sonic, Crash Team Racing etc.) and they all feature them in some capacity. The main purpose is to provide an extra sense of speed to the player, by mimicking wind rushing past at high speeds.
Shader
I initially started writing the effect purely in GLSL, but pivoted to using Godot's visual shader graph for quicker iteration. Before delving into more specifics here's what it looks like in isolation:
https://youtu.be/_1LBMsESjSQ
(or see next post for embedded view)
There are quite a few tweakable parameters for the shader. Ranging from:
Preview
Hooking up the shader and it's driving value -> BoostIntensity. We get something like the following:
(note the effect does look somewhat choppy due to the video quality, but is smooth during actual gameplay)
Implementation
I am still trialing the proper CPU side implementation, mainly on the 'how exactly' the effect should come in, how strong and how long should it last etc.
I've been experimenting with a few different options for the question 'how exactly'. Ranging from:
Closing Remarks
If this feature/effect looks of interest to you and would be a good fit for the game, let me know and I can clean up my code and start the PR. From there we can discuss further and iterate on feedback/suggestions.
PS: I did only notice at the posting of this post that there might be a related thread to another implementation of speed lines, my apologies there, but I do think we can work out a way to combine our efforts. https://forum.supertuxkart.net/thread-200.html
Thanks and kind regards,
stbdev
I am in the process of implementing a speed lines shader to the stk-codebase. With this post I'm hoping to discuss the possibility of adding it to the game.
Intro
Speed lines (aka wind streaks) (see the videos below for more info) are quite a common feature in kart racing games, as the name suggests they come on screen when the player experiences a speed boost of some sorts, usually through an upgrade. I personally noticed them first in Mario Kart, but I've since gone and checked a few other kart racers (Sonic, Crash Team Racing etc.) and they all feature them in some capacity. The main purpose is to provide an extra sense of speed to the player, by mimicking wind rushing past at high speeds.
Shader
I initially started writing the effect purely in GLSL, but pivoted to using Godot's visual shader graph for quicker iteration. Before delving into more specifics here's what it looks like in isolation:
https://youtu.be/_1LBMsESjSQ
(or see next post for embedded view)
There are quite a few tweakable parameters for the shader. Ranging from:
- Density of particles
- Softness of the particles
- Amount of wisps (i.e. how many subdivisions of the UV space to sample the noise texture from)
- Wind speed (very useful as we can tie the intensity of the boost to this)
- Radial stretch (how blobly should the wisps be, effectively stretches the uv.x coordinate)
- Radial mask size (how much of the screen should be ensure is always free of the effect - for gameplay purposes)
- etc.
- the wind speed
- size of the radial mask (make the mask a bit tighter at higher intensities to really bring home the sense of speed)
- color saturation (make the effect pop more at higher intensities, makes the wind feel more intense)
Preview
Hooking up the shader and it's driving value -> BoostIntensity. We get something like the following:
(note the effect does look somewhat choppy due to the video quality, but is smooth during actual gameplay)
Implementation
I am still trialing the proper CPU side implementation, mainly on the 'how exactly' the effect should come in, how strong and how long should it last etc.
I've been experimenting with a few different options for the question 'how exactly'. Ranging from:
- Should it come in mainly based on current velocity ratio with maximum velocity?
- Should it be on impulse/activation of a SpeedIncrease?
- Use the trigger of any SpeedIncrease modifier as the impulse
(as long as there's no active SpeedDecrease or Attachment like the anchor/parachute etc.).
- Then shortly driving up the value and overshooting slightly to a target value.
(make the impulse of the effect a tad stronger than it's sustained intensity).
- Then settle down the intensity value and base it on the ratio between the current speed and the maximum speed.
The last step here effectively helps tie the effect to match with the current speed regardless of difficulty setting.
- Then I use the already pre-existing unique duration(s) of the SpeedIncrease to keep the effect active.
- Once the SpeedIncrease runs out we linearly interpolate back down to 0 to gently ease out.
- There are also some provisions for correctly latching whether we've crashed into something, drastically lost speed or got hit with a SpeedDecrease to then directly ease down to 0 (rather than waiting for the effect to run out naturally).
- The effect does still ramp up to 1.0f quite fast at the moment, dialing this down is something I'm working on, it should only really be at 1.0f if we've stacked 2-3 speed increases and going fast (i.e. coming out of red skid + zipper + nitro should be 1).
- Once we crash the effect can come down just a tad faster in my book, at the moment it uses the same linear ease down to 0 as when the effect normally runs out.
- Certain SpeedIncrease items we can maybe experiment with not having it contribute to the intensity (i.e. turn it off for skids etc.?)
Closing Remarks
If this feature/effect looks of interest to you and would be a good fit for the game, let me know and I can clean up my code and start the PR. From there we can discuss further and iterate on feedback/suggestions.
PS: I did only notice at the posting of this post that there might be a related thread to another implementation of speed lines, my apologies there, but I do think we can work out a way to combine our efforts. https://forum.supertuxkart.net/thread-200.html
Thanks and kind regards,
stbdev


