Player Selection

Introduction

A lot of people are curious as to how people get selected to play. Well if you've ever had one of these thoughts...

"I haven't gone yet, and I've traded him, what gives?"

"How come that guy has gone like 20,000 times?"

"Lmao Rigged."

... Then this is the perfect place to learn all about the inner workings of the Python application itself. And it all starts with a single trade.
-

Creating a List of Players

First thing's first. In order to choose which player gets to go, I need to actually have a pool of players to choose from. In order for me to create this pool of players, I needed to somehow transfer your desire to play, to a variable with your name.

Trading was the perfect solution to keep track of these "entries" into the game, as trading me provided me with your willingness to play, AND your name!

So! The Chat Notifications plugin for RuneLite was edited specifically for this function.
The Chat Notifications plugin has the feature of sending you a notification on your computer if somebody sends you a trade request.

I made an ever so slight tweak to the already existing code to, instead of sending me a notification, take the name of the person who traded me, and write that name as a line in a file.

RuneLite writes your name to a file when you trade me

-

From there, the main Python application reads the file of names, sorts through all of them and removes any duplicates to prepare a list of unique players. This list is called New Players.

The file made by RuneLite is read by the Python application and makes New Players

-

Once the list is completed, every time I go to select a new player, the application and chooses the first name that shows up in New Players. So currently, the fist person to trade me will be the first person to roll, and the second will be second etc. I haven't decided if I'm going to keep it this way.

When a player is selected, their name is removed from New Players, so they're not selected again before actual new players, and put on two new lists: Previous Players and The Queue.

The Python application's code selects the 1st person on the New Players list. It then removes them from the New Players list and puts them on the Previous Players list and The Queue

-

The Queue

The Queue's job is essentially to make sure a player can't be selected multiple times in a short amount of time.

Think of The Queue as a line of players who don't have a chance to be rolled again when the Python application selects the next player. The line is only 6 players long, though.

When someone is added to The Queue, that player is put at the end of the line, and whoever was waiting at the front of the line is removed, enabling them to potentially be selected for the next roll.

-

-

Re-Rolling Players

Once there are no more players in New Players, in order to keep things fresh and interesting, I will re-roll players that have already gone.

Wealth Groups

Re-rolling is done by pooling every player that is in Previous Players together into separate Wealth Groups based on how much they have won during the current session of the game.

These Wealth Groups are:

High Group | 250,000gp +

Medium Group | 50,000 - 249,999gp

Low Group | 0 - 49,999gp

-

After everyone is in their Wealth Group, the Python application randomly selects someone who is in the Low Group.

"Now wait hold on! Does that mean if I've won more than 50k I don't get to go again? :("

Fear not! I have a system in place that makes sure even those who are lucky beyond belief still have a least a sliver of a chance to be re-rolled, so long as there are several others who have also won more than 50k.

To elaborate, when everybody is placed in their Wealth Group, each group is individually checked to see how many people are in them.

For every specific multiple of people in a Wealth Group, a Trigger is placed in the Wealth Group below it.

-

What the Hell is a Trigger?

Glad you asked!

Remember, when selecting a player for re-rolling, the Python application randomly selects someone from the Low Group. However, if a Trigger is in the Low Group, there is a chance that the Trigger will be selected instead of a player.

If a Trigger is chosen, the Python application will then move UP to the next Wealth Group to choose a player to re-roll.

-

The amount of people required to create a Trigger varies, but scales up with the number of players in Previous Players

Just for example, let's say the multiple needed to create a Trigger is 3 people.

If there are 3 people in the Medium Group, then 1 Trigger WILL be created in the Low Group.

If there are 2 people in the Medium Group, then a Trigger WILL NOT be created in the Low Group.

If there are 8 people in the Medium Group, then 2 Triggers WILL be created in the Low Group.

If there are 5 people in the High Group, then a 1 Trigger WILL be created in the Medium Group.

-

Visual Representation of Re-Rolling

-

-

-

-

-