Multiplayer Vehicle Fixes: Difference between revisions
Garthfield (talk | contribs) No edit summary |
Thunder4ik (talk | contribs) m (clean up, added uncategorised, deadend tags) |
||
Line 1: | Line 1: | ||
{{Dead end|date=January 2024}} | |||
These fixes are to correct some issues with using Valves vehicle code in a multiplayer game. | These fixes are to correct some issues with using Valves vehicle code in a multiplayer game. | ||
A true way of doing vehicles in Source Multiplayer would be to write prediction code for the client, but this is not possible with the current engine. The only other option would be to write your own vehicle movement code, which is no easy task for complicated vehicles like the buggy. Research was made into the possibility of predicted physics simulations between the server and client with poor results. Half-Life 2 Rally closed 27 Dec 2006 and has written a list of critical problems they experienced [http://hlrally.net/ here]. | A true way of doing vehicles in Source Multiplayer would be to write prediction code for the client, but this is not possible with the current engine. The only other option would be to write your own vehicle movement code, which is no easy task for complicated vehicles like the buggy. Research was made into the possibility of predicted physics simulations between the server and client with poor results. Half-Life 2 Rally closed 27 Dec 2006 and has written a list of critical problems they experienced [http://hlrally.net/ here]. | ||
Line 6: | Line 7: | ||
A couple of changes will fix the laggy view, but present different issues. One being the cameras position no longer interpolating to where it should. | A couple of changes will fix the laggy view, but present different issues. One being the cameras position no longer interpolating to where it should. | ||
Open '''cl_dll/c_prop_vehicle.cpp''' | Open '''cl_dll/c_prop_vehicle.cpp''' | ||
Find C_PropVehicleDriveable::C_PropVehicleDriveable() constructor. | Find C_PropVehicleDriveable::C_PropVehicleDriveable() constructor. | ||
Line 21: | Line 22: | ||
</pre> | </pre> | ||
Open '''cl_dll/c_prop_vehicle.h''' | |||
Open '''cl_dll/c_prop_vehicle.h''' | |||
In class C_PropVehicleDriveable replace | In class C_PropVehicleDriveable replace | ||
Line 44: | Line 44: | ||
Find void VehicleViewSmoothing | Find void VehicleViewSmoothing | ||
Replace | Replace | ||
Line 74: | Line 73: | ||
</pre> | </pre> | ||
Find C_PropVehicleDriveable::GetVehicleViewPosition | |||
Find C_PropVehicleDriveable::GetVehicleViewPosition | |||
Replace | Replace | ||
Line 110: | Line 108: | ||
It's possible to program a new vehicle camera loosely based around the point_viewcontrol entity that fixes these issues. It's fully functional but is still being developed I have a [https://source-sdk-tutorial.tumblr.com/post/168497972436/13-create-vehicle-camera-part-1 detailed tutorial] on how I created it along with a [https://source-sdk-tutorial.tumblr.com/post/168517969413/now-to-dampen-the-eye-angles-ive-made-several test video] of it in action: | It's possible to program a new vehicle camera loosely based around the point_viewcontrol entity that fixes these issues. It's fully functional but is still being developed I have a [https://source-sdk-tutorial.tumblr.com/post/168497972436/13-create-vehicle-camera-part-1 detailed tutorial] on how I created it along with a [https://source-sdk-tutorial.tumblr.com/post/168517969413/now-to-dampen-the-eye-angles-ive-made-several test video] of it in action: | ||
{{Uncategorized|date=January 2024}} |
Revision as of 10:07, 21 January 2024



January 2024
These fixes are to correct some issues with using Valves vehicle code in a multiplayer game. A true way of doing vehicles in Source Multiplayer would be to write prediction code for the client, but this is not possible with the current engine. The only other option would be to write your own vehicle movement code, which is no easy task for complicated vehicles like the buggy. Research was made into the possibility of predicted physics simulations between the server and client with poor results. Half-Life 2 Rally closed 27 Dec 2006 and has written a list of critical problems they experienced here.
Laggy Vehicle View
A couple of changes will fix the laggy view, but present different issues. One being the cameras position no longer interpolating to where it should.
Open cl_dll/c_prop_vehicle.cpp
Find C_PropVehicleDriveable::C_PropVehicleDriveable() constructor.
Replace
m_ViewSmoothingData.bDampenEyePosition = true;
with
m_ViewSmoothingData.bDampenEyePosition = false;
Open cl_dll/c_prop_vehicle.h
In class C_PropVehicleDriveable replace
virtual bool IsPredicted() const { return false; }
with
virtual bool IsPredicted() const { return true; }
Vehicle Camera affecting other players
A simple fix is to make sure the vehicles view changes only affect the local player.
Open cl_dll/c_prop_vehicle.cpp
(Note: As Of 7/05/2009 Using the Orange Box Source SDK build this section is in file vehicle_viewblend_shared.cpp -- line 291 of function "void SharedVehicleViewSmoothing". I recommend you do not make these changes, it causes compile errors, simply make the edits in the next step (SharedVehicleViewSmoothing function in c_prop_vehicle.cpp) --Digi & tymaxbeta)
Find void VehicleViewSmoothing
Replace
if ( !bExitAnimOn ) { Vector localEyeOrigin; QAngle localEyeAngles; pData->pVehicle->GetAttachmentLocal( eyeAttachmentIndex, localEyeOrigin, localEyeAngles ); engine->SetViewAngles( localEyeAngles ); }
with
if ( pPlayer->IsLocalPlayer() ) { if ( !bExitAnimOn ) { Vector localEyeOrigin; QAngle localEyeAngles; pData->pVehicle->GetAttachmentLocal( eyeAttachmentIndex, localEyeOrigin, localEyeAngles ); engine->SetViewAngles( localEyeAngles ); } }
Find C_PropVehicleDriveable::GetVehicleViewPosition
Replace
VehicleViewSmoothing( m_hPlayer, pAbsOrigin, pAbsAngles, m_bEnterAnimOn, m_bExitAnimOn, &m_vecEyeExitEndpoint, &m_ViewSmoothingData, &m_flFOV );
with
if( m_hPlayer->IsLocalPlayer() ) { VehicleViewSmoothing( m_hPlayer, pAbsOrigin, pAbsAngles, m_bEnterAnimOn, m_bExitAnimOn, &m_vecEyeExitEndpoint, &m_ViewSmoothingData, &m_flFOV ); }
For Orange Box:
Replace
SharedVehicleViewSmoothing( m_hPlayer, pAbsOrigin, pAbsAngles, m_bEnterAnimOn, m_bExitAnimOn, m_vecEyeExitEndpoint, &m_ViewSmoothingData, pFOV );
with
if( m_hPlayer->IsLocalPlayer() ) { SharedVehicleViewSmoothing( m_hPlayer, pAbsOrigin, pAbsAngles, m_bEnterAnimOn, m_bExitAnimOn, m_vecEyeExitEndpoint, &m_ViewSmoothingData, pFOV ); }
Programming new vehicle camera
It's possible to program a new vehicle camera loosely based around the point_viewcontrol entity that fixes these issues. It's fully functional but is still being developed I have a detailed tutorial on how I created it along with a test video of it in action:



January 2024