The FEEL Branch (of Speed)
#1
*Editing post after chatting and re-reviewing my code. Paired down to only speed lines!*

First off, happy new year all! I am writing this forum post at least partially on the 31st at 4PM! 

I am pretty new to this project. The last game project I was working on announced they wouldn't be supporting Linux going forward, and that was a deal breaker. In finding a new project to contribute to, I found an amazing fun game to play! I really appreciate what everyone here is building. 

I am also kadajett on Discord, so come and say hello! I have introduced myself there as much as possible in such a short time! 

So, WHAT IS THE FEEL?

I started out playing the version of the game that is on the master branch. It was fun, but there were some quirks. I set out to find bugs that other people had posted first, with a goal of learning the codebase enough to form an opinion, and maybe fix some stuff. 
A few days in after discovering the beautiful BalanceSTK2 branch, I learned how most of the kart, physics, map normal stuff, etc worked. With that, I started to play around with some minimal UI additions, not meant to modify gameplay at all, but meant to improve the feeling of the game. Make things feel more impactful. When you are hit, it should feel like you are hit! When you hit a zipper, you should feel like you are moving FAST. in addition to a few more things, I worked on a few new shaders to help see items on the track with my 5k widescreen, as the outlines were almost invisible. Turns out, someone had already posted an issue about this in github, so maybe I did the right thing! 

Before I continue, I wanted to say that the goal of this post is to see what you all think! We can talk game design, or we can talk tech. I am happy to talk through either, since I am so new to this project, I have no right to a strongly held opinion! 

what did I do?



Camera pulls back slightly during boosts

During boosts, the camera briefly pulls back to enhance the "speed" sensation, then smoothly returns.
Parameters:
  - Max FOV increase: 8 degrees
  - Speed threshold: 70% of max speed
  - Lerp speed: 4.0 (smooth interpolation)

  How it works:
  1. Calculate speed_factor = (speed_ratio - 0.7) / 0.3
  2. During boost, add extra factor (0.3 for nitro, 0.5 for zipper)
  3. Lerp toward target FOV each frame
  4. Result: subtle widening at high speed, more pronounced during boosts

Speed lines appear during nitro/zipper/skid boosts
Seen above! 
You can see in the boost. This one is all technical, so I apologize. 
For the non-technical, this is a boolean value based on whether the character is boosting, and what caused it. You could think of it like this equation, but you would be wrong. lol

`an=vn−vn−1`
It is far simpler. I did go the calculation route early on, but is wasn't as satisfying, as you could hit multiple zippers and sit at your max speed and never see the lines. This way, you feel FAST when you do something that should make you go FAST.


How it actually works:
Speed Lines Shader (speed_lines.frag)

Trigger: onBoostActivated() callback sets intensity

Uniforms:
- speed_intensity [0.0-1.0]: Line density and length
- boost_intensity [0.0-1.0]: Purple tint amount
- time: Animation driver
- center: Screen center (where kart is)
- inner_radius: Where lines start fading in

1. Calculate angle from screen center for each pixel
2. Divide into 60-100 radial sections (more sections at higher intensity)
3. Per-section random offset for non-uniform appearance
4. Smoothstep for anti-aliased line edges
5. Radial falloff: lines stronger at screen edges, invisible near center
6. Animation: lines move outward, fade in/out over time
7. Three layers blended for depth (60%, 30%, 20% weights)
8. At high boost intensity (>0.3): adds subtle chromatic aberration

Happy new year, everyone! 
Small tidbit, moving from JS and C#, C++ here was weird. The observer pattern was new to me, but not completely foreign. Fun to learn, at least! 
Reply
#2
Ok, its been a while since I have used forums. I forgot they don't persist their own images well. Here is a link to the discord video. Not as fancy as a bunch of gifs, but not bad. 

Reply
#3
The slipstream when going fast is a really cool idea, but the additional thing you did for the shake implementation (which someone already did) is bad. In my honest opinion, I think the shake should only work when you are near a hit kart or after an explosion. In my honest opinion, I'd rate this a 1.5/2.
Reply
#4


PR for this one, for those who are interested! https://github.com/supertuxkart/stk-code/pull/5609
Reply
#5
Hi Kadajett,
it's nice to see new people being interested in the game and creating new things for it! :)

The boost lines are interesting as a concept.
I think it would be cool to have something like that in the game but the current implementation doesn't look great imo.
- it's too distracting, the way it appears takes too much of the players attention
- imo the amount of arrows is too much and they are too opaque
- the arrows move too quickly

I have not really looked into this effect yet, but I would assume that what you really want to achieve is the feel of driving by the lines very quickly. Currently it looks more like jittering which doesn't quite do the trick.

I think it would also be good to have a change in intensity depending on how many speed boosts get used at once.
Having a drift boost is the normal condition for good players and it shouldn't already create the full effect.
Reply
#6
Thanks for the feedback! I agree with you, of course. 

I went the screen shader route, which gives a decent amount of flexibility with decent performance on the devices I tested on (Intel Arc, and gtx3050). However, I think that animated sprite sheets might give a bit more control over the look. I will continue to play around with it though, now that I have battle tested the logic over a few days.

The overworld demo doesn't really demonstrate the nuance(or lack of) with the intensity logic. Its a combination of boost type, boost stacking, and acceleration/dt keeping in mind max speed. I.E. if you are on the forest map with the stacked zippers, that will easily get you to max speed. The last zipper does not trigger the boost effect, which made sense to me. 

Here is a video in-race. Keep in mind, I am terrible at the game so far. I am only 1.5 weeks in, and I have spent much more time reading the code than playing Big Grin 

The PR needs heavy scrutiny though, since I haven't written C++ in over a decade.



[Image: SvhuGdG.png]

[Image: bYpeJnN.png]
Reply


Forum Jump: