• Welcome to MX Bikes Official Forum. Please login or sign up.
 
December 05, 2020, 03:12:57 AM

News:

MX Bikes beta15b available! :)


MaxHUD plugin

Started by HornetMaX, October 01, 2014, 11:02:44 PM

Previous topic - Next topic

HornetMaX

Quote from: iNsane | WW on July 05, 2020, 09:55:22 PMhey Max, while we are testing Erzberg which was the reason MXB got support for +50 Checkpoints, the plugin makes the game laggy as hell.
Someone with AMD setup got 15 fps, I had 30-40. Removing MaxHUD resolved the issue, AMD has 80 fps and I with everything maxed out suddenly have 80-100 fps.
OK, I had a look, here are my findings.

  • On my systems (i5-9600K, RTX 2070 super, 3440x1440, all MXB settings maxed out except AA at 8x) my fps at Kreken (start point) drop from ~170 (no plugin) to ~70 with the plugin. Ouch.
  • If I compile the plugin without the HUDMap widget, I get ~160fps so the problem, as expected, is in HUDMap due to the very long and twisty track.

The main reason is that HUDMap takes the track centerline (straights + arcs) and approximates it with straights only: in doing this, the number of centerline segments goes up, e.g. for Kraken the centerline has 1493 segments (469 straights and 1024 arcs) but after approximation I have 7041 straight segments.

Now for each segment I draw 4 quads: 1 rectangle for the "main segment" and 1 wider rectangle wider to have the track borders, plus 1 triangle joining two consecutive rectangles in a turn (and another "wider" triangle for the track border). Bottom line, that makes 28K quads and that maybe too much.

One thing you try immediately is edit the MaxHUD.ini file, find the [HUDMap] section in it. It should be as below:

[HUDMap]
_ini_version=2
_enabled={1,1,1}
_pos_x={0.721875,0.721875,0.721875}
_pos_Y={0.123611,0.123611,0.123611}
_pos_linked=1
_optlinked=1023
_color_back=[200,0,0,0]
_color_track=[255,0,0,0]
_color_trackborder=[255,230,230,230]
_color_me=[150,0,0,200]
_color_others=[150,0,128,205]
size={3,3,3}
rotate={0,0,0}
range={1,1,1}
show_racenums={1,1,1}
show_range={1,1,1}
track_width={5,5,5}
trackborder_width={1,1,1}
show_background={1,1,1}

In it, you can add these two lines:

_abserr = 0.500
_relerr = 0.002

The above values are the default ones. If I change _relerr to 0.020 (instead of 0.002) I get 120fps (instead of 70) for 3183 centerline segments (instead of 7041) and 12788 quads (instead of 28220). Of course in HUDMap, if you zoom a lot, the turns will be less smooth than before.

Explanations of the two parameters: the plugin needs to decide how many straight segments to use to approximate one arc. It picks the numebr of segs so that the error (distance between the "true" centerline arc and the sequence of approximating segments) is below a value. The value is dictated by the two parameters:
  • _abserr is absolute error, in meters (default - 0.5m).
  • _relerr is relative error: you multiply it by the arc radius and you get an absolute error (default = 0.002 means that for a turn with a radius of 4 meters, the allowed error is 4 * 0.002 = 8mm).
  • The min of the two errors is used.

So you can play with the values, that should help a bit.

On my side I can probaly cut the number of drawn quads by a factor 2, drawing a trapezoid instead of a rectangle + a triangle. That's on my todo list :)

Final word, I really think Piboso should have the HUDMap feature in MXB & co: surely he'd do it 10 times better and in a way more efficient manner.

HornetMaX

V2.2.1 out (2020/08/11)
  • Reduced by 50% the number of quads used by HUDMap: fps impact of MaxHUD should be lowered (especially on long tracks / low-spec systems).
  • All timings can now display longer times / gaps.
  • HUDLiveGapBar has now more options for its scale (can be longer, for veeery long tracks).

Resolute Kraken

Thanks for the update!

okwes

Thanks for adding longer lap time capabilities!

BlizzardDUCK

I'm stuck on the install.

QuoteCopy the MaxHUD_data folder and the relevant .dlo file (e.g. MaxHUD_GPB64.dlo for GPB) to
the game's plugins folder, which is (depending on the game):
● C:\Program Files\GP Bikes\gpbikes\plugins
● C:\Program Files\World Racing Series\wrs\plugins
● C:\Program Files\Kart Racing Pro\plugins
● C:\Program Files\MX Bikes\plugins

The plugin creates a MaxHUD.ini file in the data directory corresponding to the game:
● C:\Users\<Your Windows Username>\Documents\PiBoSo\GP Bikes\
● C:\Users\<Your Windows Username>\Documents\PiBoSo\World Racing Series\
● C:\Users\<Your Windows Username>\Documents\PiBoSo\Kart Racing Pro\
● C:\Users\<Your Windows Username>\Documents\PiBoSo\MX Bikes\
or simply in the game directory if you're using "compatibility mode".

I'm not getting that plugin to show up. I see the redistributable package x64 below, but that install doesn't work for me. Says Setup Failed, another version of this product is already installed and it cannot continue to install the file. What do I need to do?

HornetMaX

Quote from: BlizzardDUCK on November 08, 2020, 09:20:49 PMI'm not getting that plugin to show up. I see the redistributable package x64 below, but that install doesn't work for me. Says Setup Failed, another version of this product is already installed and it cannot continue to install the file. What do I need to do?

Try this one: https://aka.ms/vs/16/release/vc_redist.x64.exe
It's the x64 for 2015, 2017 and 2019 from that page: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

If still won't install, uninstall what you have (2015, 2017, 2019) and install the new one.

BlizzardDUCK

Quote from: HornetMaX on November 10, 2020, 05:20:58 PM
Quote from: BlizzardDUCK on November 08, 2020, 09:20:49 PMI'm not getting that plugin to show up. I see the redistributable package x64 below, but that install doesn't work for me. Says Setup Failed, another version of this product is already installed and it cannot continue to install the file. What do I need to do?

Try this one: https://aka.ms/vs/16/release/vc_redist.x64.exe
It's the x64 for 2015, 2017 and 2019 from that page: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

If still won't install, uninstall what you have (2015, 2017, 2019) and install the new one.

Thanks so much, that fixed it and I got it working.

Midbeck

I have problems getting the rumble function to work, is there any known issues with it or is it just me?
#DirtyEuro

Butifarra

The inmersion is real, my foots kicking the floor sometimes.  ;)

HornetMaX

Quote from: Midbeck on November 28, 2020, 11:22:29 PMI have problems getting the rumble function to work, is there any known issues with it or is it just me?
You have to tell the plugin which joypad you want the rumble on. Did you do that ?

Midbeck

Quote from: HornetMaX on December 03, 2020, 02:51:42 PM
Quote from: Midbeck on November 28, 2020, 11:22:29 PMI have problems getting the rumble function to work, is there any known issues with it or is it just me?
You have to tell the plugin which joypad you want the rumble on. Did you do that ?
I forgot to update my post here on the forums, my bad on that one. I had x360ce installed and after i removed it, everything worked as it should.
#DirtyEuro