I’m about to design the (parallax scrolling) background of my game, and I wonder what would be the better way to go.
At the moment Im using dozens of 300x300±50 size images to make the actual background, as it gives me more flexibility but I though about that maybe it not that good idea for performance. What would be better if any, dozens of 300x300 images or only few but bigger 1024x1024 edited images as background? Or is it make any different at all regarding perfomance? Any thoughts on this?
After all not every images are visible at the same time. Basically, if/as visibility is matter, at the same time would be visible about 10 300x300 images/objects or 2 1024x1024 images/objects. Is it actually matter? Any opinions are welcome.
Doesn’t matter with such small amounts. Also with smaller images you have much more flexibility so it won’t get repetive, like trees, houses, etc. as separate images with alpha.
Texture changes are what take a lot of time in a GPU.
So, if you have a big amount of objects with different textures : the GPU will have to change current rendering texture for each object, so the performance will drop (still need a lot of objects}. If you have some objects with bigger texture, then, you will get better performances as the GPU doesn’t have to change the current texture as often as with a lot of objects.
That’s why (as an example} the tilemap object, which will be available in the next version of GD, will improve a lot the performance as it uses only one texture to render a lot of rectangle (and rendering a lot of rectangles with a part of the texture doesn’t need a texture switch and doesn’t take much time : the GPU loves that }
Thanks for help, though I’m still not sure what should I do
I don’t have many object with different textures, but few objects with many textures (animation) and I would use basically the same object with same texture (animation) but many places/times. For example, I have an object for stars, 1 for nebulas, 1 for clusters… and I store all the textures in a single object as animations, and use the same object with different and same animation all over the place in the scene, but at the time only few (10 or so) object are visible in the game as others (a lot I don’t even count it) are outside the “screen”. The game is basically an open space game, I’m not decided yet about the actual size of sectors/space but in any case, we can expect objects used 100+ times in the scene but only few of them visible (with different textures) at the time.
I think the question is, is the objects are loaded in to GPU memory only when it visible or all objects of the scene is loaded in to GPU memory even if it not visible, and if I use the same object with same texture different places how is that loaded and stored in memory, only once or as many times as it used in the scene? Also, using multiple texture for same object (animation) put more work load on GPU?
I don’t know how these graphical rendering things and GPU works really but in case all the objects are loaded and stored in the memory same time and same objects multiple times and animations require more GPU power, maybe better to use big textures and only very few objects and only 1 texture/object where possible to make it varied and make parallax scrolling works with minimal GPU use possible, but if it not that significant I don’t want to do this to keep it as flexible and varied as possible.
Sorry if it a dumb question.