From ed7ce1429fceb63220b798a2463afafc6965e43b Mon Sep 17 00:00:00 2001 From: in0finite Date: Mon, 27 May 2019 20:27:47 +0200 Subject: [PATCH] Improvements --- .../Behaviours/Ped/States/BaseVehicleState.cs | 13 +++++++++---- Docs/Multiplayer.md | 12 ++++++++---- Docs/TODO.md | 2 ++ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Assets/Scripts/Behaviours/Ped/States/BaseVehicleState.cs b/Assets/Scripts/Behaviours/Ped/States/BaseVehicleState.cs index baa83fdf..8296dafe 100644 --- a/Assets/Scripts/Behaviours/Ped/States/BaseVehicleState.cs +++ b/Assets/Scripts/Behaviours/Ped/States/BaseVehicleState.cs @@ -54,16 +54,20 @@ namespace SanAndreasUnity.Behaviours.Peds.States yield return new WaitForEndOfFrame(); - if (oldState != m_ped.CurrentState) // state changed in the meantime + if (oldState != m_ped.CurrentState) { - Debug.LogFormat("state changed in the meantime, old: {0}, new: {1}", oldState != null ? oldState.GetType().Name : "", - m_ped.CurrentState != null ? m_ped.CurrentState.GetType().Name : ""); + // state changed in the meantime + // did server change it ? or syncvar hooks invoked twice ? either way, we should stop here + + // Debug.LogFormat("state changed in the meantime, old: {0}, new: {1}", oldState != null ? oldState.GetType().Name : "", + // m_ped.CurrentState != null ? m_ped.CurrentState.GetType().Name : ""); yield break; } + // read current vehicle here - it should've been spawned by now this.ReadNetworkData(data); - Debug.LogFormat("Switching to state {0}, vehicle: {1}, seat: {2}", this.GetType().Name, this.CurrentVehicle, this.CurrentVehicleSeat); + // Debug.LogFormat("Switching to state {0}, vehicle: {1}, seat: {2}", this.GetType().Name, this.CurrentVehicle, this.CurrentVehicleSeat); // now we can enter this state m_ped.SwitchState(this.GetType()); @@ -113,6 +117,7 @@ namespace SanAndreasUnity.Behaviours.Peds.States if (m_ped.IsInVehicle) return false; + // this should be removed if (m_ped.IsAiming || m_ped.WeaponHolder.IsFiring) return false; diff --git a/Docs/Multiplayer.md b/Docs/Multiplayer.md index 8cfb5a38..4c1d6869 100644 --- a/Docs/Multiplayer.md +++ b/Docs/Multiplayer.md @@ -20,14 +20,18 @@ - **vehicle syncing is too laggy** - local player must control the rigid body ; server will validate position/rotation/velocity changes, and correct them if needed ; when server detects collision, or applies force to rigid body, he will override state of rigid body ; -- try to sync rigid body forces, or just clear them on clients +- try to sync rigid body forces, or just clear them on clients ? - will this help ? are forces cleared at the end of frame by physics engine ? -- all settings should take effect immediately, not after spawning a vehicle +- add option to disable rigid body on local player ? - applying position/rotation from syncvar hooks needs to be changed ? + +- add option to disable wheel colliders + +- add current ped state to player stats + +- change default ped sync rate to 20 - OutOfRangeDestroyer script should be destroyed on clients ; also, it should not be attached to peds owned by players ; -- stats window - - display a message to user when network is stopped diff --git a/Docs/TODO.md b/Docs/TODO.md index 98cada2e..63dcf52e 100644 --- a/Docs/TODO.md +++ b/Docs/TODO.md @@ -20,6 +20,8 @@ - Add more obstacles in demo scene +- Remove world stats window + - Add option to change fixed delta time - Crouching: adjust camera aim offset ? ;