Edit: I am not advocating the use of the antilag user script, work has been done in mafia after this thread was created that makes this script redundant.
There is a new tab "Connection" in the login menu, and in the preferences you can see options in "General > Connection Options".
New commands has also been added to mafia, such as "relog" and "ping". I myself still use the script, but it's a personal choice.
Recently @Veracity has made improvements to Mafia in the way of checking what your ping to the servers is.
github.com
This script is one that was shared in the ASS discord, and what it does is it stores a cache of 5 (or more) pings across different login sessions, and then relogs you until your current session ping is within 1.1x of the lowest ping. So if the lowest was 100, it will aim to get you a ping of 110 or less.
It is a rolling cache, so it deletes older entries as it inserts newer entries.
What it would be nice to see, is if Mafia could
1. Detect what your ping should be
2. Relog you until the ping is acceptable
There's several thoughts on this.
First, to detect the ping we should have.
We could ping the login page, that is always on the same server as far as I believe. So the ping should be relatively static.
This way if you switch internet connections, we could tell what ping you should be getting by comparing it to the ping on the main page.
Such as "main page has ping of 200ms, when logged in we should have a ping of 220ms or less"
However, this requires further verification to ensure this is viable.
Alternatively, we'd want to cache the pings in a rolling list, I don't have a solid idea on how to do this with different internet connections with different latency.
The interest behind different connections is because of the following; A user of the script had the issue where the cached pings were inaccurate as they switched internet connections. One day it'll be blazing fast, the next day it'll be slow. When its fast, they could be on the worst kol server and it'll say the ping is acceptable because it was looking at the slow day.
Secondly, when we relog.
By no means do I ever mean "Restart the mafia client" or "Refresh everything as if we were constantly logging out to the login window and back"
I mean we simply refresh the kol session we're connected to, the script does this by visiting logout.php, then telling mafia that we are logged out which makes mafia try to log us back in again.
(Due to an internal mafia check, the script has to wait 30s between each relog. We can obviously bypass this.)
By simply refreshing our login session, we do not need to reload our inventory, or character status or anything. We only change the session ID. This should take less than a few seconds and will switch the server we're connected to.
Because of how I'm thinking this could work, it can be a command as well as part of the mafia login sequence. You run the command as part of your daily scripts and it checks to make sure your ping is still acceptable, and relogs you if not.
Third, the logout and logins.
I'm not sure if this is viable, but some people do not use "Stealth Login". That's fine, but when we relog it could be annoying to people if you're constantly relogging to get faster internet.
As such, we can probably avoid the "logout" part of the process, since we only care about getting a new session. We don't need to "logout" as such.
Then when we login as part of the relogging process, always perform it in stealth mode.
Lastly, the preferences.
Only a few obvious preferences spring to mind.
A preference on the maximum amount of times we'll try to relog in an attempt to get a better ping.
A preference if we want to do this as part of the login.
A possible preference for debug purposes where it'll store the recent outcomes, and can deliver a warning if needed.
Closing thoughts
I'm not sure if I explained this sufficiently well, the end goal is to simply hop across kol backends until we find one that is not overloaded and will give us fast results.
Sometimes you'll get a server where it'll take 600ms to perform a request. Sometimes you get a server where it'll take 200ms to perform a request.
We can't tell which server we're on from what I know, only how long it takes to perform a request.
There is a new tab "Connection" in the login menu, and in the preferences you can see options in "General > Connection Options".
New commands has also been added to mafia, such as "relog" and "ping". I myself still use the script, but it's a personal choice.
Recently @Veracity has made improvements to Mafia in the way of checking what your ping to the servers is.
GitHub - libraryaddict/KolAntiLag: A script to refresh kol to find an non-laggy server
A script to refresh kol to find an non-laggy server - libraryaddict/KolAntiLag
This script is one that was shared in the ASS discord, and what it does is it stores a cache of 5 (or more) pings across different login sessions, and then relogs you until your current session ping is within 1.1x of the lowest ping. So if the lowest was 100, it will aim to get you a ping of 110 or less.
It is a rolling cache, so it deletes older entries as it inserts newer entries.
What it would be nice to see, is if Mafia could
1. Detect what your ping should be
2. Relog you until the ping is acceptable
There's several thoughts on this.
First, to detect the ping we should have.
We could ping the login page, that is always on the same server as far as I believe. So the ping should be relatively static.
This way if you switch internet connections, we could tell what ping you should be getting by comparing it to the ping on the main page.
Such as "main page has ping of 200ms, when logged in we should have a ping of 220ms or less"
However, this requires further verification to ensure this is viable.
Alternatively, we'd want to cache the pings in a rolling list, I don't have a solid idea on how to do this with different internet connections with different latency.
The interest behind different connections is because of the following; A user of the script had the issue where the cached pings were inaccurate as they switched internet connections. One day it'll be blazing fast, the next day it'll be slow. When its fast, they could be on the worst kol server and it'll say the ping is acceptable because it was looking at the slow day.
Secondly, when we relog.
By no means do I ever mean "Restart the mafia client" or "Refresh everything as if we were constantly logging out to the login window and back"
I mean we simply refresh the kol session we're connected to, the script does this by visiting logout.php, then telling mafia that we are logged out which makes mafia try to log us back in again.
(Due to an internal mafia check, the script has to wait 30s between each relog. We can obviously bypass this.)
By simply refreshing our login session, we do not need to reload our inventory, or character status or anything. We only change the session ID. This should take less than a few seconds and will switch the server we're connected to.
Because of how I'm thinking this could work, it can be a command as well as part of the mafia login sequence. You run the command as part of your daily scripts and it checks to make sure your ping is still acceptable, and relogs you if not.
Third, the logout and logins.
I'm not sure if this is viable, but some people do not use "Stealth Login". That's fine, but when we relog it could be annoying to people if you're constantly relogging to get faster internet.
As such, we can probably avoid the "logout" part of the process, since we only care about getting a new session. We don't need to "logout" as such.
Then when we login as part of the relogging process, always perform it in stealth mode.
Lastly, the preferences.
Only a few obvious preferences spring to mind.
A preference on the maximum amount of times we'll try to relog in an attempt to get a better ping.
A preference if we want to do this as part of the login.
A possible preference for debug purposes where it'll store the recent outcomes, and can deliver a warning if needed.
Closing thoughts
I'm not sure if I explained this sufficiently well, the end goal is to simply hop across kol backends until we find one that is not overloaded and will give us fast results.
Sometimes you'll get a server where it'll take 600ms to perform a request. Sometimes you get a server where it'll take 200ms to perform a request.
We can't tell which server we're on from what I know, only how long it takes to perform a request.
Last edited: