Add the digital speedometer back in (with patch and images)

Add the digital speedometer back in (with patch and images)

Postby Worldblender » 03 May 2019, 11:38

I've asked about this years ago when 0.9 was in development, but this time I decided to become proactive to satisfy this myself. I created a patch file that returns the digital speedometer that last appeared in 0.8.1. It must be applied to the STK source code for it to have any effect. The following is changed with this patch:
  • The digital speedometer is added back in, this time in normal-sized font and with meters per second unit (displayed as "m/s"). It also uses a black border to make it easier to see this value, and it is now one digit precise after the decimal point.
  • The rank number is not removed.
  • The speedometer does not display if a kart is not driving forward, same as from 0.8.1.
  • The digital speedometer is now placed above the graphical one, no longer sharing space with the rank number. It now shows meters/second, kllometer/hour, feet/second, mile/hour. For now, both metric and imperial units are shown.

After applying this code, I discovered the average numeric speeds of all three kart classes (all of them were obtained using the SuperTux difficulty):
  • Heavy: 26.2 m/s
  • Medium: 25.0 m/s
  • Light: 23.8 m/s

Here is the patch itself, now online at https://gitlab.com/snippets/1866881, where it will receive changes to continue working in the latest STK dev versions.

Below are screenshots showing this patch in action (note that I have changed the code to display the speed as a decimal since taking these screenshots).
tutorial-2019.05.03_17.55.41.png

tutorial-2019.05.03_17.54.07.png

tutorial-2019.05.03_17.53.58.png


At least now I can tell exactly how fast karts are driving! Later on, I can add a setting to toggle the units shown, but I don't want to make too many drastic changes for now. I barely started exploring the STK source code, so anything else I would like to do, I need to familiarize myself with.
Last edited by Worldblender on 17 Jun 2019, 02:32, edited 4 times in total.
User avatar
Worldblender
 
Posts: 99
Joined: 15 Aug 2014, 18:46
Location: Houston, Texas, United States

Re: Add the digital speedometer back in (with patch and imag

Postby GeekPenguinBR » 03 May 2019, 18:39

Hi! Worldblender,

It's a nice feature. As said by you, the old 0.6, 0.7, 0.8 and their intermediate versions had it. For those who started playing STK in recent years:
https://www.youtube.com/watch?v=lxO76p8_Gt0
https://www.youtube.com/watch?v=SGZuUzdCW78
https://www.youtube.com/watch?v=b-zOscd_BtE

How do exactly you calculate the speed? That average speeds seem a bit high, no?

Good job, anyway. I like the speedometer.
"Making cool harmless games makes the world a better place".
User avatar
GeekPenguinBR
 
Posts: 466
Joined: 22 Mar 2014, 00:41
Location: Rio de Janeiro

Re: Add the digital speedometer back in (with patch and imag

Postby Alayan » 03 May 2019, 20:25

250m/s is the same as 900km/h. Let me tell you, STK's karts don't have jet reactors. There is no basis to have internal speed*10 as the speed in meter/s.

Otherwise, well it's a nice patch for these who appreciate a numerical speedometer. The main indicator is much more accurate than in 0.9.3 and also covers a higher maximal top speed, so I'm happy enough with it. Knowing the exact numerical number is much less useful for a human than it can be for an AI.
Image
Alayan
STK Moderator
 
Posts: 306
Joined: 25 Mar 2012, 22:11

Re: Add the digital speedometer back in (with patch and imag

Postby GeekPenguinBR » 03 May 2019, 21:13

The current one is nice and I don't see a problem with this way to show how fast the karts go on. However, for psychological reasons, the speedometer is better for many people.

Upon the estimated speed: I use a mental estimate based on the distance compared to the average size of a kart. In order to obtain the speed, I assume the karts (Tux, for example) as 1,5 m equivalent to a kart in the real World and mentally I calculate how many karts length the kart travels with 1 second, or the contrary, how many seconds, in supertux or expert mode, a kart takes to run the length of a (for instance, a container) building or any other object that I suppose to know the length. Eg. 1 container/sec = 12 meters/sec = approx. 43 km/h. This is a useful device that allows planning a track before start modeling since I know how many seconds will last one lap, but it's not precise or definitive, of course. Just a way to know previously if a track will last 1:30 instead of 1:00 Sec.
"Making cool harmless games makes the world a better place".
User avatar
GeekPenguinBR
 
Posts: 466
Joined: 22 Mar 2014, 00:41
Location: Rio de Janeiro

Re: Add the digital speedometer back in (with patch and imag

Postby eltomito » 03 May 2019, 22:25

Worldblender {l Wrote}:
  • Heavy: 262.5 m/s


So when a heavy kart goes really fast, we should hear the supersonic boom, shouldn't we? :lol:

What about dividing the number by 10? Or dividing it by 10 and showing it in km/h which would turn 262.5 into 94.5 km/h ?
User avatar
eltomito
 
Posts: 300
Joined: 15 Mar 2013, 09:25

Re: Add the digital speedometer back in (with patch and imag

Postby GeekPenguinBR » 03 May 2019, 22:30

eltomito {l Wrote}:
Worldblender {l Wrote}:
  • Heavy: 262.5 m/s


So when a heavy kart goes really fast, we should hear the supersonic boom, shouldn't we? :lol:


When it reaches 300 m/s. :lol:

https://www.youtube.com/watch?v=ULtnoP1M7t8
"Making cool harmless games makes the world a better place".
User avatar
GeekPenguinBR
 
Posts: 466
Joined: 22 Mar 2014, 00:41
Location: Rio de Janeiro

Re: Add the digital speedometer back in (with patch and imag

Postby QwertyChouskie » 03 May 2019, 22:43

Changing
{l Code}: {l Select All Code}
speed*10
to just
{l Code}: {l Select All Code}
speed
seems much more reasonable. 56 MPH (90km/h) seems plausible for a medium weight class kart in SuperTux mode (I assume those numbers were measured in SuperTux mode?)
Contributor to/fan of STK (Upstreamed Cartoon theme, numerous random big fixes/tweaks)
User avatar
QwertyChouskie
 
Posts: 559
Joined: 29 Jun 2016, 14:57

Re: Add the digital speedometer back in (with patch and imag

Postby Worldblender » 03 May 2019, 22:53

Wait a few moments. I will update the patch to place the digital speedometer above the graphical one, so that the rank number doesn't need relocation. Additionally, I may add in a speedometer for imperial units depending on how much room is left.
User avatar
Worldblender
 
Posts: 99
Joined: 15 Aug 2014, 18:46
Location: Houston, Texas, United States

Re: Add the digital speedometer back in (with patch and imag

Postby tempAnon093 » 04 May 2019, 00:59

GeekPenguinBR {l Wrote}:When it reaches 300 m/s. :lol:

https://www.youtube.com/watch?v=ULtnoP1M7t8


When this kart reaches 88mph... you're gonna see some serious skids.
aka. GumballForAPenny
User avatar
tempAnon093
 
Posts: 416
Joined: 02 Feb 2019, 12:09

Re: Add the digital speedometer back in (with patch and imag

Postby tempAnon093 » 04 May 2019, 01:39

Worldblender {l Wrote}:Additionally, I may add in a speedometer for imperial units depending on how much room is left.

I don't think showing two at the same time is a good idea, maybe a config entry or a boolean variable in code to choose between imperial and metric?
aka. GumballForAPenny
User avatar
tempAnon093
 
Posts: 416
Joined: 02 Feb 2019, 12:09

Re: Add the digital speedometer back in (with patch and imag

Postby Worldblender » 04 May 2019, 02:24

Okay, I updated the patch as I promised, and the screenshots have been replaced to reflect the new state. I think I might be reaching a better state, save for adding code that can toggle which units are shown.
User avatar
Worldblender
 
Posts: 99
Joined: 15 Aug 2014, 18:46
Location: Houston, Texas, United States

Re: Add the digital speedometer back in (with patch and imag

Postby GunChleoc » 04 May 2019, 16:12

tempAnon093 {l Wrote}:
Worldblender {l Wrote}:Additionally, I may add in a speedometer for imperial units depending on how much room is left.

I don't think showing two at the same time is a good idea, maybe a config entry or a boolean variable in code to choose between imperial and metric?

How about letting translators decide that? So, en_US locale would show mph, but de_DE locale would show km/h.
User avatar
GunChleoc
 
Posts: 502
Joined: 20 Sep 2012, 22:45

Re: Add the digital speedometer back in (with patch and imag

Postby tempAnon093 » 05 May 2019, 01:51

GunChleoc {l Wrote}:How about letting translators decide that? So, en_US locale would show mph, but de_DE locale would show km/h.

That sounds like a great idea. I haven't written STK code so I don't know the details, but if that variable (or a config option automatically derived from it, eg "units") can be referenced when calculating units then should be accurate without requiring user interaction.
aka. GumballForAPenny
User avatar
tempAnon093
 
Posts: 416
Joined: 02 Feb 2019, 12:09

Re: Add the digital speedometer back in (with patch and imag

Postby Worldblender » 17 Jun 2019, 02:34

Some recent commits have broke the previous version of this patch (both lines were in the same place, making the values hard to read), so I had to fix it. Instead of posting new versions here, this patch will now be available at https://gitlab.com/snippets/1866881, where it can be continuously updated.
User avatar
Worldblender
 
Posts: 99
Joined: 15 Aug 2014, 18:46
Location: Houston, Texas, United States

Re: Add the digital speedometer back in (with patch and imag

Postby Worldblender » 31 Jan 2021, 07:58

I found some more time today to finish up work on a digital speedometer, its pull request is at https://github.com/supertuxkart/stk-code/pull/4476

Restores and revamps the digital speedometer last seen in STK 0.8.1. It is placed above the current speedometer; its original place is taken by rank number. It can be toggled to show metric and/or imperial units, or be disabled entirely. The latter is the default behavior in new config files, preserving the current behavior while keeping the digital speedometer an option for those who want it. There are now vertical lines that clearly separate each unit to make them easier to discern. Additional options will be written to existing config files, with the default value of None. This unit option is currently not used anywhere else. an additional tip is added to remind users of this new feature.
Options:
  • None (default)
  • Metric
  • Imperial
  • Both (Metric on top)
  • Both (Imperial on top)
Also fix a minor issue for the comment with difficulty not showing SuperTux mode in the config.xml file.
User avatar
Worldblender
 
Posts: 99
Joined: 15 Aug 2014, 18:46
Location: Houston, Texas, United States

Who is online

Users browsing this forum: No registered users and 1 guest