> For the complete documentation index, see [llms.txt](https://k0ssek-scripts.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://k0ssek-scripts.gitbook.io/docs/scripts/dart-game/configuration.md).

# Configuration

Every option in config/shared.lua and config/server.lua.

The settings are split into two files:

* `config/shared.lua` - loaded on the client and the server
* `config/server.lua` - server only: table names, admin access and throw validation

Restart the resource after changing either file.

## config/shared.lua

### Locale and target

```lua
Config.Locale = GetConvar('kossek_darts:locale', 'en')
Config.Target = GetConvar('kossek_darts:target', 'ox_target')
```

Both are set with convars in `server.cfg`, see [Installation](/docs/scripts/dart-game/installation.md). The values are explained in [Localization](/docs/scripts/dart-game/localization.md) and [Frameworks & Targets](/docs/scripts/dart-game/frameworks-and-targets.md).

### Game modes

```lua
Config.Modes       = { 'ReachZero', 'MaxScore' }
Config.DefaultMode = 'ReachZero'

Config.GameMode = {
    ['ReachZero'] = { startScore  = 201 },
    ['MaxScore']  = { targetScore = 100 },
}
```

| Option                                 | Default                       | Description                                                                                          |
| -------------------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------- |
| `Config.Modes`                         | `{ 'ReachZero', 'MaxScore' }` | Modes the server accepts. If a lobby starts a mode that is not listed, the match uses `DefaultMode`. |
| `Config.DefaultMode`                   | `'ReachZero'`                 | Mode of a new lobby.                                                                                 |
| `Config.GameMode.ReachZero.startScore` | `201`                         | Score every player starts with and has to bring down to exactly 0.                                   |
| `Config.GameMode.MaxScore.targetScore` | `100`                         | Score a player has to reach to win.                                                                  |

The rules are described in [Game Modes & Difficulty](/docs/scripts/dart-game/game-modes-and-difficulty.md).

### Lobby

| Option                   | Default | Description                                                                                        |
| ------------------------ | ------- | -------------------------------------------------------------------------------------------------- |
| `Config.MaxPlayers`      | `8`     | Most players in one board's lobby.                                                                 |
| `Config.LobbyRadius`     | `4.0`   | Distance in metres at which a board can be used. A player who walks further away leaves the lobby. |
| `Config.DuiRenderRadius` | `40.0`  | Distance in metres up to which the 3D scoreboard is drawn.                                         |

### Difficulty

```lua
Config.Difficulties      = { 'Easy', 'Normal', 'Hard' }
Config.DefaultDifficulty = 'Normal'

Config.DifficultySettings = {
    ['Easy']   = { swayMultiplier = 0.5 },
    ['Normal'] = { swayMultiplier = 1.0 },
    ['Hard']   = { swayMultiplier = 2.0 },
}
```

| Option                                           | Default                        | Description                                                                                |
| ------------------------------------------------ | ------------------------------ | ------------------------------------------------------------------------------------------ |
| `Config.Difficulties`                            | `{ 'Easy', 'Normal', 'Hard' }` | Difficulties the server accepts. One that is not listed falls back to `DefaultDifficulty`. |
| `Config.DefaultDifficulty`                       | `'Normal'`                     | Difficulty of a new lobby.                                                                 |
| `Config.DifficultySettings[name].swayMultiplier` | `0.5` / `1.0` / `2.0`          | How much the aim point sways on that difficulty. `1.0` is the base amount.                 |

### Throwing

```lua
Config.Physics = {
    MinSpeed  = 18.0,
    MaxSpeed  = 32.0,
    MaxFlight = 4000,
}

Config.TurnDuration = 30
Config.DartsPerTurn = 3
```

| Option                     | Default | Description                                                                                          |
| -------------------------- | ------- | ---------------------------------------------------------------------------------------------------- |
| `Config.TurnDuration`      | `30`    | Seconds a player has to throw a dart before the turn is skipped. The timer restarts with every dart. |
| `Config.DartsPerTurn`      | `3`     | Darts each player throws per turn.                                                                   |
| `Config.Physics.MinSpeed`  | `18.0`  | Speed of the dart at the weakest throw, in m/s.                                                      |
| `Config.Physics.MaxSpeed`  | `32.0`  | Speed of the dart at a full-power throw, in m/s.                                                     |
| `Config.Physics.MaxFlight` | `4000`  | Longest a dart can stay in flight, in ms.                                                            |

The speed of a throw lies between `MinSpeed` and `MaxSpeed`, depending on the throw power.

### Aiming

```lua
Config.AimCamOffset = vec3(-0.18, 0.1, 0.7)
Config.AimCamEaseMs = 500

Config.AimZone = {
    BaseSway       = 0.55,
    Sensitivity    = 0.012,
    StanceDistance = 3.5,
}
```

| Option                          | Default                 | Description                                                                                    |
| ------------------------------- | ----------------------- | ---------------------------------------------------------------------------------------------- |
| `Config.AimCamOffset`           | `vec3(-0.18, 0.1, 0.7)` | Position of the aim camera, relative to the player.                                            |
| `Config.AimCamEaseMs`           | `500`                   | Time in ms the camera takes to blend in and out.                                               |
| `Config.AimZone.BaseSway`       | `0.55`                  | Sway at level 1 on Normal difficulty. `1.0` is the full radius of the board, `0.0` is no sway. |
| `Config.AimZone.Sensitivity`    | `0.012`                 | Mouse sensitivity while aiming.                                                                |
| `Config.AimZone.StanceDistance` | `3.5`                   | Distance in metres from the board at which the player is placed when they start to aim.        |

### Board props

```lua
Config.BoardModel = 'prop_dart_bd_cab_01'

Config.BoardModels = {
    'prop_dart_bd_cab_01',
    'prop_dart_bd_01',
}

Config.AutoDetect       = true
Config.AutoTargetModels = true
```

| Option                    | Default                 | Description                                                                                                                                                                                                                                        |
| ------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Config.BoardModel`       | `'prop_dart_bd_cab_01'` | Prop used for boards placed with `/darts_create`.                                                                                                                                                                                                  |
| `Config.BoardModels`      | two models              | Props that count as dartboards for auto-detection and for the target options.                                                                                                                                                                      |
| `Config.AutoDetect`       | `true`                  | Turn world props that match `BoardModels` into playable boards. See [Board Placement](/docs/scripts/dart-game/board-placement.md).                                                                                                                 |
| `Config.AutoTargetModels` | `true`                  | With ox\_target or qb-target: add the join and leave options to every prop in `BoardModels`. With `false` they are added to each board when a player comes near it. See [Frameworks & Targets](/docs/scripts/dart-game/frameworks-and-targets.md). |

{% hint style="info" %}
The scoring rings are measured for the two default props. A different board model will not score correctly.
{% endhint %}

### Skill and XP

```lua
Config.Skill = {
    MaxLevel          = 50,
    XpPerWin          = 80,
    XpPerThrow        = 2,
    XpPerBullseye     = 25,
    MinSwayMultiplier = 0.3,
}
```

| Option              | Default | Description                                                   |
| ------------------- | ------- | ------------------------------------------------------------- |
| `MaxLevel`          | `50`    | Highest level a player can reach.                             |
| `XpPerWin`          | `80`    | XP for winning a match.                                       |
| `XpPerThrow`        | `2`     | XP per dart thrown.                                           |
| `XpPerBullseye`     | `25`    | Bonus XP per bullseye.                                        |
| `MinSwayMultiplier` | `0.3`   | Sway at the highest level, as a share of the sway at level 1. |

### Elo

```lua
Config.Elo = {
    Default = 1000,
    KFactor = {
        beginner     = 48,
        intermediate = 32,
        experienced  = 16,
    },
}
```

| Option                 | Default | Description                                    |
| ---------------------- | ------- | ---------------------------------------------- |
| `Default`              | `1000`  | Rating of a new player.                        |
| `KFactor.beginner`     | `48`    | K-factor for players with fewer than 10 games. |
| `KFactor.intermediate` | `32`    | K-factor for players with 10 to 49 games.      |
| `KFactor.experienced`  | `16`    | K-factor for players with 50 or more games.    |

XP, levels and the rating formula are explained in [Skill & Elo](/docs/scripts/dart-game/skill-and-elo.md).

### Sound

| Option                     | Default | Description                                                                 |
| -------------------------- | ------- | --------------------------------------------------------------------------- |
| `Config.Audio.ImpactRange` | `15.0`  | Distance in metres at which the sound of a dart hitting the board is heard. |

## config/server.lua

### Database

```lua
ConfigServer.DB = {
    StatsTable  = 'darts_stats',
    BoardsTable = 'darts_boards',
}
```

Names of the two tables the script creates. Change them before the first start if they clash with another resource.

### Admin access

```lua
ConfigServer.AdminGroups = { 'admin', 'superadmin' }
ConfigServer.AdminAce    = 'command.darts_admin'
```

| Option                     | Used on                 | Description                                    |
| -------------------------- | ----------------------- | ---------------------------------------------- |
| `ConfigServer.AdminGroups` | ESX                     | Groups that can use the board commands.        |
| `ConfigServer.AdminAce`    | QBCore, QBX, standalone | Ace permission that allows the board commands. |

### Throw validation

```lua
ConfigServer.Validation = {
    MaxThrowDistance = 12.0,
    MaxFlightMs      = 38000,
    MaxScorePerThrow = 60,
}
```

| Option             | Default | Description                                                                                                                                                                                                                                            |
| ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `MaxThrowDistance` | `12.0`  | Furthest a player can stand from the board, in metres. A throw from further away counts as a miss.                                                                                                                                                     |
| `MaxFlightMs`      | `38000` | Latest a dart can land, in ms counted from the moment the player got that dart. A later throw counts as a miss. The default is 30 s to throw, 4 s of flight and a 4 s margin. If you raise `Config.TurnDuration`, raise this value by the same amount. |
| `MaxScorePerThrow` | `60`    | Highest score one dart can give (triple 20). A higher result is discarded.                                                                                                                                                                             |
