Space Plunder
Loading...
Searching...
No Matches
OptimizationComponent.h
Go to the documentation of this file.
1// Copyright (C) 2021-2023 Space Raccoon Game Studio. All rights reserved. Contacts: <business@space-raccoon.com>
2// Created by AfroStalin
3
4#pragma once
5
6#include "CoreMinimal.h"
8#include "Components/ActorComponent.h"
9#include "Components/SkinnedMeshComponent.h"
10#include "Components/StaticMeshComponent.h"
11#include "HAL/ThreadSafeBool.h"
12#include "OptimizationComponent.generated.h"
13
15
16UCLASS(BlueprintType, Blueprintable, Category = "NPC Optimizator", ClassGroup="NPCOptimizator", DisplayName="NPC Optimization Component", meta=(BlueprintSpawnableComponent),
17 HideCategories=(ComponentReplication, Activation, Replication, Collision, Sockets, Tags))
18class NPC_OPTIMIZATOR_API UOptimizationProxyComponent : public UActorComponent, public IOptimizationProxy
19{
20 GENERATED_BODY()
21public:
22 UOptimizationProxyComponent();
23public:
24 // UActorComponent
25 virtual void BeginPlay() override;
26 virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
27 virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
28 //~UActorComponent
29
30#if WITH_EDITOR
31 virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
32#endif
33public:
34 // IOptimizationProxy
35 virtual EOptimizationBaseType GetOptimizationBasedType() const override;
36 virtual AActor* GetOwnerActor() override;
37 virtual float GetMaxVisibleDistance() const override;
38 virtual float GetDistToWave(EOptimizationWave Wave) const override;
39 virtual bool IsIgnoreCameraSightOnSmallDistance() const override;
40 virtual bool IsForceOptimizationWaveEnabled() const override;
41 //~IOptimizationProxy
42public:
43 int32 GetOptimizationHandle() const { return OptimizationHandle; }
44 EOptimizationWave GetOptimizationWave() const;
45
46 void SetOptimizationHandle(int32 Handle) { OptimizationHandle = Handle; }
47 void SetOptimizationWave(EOptimizationWave Wave);
48
49 void SetIsNeedToBeOptimized(bool NeedToOptimize);
50 bool IsNeedToBeOptimized() const;
51
52 void OptimizeComponent();
53public:
54 // Execute this function for disable all optimization for current owner
55 UFUNCTION(BlueprintCallable, Category = "NPC Optimizator")
56 void DisableAllOptimizations();
57
58 // Execute this function for enable optimization after disabling it
59 UFUNCTION(BlueprintCallable, Category = "NPC Optimizator")
60 void EnableOptimizations();
61
62 // Execute this function for force set optimization wave
63 UFUNCTION(BlueprintCallable, Category = "NPC Optimizator")
64 void EnableForceOptimizationWave(EOptimizationWave Wave, bool Enable);
65public:
66 // The distance from the player to the bots at which the first optimization level is enabled.
67 // Bots closer than this distance are not optimized
68 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization", DisplayName="Distance to first wave")
69 float DistanceToFirstOptimization = 1500.f;
70
71 // The distance from the player to the bots at which the second level of optimizations is enabled.
72 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization", DisplayName="Distance to second wave")
73 float DistanceToSecondOptimization = 2500.f;
74
75 // The distance from the player to the bots at which the third level of optimizations is enabled.
76 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization", DisplayName="Distance to third wave")
77 float DistanceToThirdOptimization = 3500.f;
78
79 // Bots outside this distance will be hidden and simplified as much as possible
80 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization", DisplayName="Max visible distance")
81 float MaxVisibleDistance = 8000.f;
82
83 // Optimization is based on the distance from the player's pawn or camera
84 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization", DisplayName="Optimization type")
85 EOptimizationBaseType OptimizationBasedOn = EOptimizationBaseType::PlayerPawn;
86
87 // If you want optimize only component with special tag - enable it
88 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization", DisplayName="Use optimization by tag")
89 bool UseOptimizationByTag = false;
90
91 // Special tag for component needed for optimization it
92 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization", DisplayName="Optimization tag", meta=(EditCondition=UseOptimizationByTag))
93 FName OptimizationTag = "NeedOptimization";
94
95 // Special tag to ignore any component optimizations
96 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization", DisplayName="Ignore optimization tag")
97 FName IgnoreOptimizationTag = "IgnoreOptimization";
98
99 // If you want stop NPC movement when it not visible
100 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization", DisplayName = "Disable movement when invisible")
101 bool DisableMovementWhenNotVisible = false;
102
103 // Enable this setting in order to ignore the calculation of the visibility of NPCs by the camera and calculate only by distance.
104 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization", DisplayName = "Ignore camera sight")
105 bool IgnoreCameraSight = false;
106
107 // Ignore camera visibility when bots are close to the player
108 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization", DisplayName = "Ignore camera sight in 'no optimization' wave")
109 bool IgnoreCameraSightOnSmallDistance = false;
110
111 // Enabling this setting gives you more frames per second, but when mesh switch from invisibility back to visibility, the number of frames may drop slightly
112 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization", DisplayName = "Disable skeletal mesh tick when invisible")
113 bool DisableSkeletalMeshTickWhenNotVisible = false;
114
115 // If you want hide all static meshes attached to skeletal meshes
116 // If you need hide only special static meshes use Optimization Tag for it
117 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization", DisplayName = "Hide all attached static meshes")
118 bool HideAllStaticMeshes = true;
119public:
120 // Movement component need always check floor on this wave?
121 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Movement", DisplayName = "Always check floor")
122 bool FirstWave_AlwaysCheckFloor = true;
123
124 // Enable physics interaction on this wave
125 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Movement", DisplayName = "Enable physics interaction")
126 bool FirstWave_EnablePhysicsInteraction = true;
127
128 // Max simulation time step
129 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Movement", DisplayName = "Max simulation time step")
130 float FirstWave_MaxSimulationTimeStep = 0.025f;
131
132 // Max simulation iterations
133 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Movement", DisplayName = "Max simulation iterations")
134 int32 FirstWave_MaxSimulationIterations = 4;
135
136 // Run physics with no controller
137 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Movement", DisplayName = "Run physics with no controller")
138 bool FirstWave_RunPhysicsWithNoController = true;
139
140 // Movement mode on this wave
141 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Movement", DisplayName = "Movement mode")
142 TEnumAsByte<EMovementMode> FirstWave_MovementMode = EMovementMode::MOVE_NavWalking;
143
144 // Whether or not the character should sweep for collision geometry while walking
145 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Movement", DisplayName = "Sweep while nav walking")
146 bool FirstWave_SweepWhileNavWalking = true;
147public:
148 // Movement component tick rate when random tick not used
149 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Movement", DisplayName = "Fixed movement tick")
150 float FirstWave_OptimizatedMovementTick = 0.05f;
151
152 // Movement component min tick rate when random tick enabled
153 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Movement", DisplayName = "Min movement random tick")
154 float FirstWave_OptimizatedMovementTickMin = 0.01f;
155
156 // Movement component max tick rate when random tick enabled
157 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Movement", DisplayName = "Max movement random tick")
158 float FirstWave_OptimizatedMovementTickMax = 0.05f;
159
160 // Use random tick for movement
161 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Movement", DisplayName = "Use random movement tick")
162 bool FirstWave_UseRandomOptimizationTickForMovement = true;
163public:
164 // Hide shadows from skeletal mesh on this wave
165 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Skeletal meshes", DisplayName = "Hide shadows")
166 bool FirstWave_HideShadows = false;
167
168 // Disable skeletal meshes collision on this wave
169 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Skeletal meshes", DisplayName = "Disable mesh collision")
170 bool FirstWave_DisableMeshCollision = false;
171
172 // Whether or not the character should hide attached static meshes on this wave
173 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Skeletal meshes", DisplayName = "Need hide static meshes")
174 bool FirstWave_NeedHideStaticMeshes = false;
175
176 // Use update rate optimizations for skeletal meshes on this wave
177 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Skeletal meshes", DisplayName = "Use URO")
178 bool FirstWave_UseUpdateRateOptimizations = true;
179
180 // Use per bone motion blur for skeletal meshes on this wave
181 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Skeletal meshes", DisplayName = "Use per bone motion blur")
182 bool FirstWave_UsePerBoneMotionBlur = true;
183
184 // Disable cloth simulation for skeletal meshes on this wave
185 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Skeletal meshes", DisplayName = "Disable cloth simulation")
186 bool FirstWave_DisableClothSimulation = true;
187
188 // Disable morph target simulation for skeletal meshes on this wave
189 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Skeletal meshes", DisplayName = "Disable morph target")
190 bool FirstWave_DisableMorphTarget = true;
191
192 // Skip kinematic update when interpolating for skeletal meshes on this wave
193 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Skeletal meshes", DisplayName = "Skip kinematic update when interpolating")
194 bool FirstWave_SkipKinematicUpdateWhenInterpolating = true;
195
196 // Skip bounds update when interpolating for skeletal meshes on this wave
197 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Skeletal meshes", DisplayName = "Skip bounds update when interpolating")
198 bool FirstWave_SkipBoundsUpdateWhenInterpolating = true;
199
200 // Allow rigid body anim node for skeletal meshes on this wave
201 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Skeletal meshes", DisplayName = "Allow rigid body anim node")
202 bool FirstWave_AllowRigidBodyAnimNode = true;
203
204 // Generate overlap events?
205 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Skeletal meshes", DisplayName = "Generate overlap events")
206 bool FirstWave_GenerateOverlapEvents = true;
207
208 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|First wave|Skeletal meshes", DisplayName = "Visibility Based Anim Tick Option")
209 EVisibilityBasedAnimTickOption FirstWave_VisibilityBasedAnimTickOption = EVisibilityBasedAnimTickOption::OnlyTickPoseWhenRendered;
210public:
211 // Movement component need always check floor on this wave?
212 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Movement", DisplayName = "Always check floor")
213 bool SecondWave_AlwaysCheckFloor = false;
214
215 // Enable physics interaction on this wave
216 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Movement", DisplayName = "Enable physics interaction")
217 bool SecondWave_EnablePhysicsInteraction = false;
218
219 // Max simulation time step
220 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Movement", DisplayName = "Max simulation time step")
221 float SecondWave_MaxSimulationTimeStep = 0.035f;
222
223 // Max simulation iterations
224 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Movement", DisplayName = "Max simulation iterations")
225 int32 SecondWave_MaxSimulationIterations = 2;
226
227 // Run physics with no controller
228 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Movement", DisplayName = "Run physics with no controller")
229 bool SecondWave_RunPhysicsWithNoController = false;
230
231 // Movement mode on this wave
232 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Movement", DisplayName = "Movement mode")
233 TEnumAsByte<EMovementMode> SecondWave_MovementMode = EMovementMode::MOVE_NavWalking;
234
235 // Whether or not the character should sweep for collision geometry while walking
236 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Movement", DisplayName = "Sweep while nav walking")
237 bool SecondWave_SweepWhileNavWalking = false;
238public:
239 // Movement component tick rate when random tick not used
240 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Movement", DisplayName = "Fixed movement tick")
241 float SecondWave_OptimizatedMovementTick = 0.1f;
242
243 // Movement component min tick rate when random tick enabled
244 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Movement", DisplayName = "Min movement random tick")
245 float SecondWave_OptimizatedMovementTickMin = 0.05f;
246
247 // Movement component max tick rate when random tick enabled
248 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Movement", DisplayName = "Max movement random tick")
249 float SecondWave_OptimizatedMovementTickMax = 0.1f;
250
251 // Use random tick for movement
252 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Movement", DisplayName = "Use random movement tick")
253 bool SecondWave_UseRandomOptimizationTickForMovement = true;
254public:
255 // Hide shadows from skeletal mesh on this wave
256 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Skeletal meshes", DisplayName = "Hide shadows")
257 bool SecondWave_HideShadows = true;
258
259 // Disable skeletal meshes collision on this wave
260 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Skeletal meshes", DisplayName = "Disable mesh collision")
261 bool SecondWave_DisableMeshCollision = true;
262
263 // Whether or not the character should hide attached static meshes on this wave
264 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Skeletal meshes", DisplayName = "Need hide static meshes")
265 bool SecondWave_NeedHideStaticMeshes = true;
266
267 // Use update rate optimizations for skeletal meshes on this wave
268 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Skeletal meshes", DisplayName = "Use URO")
269 bool SecondWave_UseUpdateRateOptimizations = true;
270
271 // Use per bone motion blur for skeletal meshes on this wave
272 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Skeletal meshes", DisplayName = "Use per bone motion blur")
273 bool SecondWave_UsePerBoneMotionBlur = false;
274
275 // Disable cloth simulation for skeletal mesh
276 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Skeletal meshes", DisplayName = "Disable cloth simulation")
277 bool SecondWave_DisableClothSimulation = true;
278
279 // Disable morph target simulation for skeletal mesh
280 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Skeletal meshes", DisplayName = "Disable morph target")
281 bool SecondWave_DisableMorphTarget = true;
282
283 // Skip kinematic update when interpolating for skeletal meshes on this wave
284 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Skeletal meshes", DisplayName = "Skip kinematic update when interpolating")
285 bool SecondWave_SkipKinematicUpdateWhenInterpolating = true;
286
287 // Skip bounds update when interpolating for skeletal meshes on this wave
288 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Skeletal meshes", DisplayName = "Skip bounds update when interpolating")
289 bool SecondWave_SkipBoundsUpdateWhenInterpolating = true;
290
291 // Allow rigid body anim node for skeletal meshes on this wave
292 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Skeletal meshes", DisplayName = "Allow rigid body anim node")
293 bool SecondWave_AllowRigidBodyAnimNode = false;
294
295 // Generate overlap events?
296 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Skeletal meshes", DisplayName = "Generate overlap events")
297 bool SecondWave_GenerateOverlapEvents = false;
298
299 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Second wave|Skeletal meshes", DisplayName = "Visibility Based Anim Tick Option")
300 EVisibilityBasedAnimTickOption SecondWave_VisibilityBasedAnimTickOption = EVisibilityBasedAnimTickOption::OnlyTickPoseWhenRendered;
301public:
302 // Movement component need always check floor on this wave?
303 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Movement", DisplayName = "Always check floor")
304 bool ThirdWave_AlwaysCheckFloor = false;
305
306 // Enable physics interaction on this wave
307 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Movement", DisplayName = "Enable physics interaction")
308 bool ThirdWave_EnablePhysicsInteraction = false;
309
310 // Max simulation time step
311 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Movement", DisplayName = "Max simulation time step")
312 float ThirdWave_MaxSimulationTimeStep = 0.05f;
313
314 // Max simulation iterations
315 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Movement", DisplayName = "Max simulation iterations")
316 int32 ThirdWave_MaxSimulationIterations = 1;
317
318 // Run physics with no controller
319 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Movement", DisplayName = "Run physics with no controller")
320 bool ThirdWave_RunPhysicsWithNoController = false;
321
322 // Movement mode on this wave
323 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Movement", DisplayName = "Movement mode")
324 TEnumAsByte<EMovementMode> ThirdWave_MovementMode = EMovementMode::MOVE_NavWalking;
325
326 // Whether or not the character should sweep for collision geometry while walking
327 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Movement", DisplayName = "Sweep while nav walking")
328 bool ThirdWave_SweepWhileNavWalking = false;
329public:
330 // Movement component tick rate when random tick not used
331 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Movement", DisplayName = "Fixed movement tick")
332 float ThirdWave_OptimizatedMovementTick = 0.2f;
333
334 // Movement component min tick rate when random tick enabled
335 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Movement", DisplayName = "Min movement random tick")
336 float ThirdWave_OptimizatedMovementTickMin = 0.1f;
337
338 // Movement component max tick rate when random tick enabled
339 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Movement", DisplayName = "Max movement random tick")
340 float ThirdWave_OptimizatedMovementTickMax = 0.2f;
341
342 // Use random tick for movement
343 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Movement", DisplayName = "Use random movement tick")
344 bool ThirdWave_UseRandomOptimizationTickForMovement = true;
345public:
346 // Hide shadows from skeletal mesh on this wave
347 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Skeletal meshes", DisplayName = "Hide shadows")
348 bool ThirdWave_HideShadows = true;
349
350 // Disable skeletal meshes collision on this wave
351 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Skeletal meshes", DisplayName = "Disable mesh collision")
352 bool ThirdWave_DisableMeshCollision = true;
353
354 // Whether or not the character should hide attached static meshes on this wave
355 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Skeletal meshes", DisplayName = "Need hide static meshes")
356 bool ThirdWave_NeedHideStaticMeshes = true;
357
358 // Use update rate optimizations for skeletal meshes on this wave
359 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Skeletal meshes", DisplayName = "Use URO")
360 bool ThirdWave_UseUpdateRateOptimizations = true;
361
362 // Use per bone motion blur for skeletal meshes on this wave
363 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Skeletal meshes", DisplayName = "Use per bone motion blur")
364 bool ThirdWave_UsePerBoneMotionBlur = false;
365
366 // Disable cloth simulation for skeletal mesh
367 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Skeletal meshes", DisplayName = "Disable cloth simulation")
368 bool ThirdWave_DisableClothSimulation = true;
369
370 // Disable morph target simulation for skeletal mesh
371 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Skeletal meshes", DisplayName = "Disable morph target")
372 bool ThirdWave_DisableMorphTarget = true;
373
374 // Skip kinematic update when interpolating for skeletal meshes on this wave
375 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Skeletal meshes", DisplayName = "Skip kinematic update when interpolating")
376 bool ThirdWave_SkipKinematicUpdateWhenInterpolating = true;
377
378 // Skip bounds update when interpolating for skeletal meshes on this wave
379 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Skeletal meshes", DisplayName = "Skip bounds update when interpolating")
380 bool ThirdWave_SkipBoundsUpdateWhenInterpolating = true;
381
382 // Allow rigid body anim node for skeletal meshes on this wave
383 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Skeletal meshes", DisplayName = "Allow rigid body anim node")
384 bool ThirdWave_AllowRigidBodyAnimNode = false;
385
386 // Generate overlap events?
387 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Skeletal meshes", DisplayName = "Generate overlap events")
388 bool ThirdWave_GenerateOverlapEvents = false;
389
390 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Third wave|Skeletal meshes", DisplayName = "Visibility Based Anim Tick Option")
391 EVisibilityBasedAnimTickOption ThirdWave_VisibilityBasedAnimTickOption = EVisibilityBasedAnimTickOption::OnlyTickPoseWhenRendered;
392public:
393 // Movement component need always check floor on this wave?
394 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Movement", DisplayName = "Always check floor")
395 bool Invisible_AlwaysCheckFloor = false;
396
397 // Enable physics interaction on this wave
398 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Movement", DisplayName = "Enable physics interaction")
399 bool Invisible_EnablePhysicsInteraction = false;
400
401 // Max simulation time step
402 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Movement", DisplayName = "Max simulation time step")
403 float Invisible_MaxSimulationTimeStep = 0.5f;
404
405 // Max simulation iterations
406 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Movement", DisplayName = "Max simulation iterations")
407 int32 Invisible_MaxSimulationIterations = 1;
408
409 // Run physics with no controller
410 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Movement", DisplayName = "Run physics with no controller")
411 bool Invisible_RunPhysicsWithNoController = false;
412
413 // Movement mode on this wave
414 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Movement", DisplayName = "Movement mode")
415 TEnumAsByte<EMovementMode> Invisible_MovementMode = EMovementMode::MOVE_NavWalking;
416
417 // Whether or not the character should sweep for collision geometry while walking
418 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Movement", DisplayName = "Sweep while nav walking")
419 bool Invisible_SweepWhileNavWalking = false;
420public:
421 // Movement component tick rate when random tick not used
422 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Movement", DisplayName = "Fixed movement tick")
423 float Invisible_OptimizatedMovementTick = 1.f;
424
425 // Movement component min tick rate when random tick enabled
426 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Movement", DisplayName = "Min movement random tick")
427 float Invisible_OptimizatedMovementTickMin = 1.f;
428
429 // Movement component max tick rate when random tick enabled
430 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Movement", DisplayName = "Max movement random tick")
431 float Invisible_OptimizatedMovementTickMax = 1.5f;
432
433 // Use random tick for movement
434 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Movement", DisplayName = "Use random movement tick")
435 bool Invisible_UseRandomOptimizationTickForMovement = true;
436public:
437 // Hide skeletal mesh when it not visible for player
438 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Skeletal meshes", DisplayName = "Hide skeletal mesh")
439 bool Invisible_HideSkeletalMesh = true;
440
441 // Hide shadows from skeletal mesh on this wave
442 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Skeletal meshes", DisplayName = "Hide shadows")
443 bool Invisible_HideShadows = true;
444
445 // Disable skeletal meshes collision on this wave
446 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Skeletal meshes", DisplayName = "Disable mesh collision")
447 bool Invisible_DisableMeshCollision = true;
448
449 // Whether or not the character should hide attached static meshes on this wave
450 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Skeletal meshes", DisplayName = "Need hide static meshes")
451 bool Invisible_NeedHideStaticMeshes = true;
452
453 // Use update rate optimizations for skeletal meshes on this wave
454 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Skeletal meshes", DisplayName = "Use URO")
455 bool Invisible_UseUpdateRateOptimizations = true;
456
457 // Use per bone motion blur for skeletal meshes on this wave
458 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Skeletal meshes", DisplayName = "Use per bone motion blur")
459 bool Invisible_UsePerBoneMotionBlur = false;
460
461 // Disable cloth simulation for skeletal mesh
462 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Skeletal meshes", DisplayName = "Disable cloth simulation")
463 bool Invisible_DisableClothSimulation = true;
464
465 // Disable morph target simulation for skeletal mesh
466 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Skeletal meshes", DisplayName = "Disable morph target")
467 bool Invisible_DisableMorphTarget = true;
468
469 // Skip kinematic update when interpolating for skeletal meshes on this wave
470 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Skeletal meshes", DisplayName = "Skip kinematic update when interpolating")
471 bool Invisible_SkipKinematicUpdateWhenInterpolating = true;
472
473 // Skip bounds update when interpolating for skeletal meshes on this wave
474 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Skeletal meshes", DisplayName = "Skip bounds update when interpolating")
475 bool Invisible_SkipBoundsUpdateWhenInterpolating = true;
476
477 // Allow rigid body anim node for skeletal meshes on this wave
478 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Skeletal meshes", DisplayName = "Allow rigid body anim node")
479 bool Invisible_AllowRigidBodyAnimNode = false;
480
481 // Generate overlap events?
482 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Invisible|Skeletal meshes", DisplayName = "Generate overlap events")
483 bool Invisible_GenerateOverlapEvents = false;
484public:
485 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Debug draw")
486 bool NoOptimization_DrawDebug = false;
487
488 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Debug draw")
489 bool FirstWave_DrawDebug = false;
490
491 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Debug draw")
492 bool SecondWave_DrawDebug = false;
493
494 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Debug draw")
495 bool ThirdWave_DrawDebug = false;
496
497 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Optimization|Debug draw")
498 bool Invisible_DrawDebug = false;
499public:
501 UPROPERTY(BlueprintAssignable, Category = "Optimization")
502 FOptimizationChangeWave OnChangeWave;
503protected:
504 void OptimizeSkeletalMeshes(EOptimizationWave Wave);
505 void OptimizeMovement(EOptimizationWave Wave) const;
506public:
507 FSDefaultMovementSettings MovementSettings;
508private:
509 mutable FCriticalSection LockCS;
510 int32 OptimizationHandle = INDEX_NONE;
511 EOptimizationWave OptimizationWave = EOptimizationWave::NoOptimization;
512 EOptimizationWave PreviousWave = EOptimizationWave::NoOptimization;
513 FThreadSafeBool bIsNeedToBeOptimized = false;
514 bool bIsForceOptimizationWaveEnabled = false;
515 TArray<FSOptimizedComponent> ComponentsForOptimization;
516};
@ Use
Definition InteractionComponent.cpp:798
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
EOptimizationBaseType
Definition NPC_Optimizator_Types.h:22
EOptimizationWave
Definition NPC_Optimizator_Types.h:12
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOptimizationChangeWave, EOptimizationWave, NewWave)
Definition NPC_Optimizator_Types.h:49
Definition NPC_Optimizator_Types.h:73
Definition NPC_Optimizator_Types.h:88
virtual bool IsIgnoreCameraSightOnSmallDistance() const =0
virtual float GetMaxVisibleDistance() const =0
virtual float GetDistToWave(EOptimizationWave Wave) const =0
virtual AActor * GetOwnerActor()=0
virtual bool IsForceOptimizationWaveEnabled() const =0
virtual EOptimizationBaseType GetOptimizationBasedType() const =0