# Setting Up AI Traffic (/docs/assetto-corsa-freeroam/ai-traffic)



AI traffic is what makes a freeroam server feel alive — cars that drive the roads alongside players. It's controlled in `cfg/extra_cfg.yml`.

<Callout type="warn">
  AI traffic needs a map that includes **AI spline data** (the racing line the AI follows). Most popular freeroam maps (Shutoko, LA Canyons) ship with it. A map with no AI spline will run, but no traffic will spawn. See [Install a Map](/docs/assetto-corsa-freeroam/install-a-map).
</Callout>

Turn it on [#turn-it-on]

In the panel's **Startup** tab, set **Enable AI Traffic** to `true` and pick a value for **AI Traffic Max Cars**. As a guide:

| Feel                 | Max cars |
| -------------------- | -------- |
| Light (quiet roads)  | \~60     |
| Medium (steady flow) | \~150    |
| Heavy (busy highway) | \~250    |
| Rush hour            | \~400    |

Fine-tuning [#fine-tuning]

For more control, edit `cfg/extra_cfg.yml` (or generate it with the [Freeroam Config Generator](https://xgamingserver.com/tools/assetto-corsa/freeroam-config)):

```yaml
EnableAi: true
AiParams:
  MaxAiTargetCount: 150          # total AI cars on the map
  AiPerPlayerTargetCount: 10     # AI cars spawned around each player
  Aggression: 0.5                # 0 = calm, 1 = aggressive
  Consistency: 0.5               # lower = more varied driving
  MinAiSafetyDistanceMeters: 20
  MaxAiSafetyDistanceMeters: 70
  TwoWayTraffic: false           # true for two-directional roads
```

After editing, **restart** the server for changes to apply.

How density actually works [#how-density-actually-works]

`MaxAiTargetCount` is the hard cap for the whole map. `AiPerPlayerTargetCount` controls how many cars cluster near each player — so with few players online, you still get traffic around them rather than an empty map. Raise both for a busier world; lower them if the server's CPU is struggling with many players.
