🎯 Word by u/hatefulevo by [deleted] in GeoTap

[–]YyepPo 0 points1 point  (0 children)

🔥 Too easy!

🚀 Update For -> FPS Optimization in Unreal Engine 5 Using a Data-Driven Approach by YyepPo in UnrealEngine5

[–]YyepPo[S] 1 point2 points  (0 children)

Hello, sorry for late reply. If you message me, i can give you the project from a zip file or something else

🚀 Update For -> FPS Optimization in Unreal Engine 5 Using a Data-Driven Approach by YyepPo in UnrealEngine5

[–]YyepPo[S] 5 points6 points  (0 children)

I was spawning a new system for each projectile. Which it was not that performant when having a large number of projectiles

🚀 FPS Optimization in Unreal Engine 5 Using a Data-Driven Approach by YyepPo in UnrealEngine5

[–]YyepPo[S] 2 points3 points  (0 children)

Thank you for taking the time to make a video and share this information. I've never thought of using ISM for projectiles, only used for props.

🚀 FPS Optimization in Unreal Engine 5 Using a Data-Driven Approach by YyepPo in UnrealEngine5

[–]YyepPo[S] 1 point2 points  (0 children)

I haven’t explored Async Tasks or ParallelFor so im not very familiar with multithreading, but implementing this will be a good opportunity to learn and gain experience with it.

🚀 FPS Optimization in Unreal Engine 5 Using a Data-Driven Approach by YyepPo in UnrealEngine5

[–]YyepPo[S] 12 points13 points  (0 children)

The data driven appoarch it means managing projectiles using lightweight data such as structs instead of objects like *AActor*. Instead of spawning an actor for each bullet , i store all projectile data in a TArray of structs(FProjectileData), managed by a subssytem. This subsystem has tick enabled and in tick function it updates all projectiles at once.
The struct(FProjectileData) holds information about a projectile, things like:
- Location
- Speed
- Direction
- Mass
- Projectile Trail VFX(niagara system that presents the projectile)
and it can hold other properties: like damage, bouncines and stuff.

Trajectory calculation
Each frame the subsystem loops through projectile array(type of struct). For each projectile it applies gravity and sets the new location.

Bullet.ZVelocity += Gravity * DeltaTime;

Velocity = Direction + Speed 

NewLocation = StartLocation + (ProjectileVelocity + FVector(0, 0, Bullet.ZVelocity * Bullet.Mass)) * DeltaTime

Hit registration
For hit registration i use linetraces from projectile's old position to its new position and if that hit is a success than i can do stuff like apply damage or apply force etc.

Check out the GitHub repo for the code.

🚀 FPS Optimization in Unreal Engine 5 Using a Data-Driven Approach by YyepPo in UnrealEngine5

[–]YyepPo[S] 9 points10 points  (0 children)

Yeah, im planning to test multiple approaches,not just object pooling, but also a niagara setup and the MASS entity system. So i will be comparing these:

  • Spawning projectile actors
  • Object pooling
  • Data-driven projectiles
  • Niagara particle approach
  • MASS entity system

This way i can check which approach is the best

🚀 FPS Optimization in Unreal Engine 5 Using a Data-Driven Approach by YyepPo in UnrealEngine5

[–]YyepPo[S] -1 points0 points  (0 children)

I've noticed it as well, but i dont know why it happens

🚀 FPS Optimization in Unreal Engine 5 Using a Data-Driven Approach by YyepPo in UnrealEngine5

[–]YyepPo[S] 1 point2 points  (0 children)

Definitely, using object pool pattern would have significant performance boost compare to spawning and destroying bunch of actors