DEV Community

Cover image for Select best cluster of game-servers connection using PowerShell like the Wargaming launcher does. ๐Ÿš€๐ŸŽฎ
uyriq
uyriq

Posted on • Edited on

Select best cluster of game-servers connection using PowerShell like the Wargaming launcher does. ๐Ÿš€๐ŸŽฎ

How to check connection to server clusters using powershell or how to do the same thing that the launcher does when logging into Wargaming and Lesta game account. ๐Ÿš€๐ŸŽฎ

When throwing pebbles into the water, look at the circles formed by them; otherwise, such throwing will be an empty amusement ๐Ÿ˜‰. What do I liken a good MT/WOT ping to? - To a fast projectile hitting the target.

Clusters of game servers for โ€œWorld of Tanksโ€ and โ€œWorld of Tanksโ€ are distributed in different regions, and each cluster serves a certain set of servers. The game selects the server based on the lowest ping to the cluster. Probably, additional selection parameters are used, and all this happens at the moment of connection. Also, at any time in the game, you can switch to the available list of servers sorted by ping. If you want to solve the problem of choosing the optimal cluster yourself, you will need to check the ping to each server in each cluster, determine the average ping and its variance, and the less these indicators, the more suitable the cluster for the game. For this purpose, I have written a PowerShell script that performs these actions, displays the results in the console as the list is traversed, and selects the optimal cluster based on the final table. The script code is available on GitHub in the public repo. Instructions on how to use and customize it are in the repo README.

The script accepts a list of server URLs either directly through the -serverList parameter or via a JSON file specified with the -serverListFile parameter. It performs ping tests on each server, calculates the average response time and dispersion, and identifies the optimal server based on these metrics. Note that the script includes all current servers of WoT in the serverlistfile.json. Users can test and measure ping results for these servers as well as for their own list of servers.

.\wotPing.ps1 -pingCount 5 -serverList "ya.ru", "google.com" -serverListFile "serverList.json"
# This command pings "ya.ru", "google.com", and all servers listed in "serverList.json" five times each.
Enter fullscreen mode Exit fullscreen mode

Top comments (0)