My game editor uses a spinning 3D triangle as it cursor, I have noticed that it's rotation slowed a couple of seconds into the app run. So I added an FPS routine and it told me that the app is dropping from 60 frames per second down to about 22!
I then started to cut stuff out to try and find the problem, until eventually there was nothing left. Something like this...
while 1=1
displayFPS()
SHOWSCREEN
wend
And I'm still getting a slowdown (although not as bad, there should be none), from 60 FPS down to 45 FPS in about 2 or 3 seconds after launch?!?
I'm kinda hoping someone has run into this before with Android?
I'm using a Nexus 10 with Lollipop BTW.
hard to tell without source code and example. im do newer used any 3d in my games.
No 3D now, that's the test code above. I basically got ithe game loop down to 4 lines, yet I was still loosing 25% of CPU time. The displayFPS() function, simply does a small FPS calculation and the uses a PRINT command to display it.
I'm thinking something external is causing this since I'm down to such little code but I can't find the solution. I'll post an APK of the above code, if someone could run it and they were to get an FPS loss, then I would know it's not my tablet or its OS version?
The slowdown is quite drastic and noticeable, the 25% loss is basically a doubling of my game update time for no reason. :help:
I'm don't mind have seen that issue except mystery fps drop in about 20 secs on Windows in greedy mouse. Here it's might been a army array issue. But it's did ran nice on both ios and Android.
Do you uses android extras or not?
Or which power state is the deviceis in? CPU might dropped down MHz as its should not.
hmmm, I haven´t experience nothing like this on android yet.
The device is not hot and the "power save" option is off. nothing is running in the background.
Here is the listing...
WHILE 1
FPS()
SHOWSCREEN
WEND
FUNCTION FPS: ShowFpsBOOL=TRUE, x% = 50, y% = 50
STATIC TimeBuffer,FrameCount, FPSVALUE
LOCAL FrameTime
FrameTime=GETTIMER(); TimeBuffer=TimeBuffer+FrameTime; FrameCount=FrameCount+1
IF TimeBuffer>999; TimeBuffer=TimeBuffer-1000; FPSVALUE=FrameCount; FrameCount=0; ENDIF
IF ShowFpsBOOL=TRUE THEN PRINT "FPS="+FPSVALUE,x%,y%,150
RETURN FPSVALUE
ENDFUNCTION
Just the default manifest XML.
Android project setting are 1024x768, Max Frame Rate 60hz.
I initially though that there was something wrong with the FPS() function but I've used a couple of different ways to calculate the FPS rate and the result is the same. Besides that, you can graphically actually see the app slowdown in the first few seconds after launch.
I'm thinking it must be some sort of external problem. API setup, ADB, USB driver, maybe even a faulty tablet. :noggin:
If you guys could run the above code on your phone or tablet then I would appreciate it if you could tell me if you get a steady 60 FPS?
Also, could you note your Android version for me please, mine is Lollipop(which may be the culprit in itself).
I make some tests in the evening and hope it help
Many thanks Marmor, I've tried it on Jellybean and I get full speed but on Lollypop it's loosing 25% over the first 5 seconds. This is kinda worrying as it's the latest Android OS but I'm hoping it's down to this specific tablet and not a problem with GLB.
android 4.1.1 device GT-N 7100
58-60 fps steady from start until testend (30 min)
https://www.dropbox.com/s/uwu68n6pwe77rw2/glbasic-debug.apk?dl=0
Thank Marmor, I'll try your APK on both tablets and report back. :good:
nexus 7 2012 android 4.1.1 60 fps steady.
same nexus 7 but updated to 5.02 60 fps steady.
maybe you need disable some things , errorlog and so on
mfg
galaxy note II - android 4.4.2 kitkat
Steady 58fps forever
Thanks for your help guys, still the same with Marmors APK (45 FPS). I don't really understand it TBH, I suppose there could be something that is polling the USB port too much or even a problem with my SDK repo. or Android driver, I don't know. I will need to do a tablet reset and an SDK install to be sure but not tonight.
One positive thing is that I though initially that I have some sort of bad optimisation problem, so over the last week I went and implemented all the optimisation tricks I could think of (pooling etc.) to speed things up. So trying it on an 2012 Nexus 7, same version as yours Erico, it ran at a very good rate indeed. Lazy git as I am I probably would not have bothered till the game was finished, so not a total waste of time. :D
Thanks again guys, much appreciated that you went to the bother of messing around with your tablets for me. :booze:
My phone is a very clean one, almost none apps running on background nor anything else.
Your clean reset might bring some answers to this subject, maybe you have stuff going that hogs performance.
In my case, I never experienced slow downs after the game boots, but very very Veeeery (1/100) once in a while, the game starts at half speed with stuttering sound.
When that happens, a restart of the app always got it back to working fine 100% of the times it happened.
Hope the info helps. :good:
im testing your apk later. Howover im have not seen such af fps drops in my games on the devices im tested on. Karma Miwa is a quite heavy on the graphics and have seen its ran quite stable 60fps on Android.
The sound stutter is a annoying bug in sld_mixer im have seen in the past and also sometimes can happens here as well. That what im dropped sdl_mixer in my games and used soundpool instead. Since that, im did not have those kind of stutter. Mightbeen its could been this case? Im should let user possible to uses sdl_mixer or soundpool, so the official commands can use the soundpool as they are.
I don´t think that is the case here, and that problem really only seldomly happens, like 1/100.
I think it is related to the phone itself as I tested a lot of android GLB stuff on a lot of phones, old and new, never a problem with fps.
Bigsofty : Thanks again guys, much appreciated that you went to the bother of messing around with your tablets for me.
one debug android apk which running on these android zombies is much better as any Angry birds from the appstore :good:
TBH I was a bit relieved to see it was the tablet, I was really worried that it was the compile chain or even worse GLB standard libs not being compatible with the latest Android O.S. I should have known better than to doubt GLbasic! :D
:booze:
All GLB code for android I tested worked on 100% of phones tested flawlesly, even very ancient ones. 8)