RobLoach / ChaiLove-FloppyBird

:bird: Flappy Bird in ChaiLove
http://github.com/robloach/chailove
GNU General Public License v3.0
10 stars 1 forks source link

Low spec devices #30

Open guoyunhe opened 4 years ago

guoyunhe commented 4 years ago

I was playing this game on a GameShell (clockworkpi) with a 320x240 screen. The FPS is around 20~30. So I start to think if I can make a version with reduced graphics quality. I guess reduce the graphic size from 480p to 240p can double the performance.

guoyunhe commented 4 years ago

https://github.com/guoyunhe/ChaiLove-FloppyBirdLite

I changed the window size to 320x240 and resized images to 50%. It seems only improved a little bit in frame rate. Around 10%. During game play it is around 20FPS. In menu screen, it is around 35FPS.

IMG_20191107_170434

RobLoach commented 4 years ago

So cool! Nicely done on testing this out. I've found that SDL and ChaiScript can cause some performance issues. I haven't run benchmarks to see where most of the slowdown is though.

This is with "High Quality" option disabled too, right?

guoyunhe commented 4 years ago

In my previous tests, I enabled "High Quality" and use Software Rendering (default of clockworkpi).

Then I disabled "High Quality" and switched to experimental GPU Rendering. The frame rate improved a little from 20 to 25.

At the beginning of the game, it starts at ~40 FPS. When pipes appearing, it drops to ~25 FPS.

guoyunhe commented 4 years ago

Today's coding and testing has some new findings.

It seems that number operations do a big impact on frame rates.

By changing floating number to integers, and use global/local variables to reduce number operations, I reached 30+FPS.

guoyunhe commented 4 years ago

Now I hit the bottle neck. Frame rate cannot be increased anymore unless I make pipes still.

Drawing big pixmaps doesn't seem to harm the performance.

But number calculation and condition comparison affect frame rate a lot.

Need to make some benchmark tests.

RobLoach commented 4 years ago

Thanks for hacking away at this! I've found ChaiScript is pretty demanding. There isn't a JIT in place for it.

In the examples directory, there is bunnymark and benchmark which can be used to play around with: https://github.com/libretro/libretro-chailove/tree/master/examples

RobLoach commented 1 year ago

If you're interested, I've been working on a small software rendering alternative to SDL. I've seen ChaiScript be slow too. Would like to gut the insides of ChaiLove. https://github.com/robloach/pntr