Hi.
I am studying the issue of creating a game about battles on a scale comparable to Total War. I hope there are people who can suggest something.
At the moment I have found out the following:
- Each unit should be a StaticMesh, animated using the vertex animation texture technique. No SkeletalMesh, Character or other ready-made unreal functions. We turn off physics completely;
- Using Actor, adding your own functionality to it, is not suitable (each Actor is a separate unit). On my computer, FPS starts to fall below 60 at around 3000 units. I have moved all the movement calculations to separate threads, so the GameThread only has to run through several arrays in one cycle and distribute Location, Rotation, etc. to each Actor. In such an implementation, 8+ms from a frame is the call to UWorld_SendAllEndOfFrameUpdates and then grows with the increase in the number of Actors.
- Niagara helps to achieve high performance - the same 3000 units are rendered with a large FPS reserve. However, using Niagara for such purposes seemed like a dirty hack. For example, each system has Bounds - a volume within which particles are visible to the player. As soon as Bounds stop hitting the camera, all particles disappear. This can be fixed by making fixed bounds the size of the entire battlefield. Also, transferring an array of 2000 vectors to the system parameters (to the GPU memory, if I understood correctly) is ~5ms, which is also a significant time, which will only grow further, because in addition to the location and rotation of the particle, you also need to transfer information such as the flags “alive”, “selected by the player”, etc.;
- I looked at MassEntity, but did not go into detail, because it turns out that the same Actors will be rendered there, and I have already found out their limitations. Perhaps I was wrong;
- The last known option at the moment is Instanced Static Mesh. A thousand identical knights should fly to the render in one draw call and that’s good. But again, the component is designed to draw trees, a bunch of identical village houses and other things. Setting the position on the map via world position offset and animation seems to be possible, but it also looks like a dirty hack.
As a result, it turns out that to solve the problem you need something like Niagara, but not about appearing and disappearing particles, but about Actors. Maybe someone has solved similar problems and can share their experience?