Hi guys,
I'm about to start a project which will require hundreds of animated and static bitmaps on the screen at once. Apart from using a sprite sheet and set sprites outside the visible screen area to invisible (setVisible (false)), are there any tips and tricks to keep the CPU happy? Also using local variables in all loops I suppose.
Cheers,
Niclas
Comments
Then look at this thread.. http://giderosmobile.com/forum/discussion/4769/simple-item-pool-class/p1
I'm using something similar in my programs and it seems to work.
Does anybody have a better way?
Likes: rolfpancake
@sinistersoft, you had a clever way of reducing CPU in your Dungeons game I seem to remember?
Likes: SinisterSoft
@SinisterSoft, I'm keen to know your secrets too if you're keen to share :>
Likes: SinisterSoft, totebo
I animate split the sprites up into groups of 4 - so that each group gets it's own frame. So anything to do with animation or 'intelligence' only happens once every 4 frames.
I do movement and collision checking every frame however, if need be then I can change the animation to an explosion or whatever if there is a collision.
If there are a lot of sprites that only move every so often then I just use a tilemap. The objects stay on the tilemap and I process it in quarters for animation. This way it looks like there is a lot of movement on the screen when in reality only 80 or so sprites need to move at once. Sprites just move in/out of the tilemap system when they stop on a specific pixel boundary.
The main thing is not to allocate and deallocate things - I just hide sprites that are not in use and then if something needs to appear I set the graphic and unhide the sprite.
Likes: totebo, antix, rolfpancake
https://deluxepixel.com
Likes: SinisterSoft
Likes: SinisterSoft
Likes: antix, SinisterSoft