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

AWM-17410 Optimize movement component replicated data #61

Merged
merged 5 commits into from
Aug 27, 2018

Conversation

IlinAleksey
Copy link
Contributor

No description provided.

@IlinAleksey IlinAleksey requested a review from ufna August 22, 2018 11:14
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));
Copy link
Contributor

@Antonrr Antonrr Aug 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Точно ли TrackEffectiveAngularSpeed влезет в int8?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пока гонял не видел чтобы превышало 50 и -20

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

50 — это уже половина до допустимого предела. Думаю, здесь лучше тоже передавать с уменьшенной точностью значение, чтобы защититься от overflow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IlinAleksey , проконсультируйся с Игорем, как он скажет. Вообще по ощущениям uint8 хватит, просто клэпмить.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Antonrr так ведь идёт клэмп [-127, 127]. overflow не будет, можем потерять значения больше 127 и меньше -127
@ufna спросил, на практике не замечал что доходило до 100. Если и будет доходить и переходить, то не страшно что мы обрежем до 127.

Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вообще, я бы запихнул это в структурку все три данных, и в одном онрепе это обрабатывал. Нет смысла делать три онрепа, которые по сути конвертят значения, которые постоянно меняются. Мол, FCosmeticRepData , что-то такое

Copy link
Member

@ufna ufna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

см. коммент, думаю это стоит сделать :)

@IlinAleksey
Copy link
Contributor Author

Занёс в одну структуру

@@ -2610,6 +2612,21 @@ bool UPrvVehicleMovementComponent::GetCameraVector(FVector& RelativeCameraVector
//////////////////////////////////////////////////////////////////////////
// Replication

void UPrvVehicleMovementComponent::PrepareRepCosmeticData()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

давай обзовём UpdateReplicatedCosmeticData() и можно мержить

@ufna
Copy link
Member

ufna commented Aug 27, 2018

Просьба внимательнее к мелочам оформления.

@ufna ufna merged commit 7d40843 into PushkinStudio:develop Aug 27, 2018
@IlinAleksey IlinAleksey deleted the feature/AWM-17410 branch August 27, 2018 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants