Hello guys. I, am bignoob in UE4, but i am trying.
I have stuck on a problem and cant find right direction to solution.
In a nutshell - RTS units cone vision system.
~500 units in peak.
Average vision distance ~300 local meters or 30 000 coordinate points, max but very rare - 2-3km.
For unit vision ticks every 30th frame …have some thoughts about degradation by distance.
I have tried few ways, but have failed.
- At start i am rejected procedural mesh vision as much expensive.
- Have tried to make a sphere-detector and small sphere-marker with special query collision channel and check angles for units whos overlap the sphere detector with his sphere-marker.
Rejected, cause to much unnecessary actions.
- Have tried to make a pyramidal static mesh component in front of unit. In small scales all being ok.
But with 150 units, whos moving near each other. i get a GIGANTIC fps drop. I have found the reason of this in collision overlaping events. Billions of them.
Before, i hoped, what overlaping of “ignored” objects doesnt eat much HW time.
But when i get 200-400 overlap events per tick only with 150 primitive units and floor mesh my FPS drops till 30 (760TI & i7-3770).
Without any BP scripts (only units rotation).
So i reject this.
Now i have only 2 ideas, how i can make it works.
Vision in the sky:
1.Marker axis with gigantic Z-level.
2.Vision cones spawns by units on construction far far in the sky, everyone on his own Z-level.
3. Ray trace between owners to get obstacles on map.
Near range vision by one of previous.
1.On begin play, level divide by zones.
2.Each zone store overlaping units.
3.Unit ray trace on max vision angles, and get zones in vision cone angle.
4.Get units in this zones.
5.Ray trace to get obstacles.
My ideas can be very stupid, so please, if there is more efficient and obivious way to solve my problems - tell me.
And answer, why my ideas wouldnt work.