My app is starting to get a little slower in AppGameKit each update. It's an app not a game but uses 100's of sprites on the screen to build the interface.
Before the main do loop all of the sprites are created and repositioned off screen i.e. -1000,-1000, and in the main do loop (depending on the app screen that's in view) some of those sprites are positioned back in to view.
I thought that because they are being positioned in the main loop each cycle that this was the reason for the slow frame rate so tried a separate test program positioning 10,000 sprites before the main do loop in the positions needed i.e. 10,10 and not -1000,-1000 and leave the main do loop empty but the frame rate hasn't really improved. I realize now that I can reduce a lot of my code by not adding them in the main game loop but doing so doesn't look like it's going to make any improvement to the speed. On some screens I'm getting a frame rate of about 10 frames per second instead of 60.
So my question is, what's the best practice for dealing with projects that has a lot of sprites on screen at once? Most of the sprites won't need to change while they're on the screen. They will only need to change once the user leaves and re-enters each screen. There will only be a few sprites and texts that will need to change each cycle (i.e. counters/timers). Is there a way to draw the sprites once and not re-draw them each cycle? I don't fully understand the different Render functions i.e. Render() and Render2DBack() but can't seem to get them to improve anything. In my main app I have a Sync() at the end of the loop and an UpdateAllTweens().
This simple program gives me a frame rate of about 20 fps on my mobile
sprite as integer[10000]
for i = 0 to 9999
sprites[i] = CreateSprite(0)
SetSpritePosition(sprites[i], 10, 10)
next
do
for i = 0 to 9999
SetSpritePosition(sprites[i], 10, 10)
next
print(ScreenFPS())
Sync()
loop
This runs at about 25 fps.
sprite as integer[10000]
for i = 0 to 9999
sprites[i] = CreateSprite(0)
SetSpritePosition(sprites[i], 10, 10)
next
do
print(ScreenFPS())
Sync()
loop
Why does it require so much processing power when nothing is really happening in the main do loop in the second example?
I created this test project on the AppGameKit mobile as I can't get the desktop version installed at work at the moment.