Removal and Replacement of the CryTimer (gEnv->pTimer) (#5409)
Replaced and removed the CryTimer (gEnv->pTimer). The new TimeSystem is a merger of the current time functionality found in the engine.
* Rename TimeSystemComponent.h/.cpp to TimeSystem.h/.cpp
* Adding New TimeSystem
* remove old timer cvars
* small improvements to the time system.
- updated parts to use the time conversion functions.
- in AdvanceTickDeltaTimes applying t_simulationTickScale is now uses doubles instead of floats.
* Replace gEnv->pTimer / ITimer usages with TimeSystem
* Updating usages of AZ::TimeMs{ 0 } and AZ::TimeUs{ 0 } to AZ::Time::ZeroTimeMs and AZ::Time::ZeroTimeUs
* red code the CryTimer
* using TimeUs instead of TimeMs is some cases + updating usages of old cvars to new
Signed-off-by: amzn-sean <75276488+amzn-sean@users.noreply.github.com>
This commit is contained in:
@@ -66,11 +66,6 @@ namespace Multiplayer
|
||||
}
|
||||
}
|
||||
|
||||
inline double ConvertTimeMsToSeconds(AZ::TimeMs value)
|
||||
{
|
||||
return static_cast<double>(static_cast<AZ::TimeMs>(value)) / 1000.0;
|
||||
}
|
||||
|
||||
void LocalPredictionPlayerInputComponent::LocalPredictionPlayerInputComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
@@ -162,7 +157,7 @@ namespace Multiplayer
|
||||
}
|
||||
|
||||
const AZ::TimeMs currentTimeMs = AZ::GetElapsedTimeMs();
|
||||
const double clientInputRateSec = ConvertTimeMsToSeconds(cl_InputRateMs);
|
||||
const double clientInputRateSec = AZ::TimeMsToSecondsDouble(cl_InputRateMs);
|
||||
m_lastInputReceivedTimeMs = currentTimeMs;
|
||||
|
||||
// Keep track of last inputs received, also allows us to update frame ids
|
||||
@@ -267,7 +262,7 @@ namespace Multiplayer
|
||||
return;
|
||||
}
|
||||
|
||||
const double clientInputRateSec = ConvertTimeMsToSeconds(cl_InputRateMs);
|
||||
const double clientInputRateSec = AZ::TimeMsToSecondsDouble(cl_InputRateMs);
|
||||
|
||||
// Copy array so we can modify input ids
|
||||
NetworkInputMigrationVector inputArrayCopy = inputArray;
|
||||
@@ -342,7 +337,7 @@ namespace Multiplayer
|
||||
// If this correction is for a move outside our input history window, just start replaying from the oldest move we have available
|
||||
const uint32_t startReplayIndex = (inputHistorySize > historicalDelta) ? (inputHistorySize - historicalDelta) : 0;
|
||||
|
||||
const double clientInputRateSec = ConvertTimeMsToSeconds(cl_InputRateMs);
|
||||
const double clientInputRateSec = AZ::TimeMsToSecondsDouble(cl_InputRateMs);
|
||||
for (uint32_t replayIndex = startReplayIndex; replayIndex < inputHistorySize; ++replayIndex)
|
||||
{
|
||||
// Reprocess the input for this frame
|
||||
@@ -423,9 +418,9 @@ namespace Multiplayer
|
||||
|
||||
void LocalPredictionPlayerInputComponentController::UpdateAutonomous(AZ::TimeMs deltaTimeMs)
|
||||
{
|
||||
const double deltaTime = ConvertTimeMsToSeconds(deltaTimeMs);
|
||||
const double clientInputRateSec = ConvertTimeMsToSeconds(cl_InputRateMs);
|
||||
const double maxRewindHistory = ConvertTimeMsToSeconds(cl_MaxRewindHistoryMs);
|
||||
const double deltaTime = AZ::TimeMsToSecondsDouble(deltaTimeMs);
|
||||
const double clientInputRateSec = AZ::TimeMsToSecondsDouble(cl_InputRateMs);
|
||||
const double maxRewindHistory = AZ::TimeMsToSecondsDouble(cl_MaxRewindHistoryMs);
|
||||
|
||||
#ifndef AZ_RELEASE_BUILD
|
||||
m_moveAccumulator += deltaTime * cl_DebugHackTimeMultiplier;
|
||||
|
||||
Reference in New Issue
Block a user