Global matching players with similar ping?

I know this is probably possible cause I think Blade League does it because everytime I queue up my ping is always relatively low

1 Like

Well im not sure on how to make a global match making system. But I do know how to get the players ping

game.Players.LocalPlayer:GetNetworkPing()
4 Likes

Adding on to that,
Iā€™d find the average ping for the player, not the current ping as their ping will jump around a little. Which should be easy if you know how to find the average in math. This would include logging multiple ping values overtime then calculating the average from all the logged ping values, which iā€™d update it every 30 - 60 seconds or so to find a new average to be more accurate with their current internet speeds.

If you want to separate players by ping, Iā€™d do a group of ping ranges to queue into, such as

local PingRanges = {
    [1] = {min = 0, max = 50},
    [2] = {min = 50, max = 100},
    -- etc.
}

And heres an example of getting average ping. (but make a better one)

local Pings = {}
local Average = 50
local UpdateTime = 5

local Player = game:GetService('Players').LocalPlayer

local function UpdateAveragePing()
	local Sum = 0
	for i, v in pairs(Pings) do
		Sum += v
	end
	
	Sum = Sum / #Pings
	Average = Sum
	
	table.clear(Pings)
	
	print('Average Ping: ', Average)
end

local Ticks = 0

while true do
	local Ping = Player:GetNetworkPing() * 1000
	print(Ping)
	table.insert(Pings, Ping)
	Ticks += 1
	
	if Ticks >= UpdateTime then
		Ticks = 0
		UpdateAveragePing()
	end
	
	task.wait(1)
end