EDIT: Okay, so I think I worked out what the problem was. When I was using meshes, I had three materials in the one blueprint, and used an int to choose between the three colours on spawn. When I set it up with sprites, obviously something had to change, so I just added extra sprite components and used the same int to switch between them, so it would fit in with how I've set up my enemies. Well, it seems that the engine doesn't like having more than one sprite component on a blueprint; each additional component seems to add a three-fold increase in frame times. I've now set it up properly with a single enemy sprite class and three derived class blueprints, and it seems to be working fine. Not sure yet if it's a performance improvement over the meshes, but I'm really loving the contrast of the 2D sprites against the realistic lighting and rendering of UE4, so I think I'll keep it this way regardless.
I'm making a bullet hell game, so there are a lot of 'bullets' on screen most of the time: up to several hundred. I was originally using three dimensional meshes for the bullets. They were UV spheres with ~500 polys each, rendered with an emissive material.
I started hitting performance issues as the number of bullets increased. I thought that using sprites would be more efficient way of doing it, so I swapped out the meshes with sprites, keeping exactly the same blueprints I was using before, but deleting the static mesh component and replacing it with a paper sprite component. The only other component in these classes is a projectile movement component. Physics is disabled for these sprites, and I'm using the default masked unlit sprite material.
Now that I've made these changes, the performance is literally 10 times worse. There are now really bad frame drops (down to 10-15fps) and stuttering in sections that were easily maintaining 60fps before. The sections that I thought were bad because they were dropping to 30-40fps are now down to about 5fps and stuttering terribly.
I can't understand why this would be. Rendering 2D sprites with an unlit material must be much easier to compute than rendering 500 polygon meshes with emissive materials. And, as I said, I have changed nothing else in my blueprints.
The hardware I'm running on is:
GTX750
16GB RAM
I'm using UE 4.8.1 and the operating system is Windows 8.1.
Any ideas what could be the problem? Is there something I'm doing wrong with the way I'm handling sprites?
EDIT: It seems to be the spawning itself that is the problem. If an enemy spawn 50 sprites, the game stutters, but if I stop all enemies from spawning, there can be hundreds of sprites on screen with no problems.
Subreddit
Post Details
- Posted
- 9 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/unrealengin...