Skip to content

Instantly share code, notes, and snippets.

@Voyager006
Last active December 15, 2020 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Voyager006/a45cf9ca03019a70cf754399fa8edcd5 to your computer and use it in GitHub Desktop.
Save Voyager006/a45cf9ca03019a70cf754399fa8edcd5 to your computer and use it in GitHub Desktop.

GeryKnockout plugin 2.0.0 release notes

The new plugin brings a vastly improved experience to the weekly knockout with new features and bug fixes. Supported game modes are currently Rounds and Time Attack.

New features

Allow knocked out players to drive in warmups

What you all have been waiting for. Anyone can come and play the warmups during a knockout. If you are knocked out and prefer to spec, you can go to spectator mode during a warmup and remain in spec for the rest of the knockout.

Automatic forceplay when someone who should be forced in the knockout joins the server

Players who are eligible to be forced back into the knockout, will be. If you happen to disconnect, you'll be able to rejoin until the next live round has ended. This means you can still rejoin after the warmup, but then with a late start.

Look Mom, no password!

The new plugin removes the need for setting a password on the server. When joining the server, you'll be forced in if eligible and forced to spec otherwise, regardless if you join as spec or not. If you're too late and join as a spectator, you'll stay as a spectator. That is, until you leave spec mode during a warmup phase.

Fair for everyone

Thanks to a new algorithm by Solux, the number of KOs per round will be more forgiving for the less skilled players. If we're more than 21 players, the knockout will start off with 1 KO per round, then progressively increase the number of KOs per round before gradually going back to 1 KO for the final rounds, all while aiming for a specific number of rounds in total. More on this below.

Automatic skip if track author is in the knockout

When proceeding to the next track, and with 7 or less players in the knockout (by default), the plugin will skip the next track if the author is still in.

Used the wrong key to skip the intro?

If someone retires before the race starts, and false start detection is on, the round will be restarted. But not for warmups!

Introducing tiebreakers

Whenever two or more players tie and only some of them are subject to getting knocked out, the script will restart the current track with the tied players only, and other players who are still in are temporarily put to spec. Once the tiebreaker ends, the knockout resumes as normal on the next round. This is a rather experimental feature so expect it to break!

New HUD

Things can get a bit hairy when everyone suddenly starts playing in the warmups. Now, a status bar is shown at the top part of the screen showing knockout information and your player status. This can be disabled by clicking the Tm-Gery button on the top left - in that case, the knockout information will be shown in chat instead. The update also introduces a scoreboard that will show who's getting knocked out and who's dangerously close. It will show 10 scores, and if there are more players then it will be limited to top 3 and bottom 7.

Support for multiple rounds per track

KOs will be performed for each round, with every surviving player given 1 point.

Opt out of a knockout

You may now use /opt out if you don't want to participate in a knockout once it is scheduled to start and when it is running. If you're eligible to rejoin, you'll have limited time to opt back in using /opt in if you change your mind.

Smashing 9 year old bugs

  • Fixed bug where the script will KO everyone if it didn't execute until next track.
  • Fixed bug where a player that has been forced in during warmup is not knocked out if last.
  • Fixed bug where forcing a player in as the third player will end the knockout afterwards.
  • Partially patched vulnerability where the script will KO everyone if /restart or /gonext is used. There will be no KO's as long as no one has finished yet.
  • Fixed bug where the winner of a previous knockout would be crowned as the winner when stopping a knockout manually.
  • Several other bugfixes.

How the dynamic multiplier works

The new dynamic KO multiplier is much more advanced than what we have used so far, so let's take a moment to see how it works. In essence, it is about approximating the total number of KOs such that the total number of rounds equals the desired number of rounds.

First, a base curve base_curve(r) is defined. It defines the relative amount of additional KOs per round r over the baseline of 1 KO/round.

A graph of the base curve

Then, the goal is to find a discretized, scaled curve c[r] = [a * base_curve(r)] + 1 such that the sum over c[r] for all rounds equals the total number of KOs to be performed. This is done by approximation; we start off with an initial value of a and calculate the sum of c[r]. If the sum is too small, a is incremented; too big and a is decremented. This is repeated until we find a value for a of which the sum of c[r] equals the total number of KOs.

With 40 players, 20 rounds and no unexpected KOs, the number of KOs/round and overall player count will look like the following:

Graphs showing player count and KOs per round with no unexpected KOs

Each round, the curve is recalculated to adjust for any inaccuracies. In the case of a mass KO, the curve adjusts itself because the remaining number of KOs becomes reduced, thus leading to a more straightened curve. The graphs below show how, in the same 40 player knockout, the curve is adjusted after a round with 4 additional DNFs (7 players knocked out):

Graphs showing player count and KOs per round with unexpected KOs

The base curve is defined in a way that there will always be 1 KO for the last 4-5 rounds, regardless of the player and KO count. Whether it will be 4 or 5 rounds depends on the possible solutions for the scaled curve. Because of the fact that we deal with discrete space, there is a small chance that the curve may not be solvable. In this case, the curve is readjusted ("smoothed") by 1 KO for that round only.

Using this approach, we can observe that the number of KOs/round will increase and decrease steadily; the number of KOs/round will not increase, then decrease, then increase again (and vice versa), unless there are unexpected KOs.

The team

Thanks to...

  • MrA for suggesting a progressive KO multiplier
  • Dennis for suggesting the syntax for the /ko lives command
  • Realspace for suggesting the tiebreaker mode
  • CavalierDeVache for the original plugin
  • Mikey for the original concept (Madhouse Knockout)
  • All the hosters of the TMX Knockout for keeping it running throughout the years
  • And everyone who joined the TMX Knockout server to help testing out the plugin!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment