RnD for iOS

Discussion about Rocks'n'Diamonds, Boulder Dash, Supaplex, Emerald Mine and any other BD hybrid.

Moderators: Flumminator, Zomis

User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: RnD for iOS

Post by Holger »

The other engines, SP and RND, still stutter during scrolling. I think those are not smooth because the Vita just cannot achieve steady 60 fps while scrolling. I checked with the fps counter, and it dips down to 55 once the scrolling starts. The motion of rocks and other objects is perfectly smooth, it is just the scrolling that stutters.
Thanks a lot for describing this observation! Apparently there are bottlenecks in both engines that prevent running with 60 fps! :-o
I therefore decided to turn Vsync off for all modes apart from the new 60 fps mode.
Yep, seems perfectly reasonable. (While disabling Vsync would clearly be required for the faster modes, I think you're right that it will indeed also affect the slower modes due to the synchronization to the screen refresh rate.)
On a sidenote I found that there's a loop in the EM engine that causes significant slow-down on the Vita. The loop causing the slowdown is the following one in graphics.c, line 302:
[...]
That is indeed very interesting. Did you experience this slow-down problem when running any of the EM/EMC level sets that come from the Emerald Mine Club level set? Because they should all set "game.use_native_emc_graphics_engine: true" in their graphics configuration files, therefore preventing this code path from being executed.

Therefore, I can only imagine that you observed this slow-down when running a level using the EM/EMC game engine with standard artwork, therefore triggering the game engine to use the non-native artwork (from the point of view of the EM/EMC game engine), which would indeed cause this code to be executed.

And yes, I've also already found out that it seems to be slooow due to this specific bottleneck (and therefore deactivated it in warp or headless mode, where no screen updates are drawn).

But I wasn't aware of this being a problem when running the game with normal (or 60 fps) speed! :-o

Your workaround is a perfectly fine first solution to this issue, but I will also investigate if/how "SetGfxAnimation_EM()" could be made faster. But setting graphics for unused tiles should be prevented anyway, and I wasn't aware of doing this when I first found out that this is slow in warp/headless mode... o well!

I will also have a look at the SP and RND game engines to find out why they are not fast enough for 60 fps... :-/
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: RnD for iOS

Post by Holger »

iOS source is available here: [...]
Thanks a lot! Indeed the changes are really minimal this time compared to the last version for iOS! :-)

One question though: In the previous version, you dynamically adjusted the screen width to fit for the iPad or iPhone screen size. I haven't found this change anymore in your latest source code. How do you handle the different screen aspect ratio of iPad and iPhone now?
Holger, as far as I know VSYNC is always enabled on iOS at the OS level. Not sure if it can be bypassed.
So it cannot be enabled/disabled? Good to know...
lesbird
Posts: 12
Joined: Wed Feb 03, 2016 2:29 am

Re: RnD for iOS

Post by lesbird »

Holger, I’m ignoring aspect ratio this time. Maybe I’ll add it back in an update. Really just trying to keep the changes minimal this time.
rsn8887
Posts: 10
Joined: Sat May 26, 2018 3:33 pm

Re: RnD for iOS

Post by rsn8887 »

Holger wrote: Tue Jun 05, 2018 8:20 am [...]
On a sidenote I found that there's a loop in the EM engine that causes significant slow-down on the Vita. The loop causing the slowdown is the following one in graphics.c, line 302:
[...]
That is indeed very interesting. Did you experience this slow-down problem when running any of the EM/EMC level sets that come from the Emerald Mine Club level set? Because they should all set "game.use_native_emc_graphics_engine: true" in their graphics configuration files, therefore preventing this code path from being executed.

Therefore, I can only imagine that you observed this slow-down when running a level using the EM/EMC game engine with standard artwork, therefore triggering the game engine to use the non-native artwork (from the point of view of the EM/EMC game engine), which would indeed cause this code to be executed.

[...]
I will also have a look at the SP and RND game engines to find out why they are not fast enough for 60 fps... :-/
Concerning when I observed the slow-down: You are exactly right, I observed just what you describe. There was no slow-down using the Emerald Mine Club levelsets. But there was slowdown in the bundled Emerald Mine levels that used the RND graphics set. Then I realized that I can trigger the slow-down simply by changing the artwork, keeping everything else the same. This puzzling behavior caused me to look deeper into the issue in the first place and allowed me to find that problematic loop in the EM engine that always loops over 128x128 tiles.

I couldn't find a similar loop in the other engines where an obvious optimization could be implemented. I noticed that the fps-dips below 60 only happen during scrolling. Maybe the scroll-routine in RnD and Supaplex engine games is more complicated than the one in the EM engine and could be optimized? However, it could also be that the added complexity of the main game loops in the SP and RND engines, compared to the EM engine, is just too much for the Vita to handle, while also having to scroll the screen.
Post Reply