7 Days to Die Modlet: Automatically monitor and kick/ban players with excessively high ping
Even a single player with high lag/ping can cause trouble for all other players - making pvp virtually impossible. Automatically removing players with consistently high lag can help to reduce errors/issues on the game server and improve the experience for everyone else.
Environment | Compatible? | Details |
---|---|---|
Dedicated Server | Yes | This mod is meant for dedicated servers only |
EAC | Yes | You can leave EAC enabled on your server and client (just be sure to only install this mod on the server) |
P2P | No | Peer-to-peer multiplayer games are not the target of this mod |
Local | No | Installing this mod on the client is not necessary; please only install it on your dedicated server |
The team over at 7daystodiemods.com has put together an excellent guide on how to install mods; just make sure to install this on your server, rather than your local game installation.
After restarting your game, Lag Shield will be active with default settings. You can join the server or access it via Telnet (if enabled) to adjust the configuration options to meet your needs (see below).
Command | Description |
---|---|
lagshield / ls |
View current configuration |
ls set <Option> <Value> |
Update a key/value pair in the configuration |
ls list |
Show list of players currently being tracked for high ping |
ls reset |
Delete the configuration file and create a new one with default values |
TIP: Ping limit will come preconfigured with a suggested value of 200ms, but this might naturally exclude some regions that you don't want to exclude... consider registering your server at 7 Days To Die Servers (an unofficial site for ranking and providing external tools for 7DTD servers) and view the Ping tab to get a rundown of ping tests from various parts of the world.
<Option> |
<Value> (Default) |
Description |
---|---|---|
MaxPingAllowed | 200 | Threshold for latency in milliseconds. A ping check exceeding this number will be treated as a failure and increment the PingFailures counter. Good pings will reduce the counter while bad ping checks will increase it - giving players a sort of grace period for an intermittently poor connection (you can reduce/eliminate this grace period) |
FailureThresholdBeforeKick | 2 | The number of times a player can fail a ping check before being kicked. Setting this value to 0 will cause the player to be kicked during login if their intial ping is too high, but will also mean that active players won't benefit from a grace period for the occasional spike in latency |
AllowedKicksBeforeBan | 2 | The number of times a player can be kicked before the system resorts to a temporary ban. setting this to 0 will cause players to be auto-banned instead of kicked when the limit set by FailureThresholdBeforeKick is exceeded |
HoursBannedAfterKickWarnings | 24 | The number of hours a player will be temporarily banned for if they continue to fail ping checks and have been kicked for the same reason too many times |
Once every 30 seconds or so, the system will check ping for each player.
The first ping check will happen at login. Subsequent ping checks will happen at 30-second intervals, give or take.
graph TD
connect[Player Connects]
check[Check Player Ping]
wait[Wait 30 Seconds]
addPing[Increase Failed Ping Counter by 1]
recoverPing[Reduce Failed Ping Counter by 1]
addKick[Increase Kick Counter by 1]
kickPlayer[Kick Player, Add to Kick Counter, Reset Ping Counter]
banPlayer[Ban Player and Reset all Counters]
connect -->|immediately| check
check -->|good ping|recoverPing
recoverPing --> wait
check -->|bad ping| addPing
addPing -->|counter <= limit| wait
wait --> check
addPing -->|counter > limit| addKick
addKick -->|counter <= limit| kickPlayer
kickPlayer -->|whenever ready| connect
addKick -->|counter > limit| banPlayer
banPlayer -->|after x hours| connect
Note: ban timeout can be customized
Note: ban timeout can be customized
This project has a github action configured to automatically package and create a downloadable release artifact for this mod. To prepare a release, perform the following steps:
- create a new branch
- make your code changes with Visual Studio 2022 and build your RELEASE (not Debug) to generate a new binary (this binary will be packaged during the automated release process)
- update the
ModInfo.xml
version number (this will become the release's version tag) - update
CHANGELOG.md
because it makes me happy
- create a PR
- provide the subject/title (this will become the release's name)
- enter the details (this will become the release summary)
- when your PR is updated and merged, a release will automatically be created with the details you provided above
- check out the release entry and copy the link for
lag-shield.zip
from there if you want to download it on your server
- check out the release entry and copy the link for
This mod is largely based on the feature named "High Ping Kicker" in Server Tools. I would highly encourage anyone interested in this mod to check out their server management mod as well. It comes with a full suite of AntiCheat services and a truly wild number of tools and capabilities.
Hey, using Server Tools might be the better choice for you! But here are some reasons why you might not have the option to:
- Accessibility: I found that my current host and many other hosts (it turns out) do not support the creation/management of xml files in the game root directory and instead rely on configuration via admin commands. In order to ensure accessibility and ease of use for all admins in any situation, Lag Shield is fully configurable from the admin console or via Telnet.
- Compartmentalization: I'm a fan of keeping mods as small and as simple as possible, which aligns more to a 'microservices' line of thinking. There are some downsides to this, in certain situations, but monitoring/kicking players for excessive ping would not suffer from this approach in my view.