-
Notifications
You must be signed in to change notification settings - Fork 33
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
AWM-17410 Optimize movement component replicated data #61
Conversation
void UPrvVehicleMovementComponent::PrepareOptimizedRepData() | ||
{ | ||
RepEngineRPM = static_cast<uint8>((FMath::Min(EngineRPM, MaxEngineRPM) / MaxEngineRPM) * 255.f); | ||
RepLeftTrackEffectiveAngularSpeed = static_cast<int8>(FMath::Clamp(FMath::RoundHalfFromZero(LeftTrackEffectiveAngularSpeed), -127.f, 127.f)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Точно ли TrackEffectiveAngularSpeed влезет в int8?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Пока гонял не видел чтобы превышало 50 и -20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
50 — это уже половина до допустимого предела. Думаю, здесь лучше тоже передавать с уменьшенной точностью значение, чтобы защититься от overflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IlinAleksey , проконсультируйся с Игорем, как он скажет. Вообще по ощущениям uint8 хватит, просто клэпмить.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IlinAleksey , тогда гуд
|
||
/** Replicated velocity for tracks animation [left] */ | ||
UPROPERTY(Transient, ReplicatedUsing = OnRep_RepLeftTrackEffectiveAngularSpeed) | ||
int8 RepLeftTrackEffectiveAngularSpeed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вообще, я бы запихнул это в структурку все три данных, и в одном онрепе это обрабатывал. Нет смысла делать три онрепа, которые по сути конвертят значения, которые постоянно меняются. Мол, FCosmeticRepData , что-то такое
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
см. коммент, думаю это стоит сделать :)
Занёс в одну структуру |
@@ -2610,6 +2612,21 @@ bool UPrvVehicleMovementComponent::GetCameraVector(FVector& RelativeCameraVector | |||
////////////////////////////////////////////////////////////////////////// | |||
// Replication | |||
|
|||
void UPrvVehicleMovementComponent::PrepareRepCosmeticData() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
давай обзовём UpdateReplicatedCosmeticData() и можно мержить
Просьба внимательнее к мелочам оформления. |
No description provided.