Configuration
This guide details the configuration options available for the anti-lag script. The configuration is typically found in a file like config/settings.lua
within the script's resource folder.
1. Update Interval Settings (updateIntervals
)
Controls how often the server checks player metrics based on the current player count. Lower intervals mean faster detection but potentially higher server load.
- Purpose: Dynamically adjust check frequency based on server population.
- Format: The key is the minimum player count for the interval to apply. The value is the interval in milliseconds (1000ms = 1 second).
updateIntervals = {
-- Format: [minimum_player_count] = 1000 * interval_in_seconds
[656] = 1000 * 13, -- 13 seconds interval for 656+ players
[556] = 1000 * 12, -- 12 seconds interval for 556-655 players
[456] = 1000 * 11, -- 11 seconds interval for 456-555 players
[356] = 1000 * 10, -- 10 seconds interval for 356-455 players
[256] = 1000 * 9, -- 9 seconds interval for 256-355 players
[128] = 1000 * 8, -- 8 seconds interval for 128-255 players
[96] = 1000 * 7, -- 7 seconds interval for 96-127 players
[64] = 1000 * 6, -- 6 seconds interval for 64-95 players
[0] = 1000 * 5 -- 5 seconds interval for 0-63 players
},
2. Packet Loss Detection Settings
Configure how the script monitors and reacts to player packet loss.
Packet Loss Guide: This provides a general comparison between server-side and client-side perceived packet loss. Note: These are rough estimates and can vary based on network conditions.
Server Calculated Packet Loss Typical Client-Side Experience 0-20% Good (Client usually sees 0-5%) 20-40% Fair (Client usually sees 5-14%) 40%+ Poor (Client usually sees 15%+)
packetLossScale = 65536
: Internal scaling factor. Do not change.packetLossDetectEnable = true
: Set totrue
to enable,false
to disable packet loss checks.packetLossAvgWindow = 30
: Duration (seconds) to average packet loss over. Higher values smooth out brief spikes but react slower.packetLossThreshold = { freezePlayer = 40.0, warnPlayer = 33.0 }
:freezePlayer
: Average packet loss percentage (%) at or above which the player may be frozen.warnPlayer
: Average packet loss percentage (%) at or above which the player may be warned (if below freeze threshold).
packetLossWarnCooldown = 45
: Minimum time (seconds) between warnings for the same player.
-- Packet Loss Settings
packetLossScale = 65536, -- Do not touch unless you know what you're doing
packetLossDetectEnable = true, -- Enable or disable packet loss detection
packetLossAvgWindow = 30, -- in seconds
packetLossThreshold = {
freezePlayer = 40.0, -- packet loss percentage
warnPlayer = 33.0, --packet loss percentage
},
packetLossWarnCooldown = 45, --in seconds
3. Ping Detection Settings
Configure how the script monitors and reacts to high player ping (latency).
pingDetectEnable = true
: Set totrue
to enable,false
to disable ping checks.pingAvgWindow = 5
: Duration (seconds) to average ping (RTT) over.pingThreshold = { freezePlayer = 400, warnPlayer = 350 }
:freezePlayer
: Average ping (milliseconds) at or above which the player may be frozen.warnPlayer
: Average ping (milliseconds) at or above which the player may be warned (if below freeze threshold).
pingWarnCooldown = 30
: Minimum time (seconds) between ping warnings for the same player.
-- Ping Settings
pingDetectEnable = true, -- Enable or disable ping detection
pingAvgWindow = 5, -- in seconds
pingThreshold = {
freezePlayer = 400, -- ping in ms
warnPlayer = 350, -- ping in ms
},
pingWarnCooldown = 30, -- in seconds
4. FPS Detection Settings
Configure how the script monitors and reacts to low client-side FPS. Requires a client script to send FPS data via the dc_antilag:sync:fps
event.
fpsDetectEnable = true
: Set totrue
to enable,false
to disable FPS checks.fpsAvgWindow = 10
: Duration (seconds) to average FPS over.fpsThreshold = { freezePlayer = 7, warnPlayer = 10 }
:freezePlayer
: Average FPS at or below which the player may be frozen.warnPlayer
: Average FPS at or below which the player may be warned (if above freeze threshold).
fpsWarnCooldown = 30
: Minimum time (seconds) between FPS warnings for the same player.
-- FPS Settings
fpsDetectEnable = true, -- Enable or disable FPS detection
fpsAvgWindow = 10, -- in seconds
fpsThreshold = {
freezePlayer = 7, -- minimum fps before freezing
warnPlayer = 10, -- minimum fps before warning
},
fpsWarnCooldown = 30, -- in seconds
5. InfluxDB Logging Settings
Optional settings to send performance metrics to an InfluxDB database for monitoring.
influxDbEnable = true
: Set totrue
to enable sending data,false
to disable.influxDBURL = "http://<host>:<port>/write?db=<database_name>"
: The full URL endpoint for your InfluxDB instance's write API. Replace placeholders with your actual host, port, and database name. Ensure the database exists.
-- InfluxDB Settings (Optional)
influxDbEnable = true, -- Enable or disable InfluxDB logging
influxDBURL = "http://sampleinfluxurl.com/write?db=dbName", -- Example URL