Performance with many many sprites

Mon Mar 08, 2021 7:44 pm

I have created some sprites to add the look of rainfall to one of my maps:


Click to see animation

I would like this effect to appear anywhere there is a sky texture on this map. So far, I've been placing my rain sprites manually and haven't had any performance issues, but I likely have a more capable PC than most. I anticipate there may be performance problems for people with lower-spec pcs and as I add more detail to this map.

How can I ensure the best performance with lots of rain sprites? Is there some kind of LOD option available for sprites, or distance culling? (I don't really need to render these if they aren't seen, obviously.) I am using DECORATE for my sprites (for now at least, I found ZScript to be a bit intimidating).

Would it improve performance any if I added some logic to my rain sprites to only render them f they are a certain distance away from the player, or would that add more performance considerations?

Thanks in advance
-P

Re: Performance with many many sprites

Thu Jun 17, 2021 5:34 am

In my project, LOD is: Actor States and A_CheckProximity.
Works Nice.

Re: Performance with many many sprites

Thu Jun 17, 2021 5:56 am

They could also be flagged +NOINTERACTION if they are purely decorative and you can be sure they can't be encountered in inside areas (including the 3D-floor porch of the building in your example).

ZDoom Wiki wrote:NOINTERACTION
The actor is purely decorative. It will not interact with any other actor and will ignore all game physics (including solid walls and floors!), moving only according to its own momentum. (i.e. The actor will not be affected by gravity, but its movement can still be directly changed using ThrustThing.) All AI routines will ignore this actor's existence, speeding up processing time.
Note: Setting this flag implies removing the actor from the blockmap. If an actor had this flag set needs to be restored to being a solid object, A_ChangeLinkFlags(0) must be called manually to reset its blockmap data.