Multiplayer
Goal: run the included networking example with two players, then prepare your own car.
Before you start
First confirm the car works in single player. Choose one RCCP integration for your first test:
| Integration | What you need | Included example |
|---|---|---|
| Photon PUN 2 | Photon PUN 2 installed and a configured Photon App ID. | Blank gameplay scene and a lobby with rooms and chat. |
| Mirror | Mirror installed and a running host or server. | Blank gameplay scene with server discovery on the local network. |
The networking frameworks are separate from RCCP. RCCP supplies the vehicle integration and examples.
A local car is the one your player controls. A remote car is another player's car shown on your screen. Ownership, called authority in parts of Mirror, decides which player sends a car's state.
What is shared between players?
Both integrations send movement, driver inputs, engine state, gears, differential outputs, lights and wheel RPM.
They do not provide a complete multiplayer game:
- Damage, dents, repairs and detached parts are not synchronized.
- Paint, wheels, spoilers and other customization are not synchronized.
- Skidmarks, smoke and sparks are generated locally, rather than sending each effect.
- Replay recording and playback are unavailable during a networking session.
Plan additional networking code if your game needs shared damage, customization or character/vehicle ownership changes.
Setting up multiplayer with Photon PUN 2
1. Install the integration
- Install Photon PUN 2 and complete its App ID setup.
- Open Tools > BoneCracker Games > Realistic Car Controller Pro > Welcome Window.
- Select Addons > Photon PUN2 > Import Integration.
- Wait for Unity to finish importing and compiling.
If the card says Download, RCCP has not detected Photon yet. Finish the framework installation before importing the integration.
Check: the Demos tab offers Lobby Photon and Blank Photon.
2. Test the supplied scenes
- Open Lobby Photon from the Demos tab.
- Check that your Photon App ID is configured.
- Include the lobby and its gameplay scene in the build's scene list before building.
- Run two copies of the game, for example one build and one Editor session.
- Join the same room and drive on each copy.
Check: each player controls their own car and sees the other car move. Check steering, braking and lights from both sides.
Blank Photon is the simpler gameplay example. Installed scenes are in Assets/Realistic Car Controller Pro/Addons/Installed/Photon PUN 2/Scenes/.
3. Prepare your own vehicle
- Stop Play Mode and open a vehicle prefab that already drives correctly.
- Select its root, the object with RCCP_CarController.
- Drag the
RCCP_PhotonSync.csscript from the Project window onto the root's Inspector. Its setup adds a PhotonView. - For the supplied demo's spawning method, place the prefab directly inside a Resources folder.
- Add the vehicle to the Photon demo vehicle list and repeat the two-player test.
Open that list with Tools > BoneCracker Games > Realistic Car Controller Pro > Configuration > Photon Demo Vehicles when Demo Content is installed. Without Demo Content, the example uses a prototype vehicle list.
Check: both players can spawn the intended prefab. The supplied demo spawns by prefab name, so placing it in a subfolder under Resources requires changing the spawn path in code.
Optional: custom Photon spawning
After creating the networked car, the demo registers it with RCCP, enables its control and sets the camera target. See API Reference and the installed RCCP_PhotonDemo.cs for the calls. It also removes the previous networked player car before replacing it.
The sync component configures Ownership Transfer: Fixed, Synchronization: Unreliable and Observable Search: Auto Find All when set up. A shared car that different players can enter needs an intentional ownership-transfer setup and game code; adding the enter/exit addon alone does not provide that.
Setting up multiplayer with Mirror
1. Install the integration
- Install Mirror.
- Open Welcome Window > Addons > Mirror > Import Integration.
- Wait for Unity to finish importing and compiling.
Check: the Demos tab offers Blank Mirror.
2. Test the supplied scene
- Open Blank Mirror from the Demos tab.
- Include the scene in the build's scene list.
- Run two game copies on the same local network.
- Start a host on one copy and join it from the other copy's server list.
- Drive on both copies.
Check: both players control their own cars and see each other's movement. The example's discovery list is for the local network; internet hosting requires your own network deployment setup.
The installed scene is in Assets/Realistic Car Controller Pro/Addons/Installed/Mirror/Scenes/.
3. Prepare your own vehicle
- Stop Play Mode and open a working vehicle prefab.
- Drag the
RCCP_MirrorSync.csscript from the Project window onto the vehicle root's Inspector. Its setup adds a NetworkIdentity. - Include the prefab in the integration's vehicle registry.
- Repeat the host/client test.
The demo uses RCCP_DemoVehicles_Mirror.asset with Demo Content, or RCCP_Prototype_Mirror.asset without it. Search for the asset by name in the Project window to select it.
The included network manager registers vehicles from this list as spawnable prefabs. If its Player Prefab is empty, it takes the first vehicle from the list.
Check: joining spawns a controllable car and the camera follows it.
Optional: custom Mirror spawning
Use Mirror's server-side spawning and assign the car to the intended connection. The RCCP sync component registers the local player's vehicle, enables control and targets the camera when the client gains authority.
The automatic vehicle-list setup described above belongs to RCCP's included manager. If you use your own manager, provide the corresponding prefab registration and spawning setup.
If the test fails
| What you see | What to check |
|---|---|
| The Addons card still says Download | Install the networking framework first and resolve compilation errors. |
| Photon never connects | Check the App ID and the first networking error in the Console. |
| Photon cannot find the car prefab | Check its Resources placement and the name/path used by the spawn call. |
| Mirror's server list is empty | Start the host, check both copies are on the same local network, and check connection errors. |
| A spawned car has no control or camera | Check ownership/authority and RCCP player registration. |
| A new player cannot see an existing car | Test prefab registration and spawning on both copies; include a late-join test. |
| Remote cars jump or lag | Check the connection first, then test the smoothing options below. |
| Damage or customization differs | These are not included in the sync stream. |
| Replay will not start | Leave the live networking session first. |
Optional: smooth remote movement
Leave the supplied settings unchanged for the first successful test. Then change one value at a time while watching a remote car.
Interpolation blends toward received positions. Extrapolation predicts movement during gaps between updates.
| Setting | What it controls |
|---|---|
| Teleport Distance Threshold | How far a remote car can be from its target before it snaps into place. |
| Position / Rotation Interpolation Speed | How quickly the remote car approaches received movement. |
| Lag Compensation Time | Additional movement prediction; it still shares the total prediction cap below. |
| Use Extrapolation | Prediction between updates. |
| Max Extrapolation Time | The cap on total prediction, including lag compensation. |
| Use Velocity Smoothing | Whether remote velocity changes are blended. |
| Photon Send Rate / Photon Serialization Rate | Photon packet and state-update rates. These affect the whole connection. |
| Send Rate in Mirror | How often this integration sends vehicle state. |
Increasing prediction is not a universal jitter fix. It can make overshoot worse; test starts, stops, turns and collisions. Photon rate values are written globally when a car starts, so keep them consistent across vehicle prefabs.
Before building your game around it
Repeat the test with a player joining late, a player disconnecting, the host leaving, and a scene transition. A successful initial connection does not test these cases.
The Welcome Window > Keys tab shows integration scripting symbols and warns about missing addon folders. Framework installation and RCCP integration installation are separate steps; avoid manually adding symbols to hide an incomplete install.
Next step
- Scenes and Spawning — how the player car and camera are selected.
- API Reference — calls used by custom spawning code.
- Demo Content — additional example vehicles.