Multiseat
Local multiplayer input assignment. Maps input devices (keyboards, gamepads) to player slots and seats players into vehicles. Supports up to 64 simultaneous players.
Local multiplayer input assignment. Maps input devices (keyboards, gamepads) to player slots and seats players into vehicles. Supports up to 64 simultaneous players.
Public Functions
| Function | Signature | Description |
|---|---|---|
M.getAssignedPlayers | (devices, logEnabled, seatPlayers) → table | Assigns input devices to player numbers and optionally seats them |
M.enterNextVehicle | (player, step) | Cycles a player to the next available vehicle |
Device Assignment Rules
- Keyboard and mouse are always assigned to player 0
- Each additional controller (xinput, etc.) gets the next player number
- Player count =
min(maxPlayers, controllerCount) - Wraps around when more controllers than vehicles
Usage Example
-- Get current device-to-player mapping
local devices = WinInput.getRegisteredDevices()
local assignments = core_multiseat.getAssignedPlayers(devices, true, true)
-- Result: { keyboard0 = 0, mouse0 = 0, xinput0 = 1, xinput1 = 2 }
-- Cycle player 1 to the next vehicle
core_multiseat.enterNextVehicle(1)Seating Logic
When seatPlayers is true and multiseat mode is active:
- Count seats used per vehicle
- Find players without vehicles ("on foot")
- Assign on-foot players to the least-occupied vehicle
- Players beyond the controller count are exited from vehicles
Action Map
The MultiseatActionMap is pushed/popped based on the multiseat setting:
- Enabled: Pushes the multiseat action map
- Disabled: Pops it
Notes
- Max players is hardcoded at 64 (matching the steering fast-path limit in the engine).
- When not in multiseat mode, max players is 1.
- Non-player-0 controllers can be unassigned (cycled to
falseviaenterNextVehicle). - Uses
assignPlayerToDevice()engine binding for low-level assignment.
See Also
- multiseatCamera - Camera for multiseat view
- virtualInput - Virtual input devices
Mod Manager
Core mod management system. Discovers, validates, mounts, activates/deactivates, packs/unpacks mod ZIP files and unpacked mod directories. Persists mod state in `mods/db.json`.
Multiseat Camera
Automatic camera system for multiseat mode. Calculates a shared camera view that encompasses all player vehicles by averaging positions and adjusting distance/FOV dynamically.