In order to build a scene, I use lots of separate pieces of decoration and put them together. Does it mean that they’re all rendered individually? If they are, will this cause performance issues? Also, is there a way to render them as a whole? Will tilemap work? I don’t know how this works, so I also wonder if there’s a way to render all the instances as a whole without using it. By the way, The average size of a piece of decoration is 600x600, and there are hundreds of them. Will this be too big?
Every object in a scene is rendered individually, in every engine, yes. Objects are Culled (not graphically rendered) when outside of all of the layer camera’s current view, though.
Sure, if you have enough of them on screen at once, or enough logic impacting those off screen at once.
I don’t understand the question here “as a whole”, pixels are pixels. The more pixels you have to render, the more performance it has to take. It doesn’t matter if the pixels are part of object A or object B. So the number of objects don’t matter so much as the amount of logic that impacts or stores them (positioning, event logic, etc).
Tilemaps improve performance in some cases because the map is made up of reusable tiles from a single tileset rather than a bunch of huge images. It is a memory reduction, not necessarily an outright performance improvement.
As far as your piece of decoration being 600x600, the biggest issue is that means your decoration is 1/2rd the size of a 1920x1080 screen in height. Is that intended? (for example, you should not be designing your assets to be larger sized than shrink them down in the scene editor. There is no graphical improvement, and all it does is increase memory and cpu usage. If you want to design them at a larger size, that’s fine, but make sure you export them from your graphic system at the intended output size, not the original larger esize.)
So again, high level, objects themselves aren’t really a big ‘performance’ thing outside of memory (with caveats that if you have thousands on screen at once, it will impact performance). Objects aren’t rendered when they’re not visible in the current window (meaning all layer camera’s current view). What you’re doing with the objects, however, as far as events, will impact performance. Most of your optimization should be focused on events. If these are just background objects that aren’t touched/targeted by any events, they shouldn’t affect performance much.
Ok! Thank you so much. I’ll check my event sheet.
My game window size is 2400x1440, while the width changes accordingly.
I still have a few questions:
In my game a wall-climbing ability is featured. This ability requires lots of events checking collision masks of the bare platforms. However, this doesn’t affect the performance very much. While running the game in a scene with only, but many bare platforms, the fps can reach the maximum, which is 60 fps. The game’s fps drops to around 30 fps when the further decoration is added, so I’m having a doubt here: will changing the objects’ z order affect the performance?
Another thing is that, in my game, when the enemies are killed, corpses with physics properties are created. This also decreases the fps. Is there a method to do the same thing, generating corpses at the position of the enemies when they’re killed, without affecting the performance?
Keep in mind this means you are currently designing a game that will only render properly on less than 3% of all desktop displays out there. (Only 6% of displays were greater than 1080p as of 2021’s Steam Survey, less than 3% were 1440p).
No, Z order will not impact performance.
Anything that involves logic (physics involves heavy logic that runs every frame) will impact performance. As long as physics is active on those objects they will impact performance.
So does that mean the lag issue could be solved if I reduce my window size?
Also, I’ve checked my event sheet and didn’t find any events using the decoration, still my game lags. However, the lamps in the scene do have some events using themselves but only at the beginning of the scene where a area of light (a texture painted already) is created for each lamp. I don’t think this’ll cause too much lag issue.
I suggest you use the profiler to see where the most time is spent processing each group of events and rendering. Remember to have the events within event groups so that they are individually visible in the profiler.
Use the profiler mainly when fps drop, but it is good practice to do it regularly and more when adding new complex events to see if they are consuming too much processing resources and eventually optimize them.