Hi guys,
I'm working on a game with a growing number of bitmaps, with last count over 600. I've got them all in one folder and export them to one spritesheet. At some point I'm going to have to start splitting these into multiple sheets, so I'm wondering if anyone has had experience of a game with lots of bitmaps and, if so, if you have a nice way of dealing with this.
Cheers,
Niclas
Comments
I suppose you really have to have things sorted into groups like Player, Monsters, Items, etc.
I'm not using Texture Packer. I use spritesheets where all the sprites are grid aligned and I use regions to fetch the individual sprites.
With so manys bitmaps, imho you don't get around having multiple sprite sheets. Creating them or how to use multiple spritesheets in the app?
@simwhi, as I said above, that's not an issue for this particular project. In the past I have used TexturePacker which has support for multiple resolutions. The way I do it is have all images in their highest resolution, then let TexturePacker downsample them to all other resolutions automatically. Works great with the automatic @2, @3 (etc) image scaling in Gideros. For tiled textures, which you can't use sprite sheets for, I use Sketch 3 (Mac only), which also lets you export multiple resolutions of one image.
So, how do you assign/load all these images into the game?
@MikeHart, the reason there are so many sprites is that most of them are animated and loaded into MovieClips when needed. It's a isometric shooter with characters. Each character is defines by their respective states and each state has a MovieClip attached to it. Not sure if that answers your question.
Likes: MikeHart
I would post something but when I was making an example project I came across what seems to be a bug in RenderTargets clear() function. I made a forum thread but none of the devs have replied yet. http://giderosmobile.com/forum/discussion/6386/rendertarget-bug#Item_1
So my possible solution can't be posted really since it seems to be broken from inception :-O
Oh, I sent you a PM about MinerZ too ~:>
Likes: pie
I am making levels for a platformer game using Tiled. One level can be 10,000 pixels wide (height not so much ).
First try, I have all my images (around 2 hundreds) and was placing each image to make a nice level (flowers, trees, foreground, background, ...). The sprites could be rotated, scaled to add variety.
--> the result is "terrible" with lot of stuttering (export to win32 and html5).
Second try, I put all the images as to my liking then I export each layers to a single big image (see export to image in Tiled). My images are huge, for example the background layer is 15,356 pixel width and 512 pixel height
--> the result is very good, there are no visible stutters (export to win32 and html5). One issue is it doesn't work on my android phone (the big image is black) but this could easily be solved imho (cutting the big images smaller). Another issue is the making of the levels becomes a little more tedious
So instead of hundreds of small images, put them in 2 or 3 huge ones
Demo: https://mokatunprod.itch.io/gideros-tests-02?secret=euQJ7rsKOuidLDk5uVBcjsb74
Another possibility is using Shapes, they work very well and are very flexible but only suitable for appropriate art style.
PS: I am not using Tiled tile layer but image layer.
PS: I switched from ECS to classic OOP and now I have 2 working projects (I thought ECS was the culprit ). I can post the code for both on GH let me know if you are into platformers
PS2: ECS code is less advanced than OOP but the base is here
PS3: on my low end android using tons of sprites doesn't cause any lags (some very good optimisations must be running behind the scene!)
PS4: html5 runs better than win32 (a little bit of tearing occurs)
Likes: pie
since it's the same game can you compare resource consumption? which one is "lighter"?
Likes: MoKaLux
Many small sprites vs few big sprites: memory consumption is bigger with big sprites but at least I have no lags on html5.
Likes: pie
In my use case:
- my background is originally 3096*544px
- I cut it in 3 for eventual android builds: 3096/3 = 1024px
- in code, I further cut each 3 images in tiles (around 64*64px) using TileMap Class
- I then reassemble everything back together
please see updated code below!
So far so good, the lags have (completely?) gone on win32 builds, great success
Viva Gideros!
It still has to load the 3 tilesets as big as the "source images" and then compute on those. How can it be faster? Maybe it has a better handling of what happens outside the screen (it won't load one big image but only the tiles which appear inside the screen)?
I wonder if this might work using rendertarget and avoiding all the cut/tile/reassemble
- normal bitmap with the whole texture => win32 lags
- cutting the image and using different bitmaps, lags
- putting the texture/textures in Shapes, lags
- using Tilemap, the best so far but some lags appear as well
- ...
I believe Tilemap won't show tiles outside the screen as I have read somewhere on the forum. I think I tried this one too but will try again.
Every combinations work pretty fine on all deployed platform (Qt, html5, android), the lags are on win32 export. It may be my buggy windows11 with all the scheduling things happening, my graphics drivers not up to date, ...
Here is the latest code: