Skip to content

Fleet Operations

noteMASTER11 edited this page Jul 22, 2026 · 3 revisions

Fleet Operations

Version 3.2.0 Beta added a player-owned taxi fleet alongside the normal personal shift. The player can continue driving, open My Fleet from the start screen or the map overlay, and monitor hired drivers without replacing the active passenger, cargo, or refueling state.

Since 3.3.1 Beta, Fleet vehicles deliberately use lightweight native route workers rather than copies of the player's experimental predictive AI Driver. They follow purposeful TaxiDriver assignments and remain persistent in the world, but BeamNG's native traffic-aware road follower performs the actual driving. This keeps several employees from multiplying spatial scans, ray fans, local graph searches, and recovery controllers on the same frame.

Hiring a vehicle

Two sources are available:

  • Garage: select an installed model/configuration and spawn a separate fleet car near a safe point around the player. The player is not moved into it.
  • Traffic: recruit one of the nearest eligible AI traffic cars. TaxiDriver removes it from the normal traffic pool so BeamNG does not despawn it while employed.

Both paths charge the configured hiring fee and respect the active-driver limit. Dismissing a garage vehicle deletes that spawned car. Dismissing a recruited traffic vehicle returns it to the traffic system where possible.

flowchart TD
  Open[Open My Fleet] --> Source{Hiring source}
  Source -->|Garage| Select[Choose installed model and configuration]
  Source -->|Traffic| Nearby[Choose a nearby eligible traffic car]
  Select --> Validate{Enabled, capacity and funds valid?}
  Nearby --> Validate
  Validate -->|no| Error[Show localized reason]
  Validate -->|yes| Fee[Charge hiring fee]
  Fee --> Own[Detach from player/traffic lifecycle]
  Own --> Worker[Create an independent fleet worker]
  Worker --> Plan[Plan first assignment]
Loading

Job and wage lifecycle

A worker randomly selects from the enabled passenger and delivery categories, builds a road-graph route between the configured minimum and maximum distance, and sends that node list to BeamNG through ai.driveUsingPath. The simplified Fleet AI preset is independent from the detailed player AI Driver preset.

stateDiagram-v2
  [*] --> Planning
  Planning --> Working: route created
  Planning --> Planning: graph temporarily unavailable
  Working --> Resting: physical destination reached
  Working --> Planning: current-segment replan
  Working --> Resting: retry budget exhausted
  Resting --> Planning: break ends
  Working --> Unpaid: ten-minute wage cannot be paid
  Unpaid --> Working: wallet can pay wage
  Working --> [*]: dismissed or session ends
  Resting --> [*]: dismissed or session ends
  Unpaid --> [*]: dismissed or session ends
Loading

On completion, the fare is based on driven distance and job time. Only the configured owner share is credited to the player's wallet. Hiring fees and wages are charged separately, so a larger fleet is not automatically profitable.

Default economy:

Setting Default Allowed range
Owner share 35% 10–90%
Hiring fee $75 $0–1,000
Wage per 10 minutes $12 $0–250
Active drivers 6 1–12
Job distance 1.5–8 km 0.5–50 km
World label distance 400 m 50–1,000 m

At least one job category always remains enabled after validation.

Fleet AI presets

Preset Intended behavior
Careful Low native aggression and legal speed mode
Standard Moderate native aggression and legal speed mode
Fast Higher native aggression with the legal-speed cap disabled

These presets are deliberately narrower than the player's AI settings. Fleet workers use the native driver's collision avoidance, lane behavior, signals, and recovery. TaxiDriver applies aggression, native speed mode, a bounded no-progress timeout, and a retry limit; predictive perception and exact-approach parameters are not instantiated for background employees.

Lightweight route recovery

Each worker owns only its assignment progress and a small monitor. Monitoring runs every 250 ms and workers are staggered across four 62.5 ms phases, so up to twelve employees do not all execute their checks in one simulation tick.

flowchart TD
  Tick[Staggered 250 ms monitor] --> Progress{Vehicle still making progress?}
  Progress -->|yes| Continue[Keep native route]
  Progress -->|no, below timeout| Wait[Let native traffic AI continue]
  Progress -->|no, timeout reached| Budget{Fewer than 3 replans?}
  Budget -->|yes| Segment[Find current road segment]
  Segment --> Graph[Build path from current segment to target]
  Graph --> Trim[Discard already passed nodes]
  Trim --> Native[Issue corrected native route]
  Budget -->|no| Abandon[Abandon unreachable assignment]
  Abandon --> Rest[Short rest, then select another job]
Loading

The minimum no-progress window is 45 seconds. A native Route Done event is accepted as arrival only when the vehicle is within 22 metres of the target; otherwise a corrected route is requested after one second. Normal job completion still requires the tighter 12-metre radius and a speed at or below 5 km/h.

The retry path starts from the employee's current road segment and excludes route nodes already passed. This prevents a stalled worker from treating the first node of the original assignment as a new destination and turning around toward its route origin. After three unsuccessful replans, the assignment is discarded instead of running recovery indefinitely.

Monitoring

The fleet screen provides:

  • total jobs, gross fleet revenue, owner revenue, wages, hiring costs, and net profit;
  • active vehicle, source, passenger/cargo assignment, status, progress, remaining distance, speed, and AI status;
  • a player-centered live map with owned taxis shown as purple markers;
  • access during a personal trip through the purple fleet button over the map;
  • localized world labels identifying an owned taxi and its current activity within the configured range.

The native minimap and Connected Phone canvas use separate rendering integrations but consume the same authoritative fleet marker list from Game Engine Lua. A dedicated map occlusion keeps the Active drivers overlay above the native road renderer.

Persistence and session ownership

/settings/TaxiDriver/fleet.json stores aggregate and per-vehicle statistics:

  • rides, passenger rides, and delivery rides;
  • driven distance;
  • gross revenue and owner revenue;
  • wages and hiring fees.

Active workers themselves are session-scoped. On level/session shutdown TaxiDriver stops their AI, releases recruited traffic vehicles, deletes separately spawned fleet vehicles, restores wrapped minimap functions, and flushes dirty statistics. A stale vehicle ID is removed from the active list instead of being persisted as a live employee.

Implementation map

flowchart LR
  UI[TaxiDriverHUD fleet view] -->|fleet command| Main[taxiDriver.lua]
  Main --> Manager[fleetManager.lua]
  Manager --> Economy[Wallet delta and fleet.json]
  Manager --> W1[lightweight fleetWorker #1]
  Manager --> W2[lightweight fleetWorker #2]
  Manager --> WN[lightweight fleetWorker #N]
  W1 --> V1[BeamNG native route AI #1]
  W2 --> V2[BeamNG native route AI #2]
  WN --> VN[BeamNG native route AI #N]
  Manager --> NativeMap[Native purple markers]
  Manager --> Labels[Localized world labels]
  Main --> Publisher[HUD snapshot / Connected Phone]
  Publisher --> WebMap[Canvas purple markers]
Loading

The main distinction is ownership: fleetManager.lua owns economy, persistence, hiring, markers, and lifetime; fleetWorker.lua owns one assignment state and issues bounded native route commands. No worker creates autopilot.lua, uses the player's predictive perception, or shares the player's active trip state.

Clone this wiki locally