• Welcome to MX Bikes Official Forum. Please login or sign up.
September 20, 2020, 03:33:31 AM


MX Bikes beta14e available! :)

MaxHUD plugin

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

Previous topic - Next topic


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:


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.


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!


Thanks for adding longer lap time capabilities!