Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed server physics when server has custom tickrate #515

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mp/src/game/client/physics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void PhysicsLevelInit( void )
physenv->SetGravity( Vector(0, 0, -GetCurrentGravity() ) );
// 15 ms per tick
// NOTE: Always run client physics at this rate - helps keep ragdolls stable
physenv->SetSimulationTimestep( IsXbox() ? DEFAULT_XBOX_CLIENT_VPHYSICS_TICK : DEFAULT_TICK_INTERVAL );
physenv->SetSimulationTimestep( IsXbox() ? DEFAULT_XBOX_CLIENT_VPHYSICS_TICK : gpGlobals->interval_per_tick );
physenv->SetCollisionEventHandler( &g_Collisions );
physenv->SetCollisionSolver( &g_Collisions );

Expand Down
6 changes: 3 additions & 3 deletions mp/src/game/server/physics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void CPhysicsHook::LevelInitPreEntity()

physenv->SetObjectEventHandler( &g_Collisions );

physenv->SetSimulationTimestep( DEFAULT_TICK_INTERVAL ); // 15 ms per tick
physenv->SetSimulationTimestep( gpGlobals->interval_per_tick ); // 15 ms per tick
// HL Game gravity, not real-world gravity
physenv->SetGravity( Vector( 0, 0, -GetCurrentGravity() ) );
g_PhysAverageSimTime = 0;
Expand Down Expand Up @@ -1606,7 +1606,7 @@ CON_COMMAND( physics_budget, "Times the cost of each active object" )
float totalTime = 0.f;
g_Collisions.BufferTouchEvents( true );
float full = engine->Time();
physenv->Simulate( DEFAULT_TICK_INTERVAL );
physenv->Simulate( gpGlobals->interval_per_tick );
full = engine->Time() - full;
float lastTime = full;

Expand All @@ -1623,7 +1623,7 @@ CON_COMMAND( physics_budget, "Times the cost of each active object" )
PhysForceEntityToSleep( ents[j], ents[j]->VPhysicsGetObject() );
}
float start = engine->Time();
physenv->Simulate( DEFAULT_TICK_INTERVAL );
physenv->Simulate( gpGlobals->interval_per_tick );
float end = engine->Time();

float elapsed = end - start;
Expand Down
2 changes: 1 addition & 1 deletion sp/src/game/client/physics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void PhysicsLevelInit( void )
physenv->SetGravity( Vector(0, 0, -GetCurrentGravity() ) );
// 15 ms per tick
// NOTE: Always run client physics at this rate - helps keep ragdolls stable
physenv->SetSimulationTimestep( IsXbox() ? DEFAULT_XBOX_CLIENT_VPHYSICS_TICK : DEFAULT_TICK_INTERVAL );
physenv->SetSimulationTimestep( IsXbox() ? DEFAULT_XBOX_CLIENT_VPHYSICS_TICK : gpGlobals->interval_per_tick );
physenv->SetCollisionEventHandler( &g_Collisions );
physenv->SetCollisionSolver( &g_Collisions );

Expand Down
6 changes: 3 additions & 3 deletions sp/src/game/server/physics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void CPhysicsHook::LevelInitPreEntity()

physenv->SetObjectEventHandler( &g_Collisions );

physenv->SetSimulationTimestep( DEFAULT_TICK_INTERVAL ); // 15 ms per tick
physenv->SetSimulationTimestep( gpGlobals->interval_per_tick ); // 15 ms per tick
// HL Game gravity, not real-world gravity
physenv->SetGravity( Vector( 0, 0, -GetCurrentGravity() ) );
g_PhysAverageSimTime = 0;
Expand Down Expand Up @@ -1606,7 +1606,7 @@ CON_COMMAND( physics_budget, "Times the cost of each active object" )
float totalTime = 0.f;
g_Collisions.BufferTouchEvents( true );
float full = engine->Time();
physenv->Simulate( DEFAULT_TICK_INTERVAL );
physenv->Simulate( gpGlobals->interval_per_tick );
full = engine->Time() - full;
float lastTime = full;

Expand All @@ -1623,7 +1623,7 @@ CON_COMMAND( physics_budget, "Times the cost of each active object" )
PhysForceEntityToSleep( ents[j], ents[j]->VPhysicsGetObject() );
}
float start = engine->Time();
physenv->Simulate( DEFAULT_TICK_INTERVAL );
physenv->Simulate( gpGlobals->interval_per_tick );
float end = engine->Time();

float elapsed = end - start;
Expand Down