How to test Gameview?

cyiwin

Active Member
Licensed User
Longtime User
I'm trying to make a game using gameview. I noticed that it seemed to be going slow so I looked at Erels GameViewSmiley app. Turned the timer milliseconds down to 1, on my phone it ran at 80 fps. Then I opened the manifest editor and commented out "SetApplicationAttribute(android:hardwareAccelerated," true") ". Ran it again and got the hardware acceleration not supported message but still ran at 80 fps.

Is there a better way to test Gameview? I'm using a Galaxy S3 with jelly bean.

Thanks
 

Informatix

Expert
Licensed User
Longtime User
I'm trying to make a game using gameview. I noticed that it seemed to be going slow so I looked at Erels GameViewSmiley app. Turned the timer milliseconds down to 1, on my phone it ran at 80 fps. Then I opened the manifest editor and commented out "SetApplicationAttribute(android:hardwareAccelerated," true") ". Ran it again and got the hardware acceleration not supported message but still ran at 80 fps.

Is there a better way to test Gameview? I'm using a Galaxy S3 with jelly bean.

Thanks

GameView slow on a S3? I think that your code is slow, not GameView.
 
Upvote 0

cyiwin

Active Member
Licensed User
Longtime User
Thanks for the info, I guess my problem remains that my game is running about 10 FPS faster on my older Motorola Triumph using android 2.2 than my S3 using 4.1.2.

I chopped my program down from 3000 lines to 550 to make it easier to read. Maybe someone could tell me what I'm doing wrong?
 

Attachments

  • SpaceCombat.zip
    172.4 KB · Views: 202
Upvote 0

Informatix

Expert
Licensed User
Longtime User
Thanks for the info, I guess my problem remains that my game is running about 10 FPS faster on my older Motorola Triumph using android 2.2 than my S3 using 4.1.2.

I chopped my program down from 3000 lines to 550 to make it easier to read. Maybe someone could tell me what I'm doing wrong?

Depending on how often the screen is refreshed on a S3, you won't have the same number of FPS as on another device. Usually most devices have a maximum FPS of 60, but some never go over 40. That doesn't mean the player experience is different. So the right questions are: is it smooth? is it playable? do you have the same pleasure to play on the different devices?

I looked at your code and your FPS computation means nothing:
1) The FPS count must be computed in the draw routine, not in the Tick event. Since you don't have access to the draw routine, I'm afraid that you cannot compute reliably a FPS with GameView.
Currently, you are counting how often the Tick event is fired, not how often a frame is drawn. The Tick event is usually called more often than a frame is drawn.
2) Your formula is optimistic. If I replace your formula with a correct computation (all variables are long):
B4X:
If DateTime.Now > oldtime Then
   oldtime = DateTime.now + 1000
   fps = framecount
   framecount = 0
Else
   framecount = framecount + 1
End If
I get a lower value, but still over 70 because we're not in the draw routine (my device shouldn't display a number higher than 62).

Conclusion: the FPS count means nothing in your case.
 
Upvote 0

cyiwin

Active Member
Licensed User
Longtime User
Thanks for looking into this for me. It is playable, it's just when I start adding more ships it gets slow. The fps is a snippet I borrowed from GameViewSmiley. Maybe I'm not using it right, but the game is noticeably faster on my 2.2 Triumph.

I guess my question at this point is, since the game runs on a pre-honeycomb phone, does that mean my program isn't using gameviews hardware acceleration correctly?

Assuming my eyes aren't playing tricks on me, how could it run just as fast or faster on an older Froyo phone?
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
Thanks for looking into this for me. It is playable, it's just when I start adding more ships it gets slow. The fps is a snippet I borrowed from GameViewSmiley. Maybe I'm not using it right, but the game is noticeably faster on my 2.2 Triumph.

I guess my question at this point is, since the game runs on a pre-honeycomb phone, does that mean my program isn't using gameviews hardware acceleration correctly?

Assuming my eyes aren't playing tricks on me, how could it run just as fast or faster on an older Froyo phone?

If you disable the HA on the S3 with SetApplicationAttribute(android:hardwareAccelerated, "false") in your manifest, do you notice a slowdown?
 
Upvote 0

cyiwin

Active Member
Licensed User
Longtime User
I just wanted to report back with my findings.

On my Galaxy S3 with JellyBean:

with 'SetApplicationAttribute(android:hardwareAccelerated, "false")' in the manifest or if the line was not there it was noticeably slower.

with 'SetApplicationAttribute(android:hardwareAccelerated, "true")' it seemed about 1/3 faster.

On my Motorola Triumph with Froyo:

No surprise the manifest Attribute didn't seem to have any effect on program speed though it is interesting that the game ran just about the same speed as on my S3 with Hardware acceleration. The difference may have something to do with the lower resolution of the Triumph.

Conclusion: Happy with gameview, my game probably doesn't push the hardware as much as others. For higher FPS I might need to tidy up my program.
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
The difference may have something to do with the lower resolution of the Triumph.

Conclusion: Happy with gameview, my game probably doesn't push the hardware as much as others. For higher FPS I might need to tidy up my program.

Yes, the resolution may explain some difference but it's not enough. Another explanation could be the time spent in updating all game elements. You should measure the time spent in the condition "If PlayersTurn = True Then". The S3 draws maybe faster, but probably does not compute a lot faster than your other device.
I'm not very familiar with GameView as I use my own library (Accelerated Surface), but I know, after benchmarking all draw functions, that GameView uses not the fastest one and does not benefit fully from JellyBean and the HA. By using the right one, you can gain 8 FPS on a Nexus 7 with 500 sprites on screen. But switching from one library to another is not what I would recommend. Try to improve the existing code before.
 
Upvote 0
Top