Hi DeathreyCG.
The soldiers should be smart like in Total War. The collision should be calculated too.
By this I can’t do all calculations in Niagara. Now I use next architecture:
- I have struct like this
struct
{
TArray<FVector> Locations;
TArray<FVector2d> ForwardVectors;
...
};
- I do all calculations in separate threads and fill this struct each frame;
- GameThread only needs to send data arrays to Niagara using UNiagaraDataInterfaceArrayFunctionLibrary::SetNiagaraArrayVector. It takes about 5ms for an array of 2000 entries on each frame;
- Niagara emitter sets location, rotation and animation for each particle. Index in array is equal to particle’s index;
- Emitter has LODs using renderer tag.
The performance of this approach is not bad, but I think it’s a dirty hack. Niagara is not designed for this. I’m looking for the most beautiful solution.