RnD for iOS
Moderators: Flumminator, Zomis
RnD for iOS
Hi all, I'm in the process of porting Rocks'n'Diamonds to iOS. The current state of the build is fully functional on iPhone and iPad. The plan is to release the game as a free app with no ads. If you are interested in beta testing the game sign up for Test Flight (free) and send me your email address so that I can add you as a tester.
What's working so far:
1. Fully functional game (SDL2 version).
2. MFI game controllers including support for analog sticks and dpad.
3. Touch support using default built-in functionality (virtual touch zones or swipe).
4. 60 fps on recent model iPhones and iPads (tested with iPhone 6s and iPad Air).
What's left to add:
1. Get game layout to format properly on larger screen devices. I want to remove the side panel and fill the screen. On iPad with the side panel it is acceptable but on smaller screen phones it's very cramped.
2. Get Game Center support functional so high scores can be reported to the global leaderboards.
3. Add a checkpoint system so you don't have to restart the entire level.
Several years ago I ported a version of Emerald Mine for X11 by David Tritscher to iOS but it is pretty dated now (and crashes on some of the levels). I was in the process of fixing it but I'd much rather get Rocks'n'Diamonds up and running instead.
- Les
http://www.lesbird.com
lesbird@lesbird.com
What's working so far:
1. Fully functional game (SDL2 version).
2. MFI game controllers including support for analog sticks and dpad.
3. Touch support using default built-in functionality (virtual touch zones or swipe).
4. 60 fps on recent model iPhones and iPads (tested with iPhone 6s and iPad Air).
What's left to add:
1. Get game layout to format properly on larger screen devices. I want to remove the side panel and fill the screen. On iPad with the side panel it is acceptable but on smaller screen phones it's very cramped.
2. Get Game Center support functional so high scores can be reported to the global leaderboards.
3. Add a checkpoint system so you don't have to restart the entire level.
Several years ago I ported a version of Emerald Mine for X11 by David Tritscher to iOS but it is pretty dated now (and crashes on some of the levels). I was in the process of fixing it but I'd much rather get Rocks'n'Diamonds up and running instead.
- Les
http://www.lesbird.com
lesbird@lesbird.com
Re: RnD for iOS
Great! I am happy that I already added SDL2 support for R'n'D, so only few modifications should be required. (R'n'D already works on Android, but there's no official package of it yet.)Hi all, I'm in the process of porting Rocks'n'Diamonds to iOS.
This can easily be done without changing a single line of code with the current version from Git -- have a look at this posting that demonstrates how to do this (including screen shot and example level sets).1. Get game layout to format properly on larger screen devices. I want to remove the side panel and fill the screen. On iPad with the side panel it is acceptable but on smaller screen phones it's very cramped.
This already exists in the current version from Git (but still needs a bit polishing, especially regarding memory usage).3. Add a checkpoint system so you don't have to restart the entire level.
Just activate it in the setup menu (look out for "game engine snapshots") and give it a try!
BTW: Your idea of adding snapshots whenever something was collected sounds very good! I will add it as an option to the already existing "every step" and "every move" modes.
Re: RnD for iOS
Progress update on the iOS port of RnD. Practically done just some minor touch ups left to do. Here's the page on my website with some screenshots.
http://www.lesbird.com/RocksNDiamonds/default.html
I plan to submit it to the App Store within the next week or two.
- Les
http://www.lesbird.com/RocksNDiamonds/default.html
I plan to submit it to the App Store within the next week or two.
- Les
Re: RnD for iOS
Totally cool!
Can't wait to see it running on my iPad mini!
BTW: Haven't added the "snapshot when collecting" mode yet as promised -- have you already done something in that direction by yourself? (Should be quite easy, and I will hurry now to add it to the version in the Git repository, so that you can add this. Or have you skipped this feature for now? Can't really tell from the screenshots...)
Can't wait to see it running on my iPad mini!
BTW: Haven't added the "snapshot when collecting" mode yet as promised -- have you already done something in that direction by yourself? (Should be quite easy, and I will hurry now to add it to the version in the Git repository, so that you can add this. Or have you skipped this feature for now? Can't really tell from the screenshots...)
Re: RnD for iOS
Rocks'n'Diamonds is now live on the App Store:
https://itunes.apple.com/us/app/rocks-n ... 09122?mt=8
https://itunes.apple.com/us/app/rocks-n ... 09122?mt=8
Re: RnD for iOS
Just downloaded and tested it! Works like a charm!
Great work!!!
Great work!!!
Re: RnD for iOS
Hello,
Can you release the iOS version sourcecode. I am asking because I would like to see how you got it to run in perfectly smooth 60fps. I ported the game to the PS Vita recently, and can get it to run fast on that platform, but it is never so perfectly smooth like in your iOS port.
Even on my MacBook or Windows PC it never scrolls so perfectly
So I am very curious, what did you change to make it so smooth?
Thanks you in advance for your help.
Can you release the iOS version sourcecode. I am asking because I would like to see how you got it to run in perfectly smooth 60fps. I ported the game to the PS Vita recently, and can get it to run fast on that platform, but it is never so perfectly smooth like in your iOS port.
Even on my MacBook or Windows PC it never scrolls so perfectly
So I am very curious, what did you change to make it so smooth?
Thanks you in advance for your help.
Re: RnD for iOS
I've asked the author of the iOS port if he could make his changes publicly available.Can you release the iOS version sourcecode.
If I remember right, he changed the frame delay value to a minimal value (1 ms), relying on iOS's VSYNC to run the game at perfect 60 fps, which works remarkably well! Still wanted to backport this change to other platforms that (may) support it, like Android (or Mac/PC platforms, if the graphics hardware supports VSYNC). Still wanted to experiment with this...I am asking because I would like to see how you got it to run in perfectly smooth 60fps. I ported the game to the PS Vita recently, and can get it to run fast on that platform, but it is never so perfectly smooth like in your iOS port.
Re: RnD for iOS
I’ll add the code to my GitHub this week and post a link.Holger wrote: ↑Tue May 29, 2018 6:24 amI've asked the author of the iOS port if he could make his changes publicly available.Can you release the iOS version sourcecode.
If I remember right, he changed the frame delay value to a minimal value (1 ms), relying on iOS's VSYNC to run the game at perfect 60 fps, which works remarkably well! Still wanted to backport this change to other platforms that (may) support it, like Android (or Mac/PC platforms, if the graphics hardware supports VSYNC). Still wanted to experiment with this...I am asking because I would like to see how you got it to run in perfectly smooth 60fps. I ported the game to the PS Vita recently, and can get it to run fast on that platform, but it is never so perfectly smooth like in your iOS port.
About the VSYNC change. The easiest thing to do is change GAME_FRAME_DELAY from 20 to 16 in system.h. In a previous version I think I changed it to 1 but that breaks the game on iPad Pro 10.5 because it’s refresh rate is 120 Hz. So the game ran at double speed.
Re: RnD for iOS
Thank you for the quick response! I will try on the weekend to add an additional speed option to the Vita port, with 16 ms delay. If it works, the next Vita version will hopefully have the speed settings very slow, slow, Normal, 60 fps, fast, and very fast.
Re: RnD for iOS
I just realized that the new mode should also have vsync enabled, so I will force vsync on whenever that mode is selected, and vsync off otherwise. It should work to be perfectly smooth then...
Re: RnD for iOS
Yes, that sounds reasonable. Please let me know if/how it works!
Besides this, I think I should add an option "vsync: on/off" to the graphics setup menu, to be able to both use smooth scrolling with VSYNC frame synchronization (if the system/hardware/driver supports it), and to also be able to choose one of the faster speed settings (which should then run without VSYNC).
@Les: Do you know if VSYNC is enabled by default on iOS?! I haven't found setting flag "SDL_RENDERER_PRESENTVSYNC" in the source code of your iOS version you sent me in 2016. And I think it is disabled by default in SDL 2.0. But I may be wrong here.
Besides this, I think I should add an option "vsync: on/off" to the graphics setup menu, to be able to both use smooth scrolling with VSYNC frame synchronization (if the system/hardware/driver supports it), and to also be able to choose one of the faster speed settings (which should then run without VSYNC).
@Les: Do you know if VSYNC is enabled by default on iOS?! I haven't found setting flag "SDL_RENDERER_PRESENTVSYNC" in the source code of your iOS version you sent me in 2016. And I think it is disabled by default in SDL 2.0. But I may be wrong here.
Re: RnD for iOS
I added a game speed mode between Normal and Fast called '60 fps,' with a frame_delay of 16. In this mode I force Vsync to be on. The scrolling in all EM engine levels is now perfectly smooth. The gameplay is also 20% faster than normal speed. This is because of the difference between 60 Hz and 50 Hz, and was expected.
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.
If I try the faster settings with Vsync on, the speed does not increase beyond 60 fps, as expected. The slower modes are still slow, even with VSync on. I think their speeds are nevertheless slightly altered due to Vsync. The iOS port also behaves this way. I therefore decided to turn Vsync off for all modes apart from the new 60 fps mode.
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:
This is a long loop over 128 x 128 tiles, even though most levels contain only 64*32 tiles. I achieved a significant speed-up by only looping over the relevant tiles:
I added the MIN statements to make sure I include enough tiles. When I used lev.width - 2 and lev.height - 2 as upper values, then the digging animations were not correctly updated when I moved my player sprite to the far right or far bottom edge of the bundled Emerald Mine level.
If I can also achieve a speed-up in the Supaplex engine and RnD engine code, then everything should become perfectly smooth on the Vita. It seems the only problem is scrolling, because everything is perfect in single screen levels.
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.
If I try the faster settings with Vsync on, the speed does not increase beyond 60 fps, as expected. The slower modes are still slow, even with VSync on. I think their speeds are nevertheless slightly altered due to Vsync. The iOS port also behaves this way. I therefore decided to turn Vsync off for all modes apart from the new 60 fps mode.
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:
Code: Select all
if (!game.use_native_emc_graphics_engine)
for (y = 2; y < EM_MAX_CAVE_HEIGHT - 2; y++)
for (x = 2; x < EM_MAX_CAVE_WIDTH - 2; x++)
SetGfxAnimation_EM(&graphic_info_em_object[Draw[y][x]][frame],
Draw[y][x], 7 - frame, x - 2, y - 2);
Code: Select all
if (!game.use_native_emc_graphics_engine)
{
#if defined(PLATFORM_VITA)
// This causes significant speedup on Vita when playing the bundled Emerald Mine levels
int x_max = MIN(lev.width + 2, EM_MAX_CAVE_WIDTH - 2);
int y_max = MIN(lev.height + 2, EM_MAX_CAVE_HEIGHT - 2);
for (y = 2; y < y_max; y++)
for (x = 2; x < x_max; x++)
#else
for (y = 2; y < EM_MAX_CAVE_HEIGHT - 2; y++)
for (x = 2; x < EM_MAX_CAVE_WIDTH - 2; x++)
#endif
SetGfxAnimation_EM(&graphic_info_em_object[Draw[y][x]][frame],
Draw[y][x], 7 - frame, x - 2, y - 2);
}
If I can also achieve a speed-up in the Supaplex engine and RnD engine code, then everything should become perfectly smooth on the Vita. It seems the only problem is scrolling, because everything is perfect in single screen levels.
Re: RnD for iOS
iOS source is available here: https://github.com/lesbird/RocksNDiamon ... ree/masterrsn8887 wrote: ↑Mon May 28, 2018 3:09 pm Hello,
Can you release the iOS version sourcecode. I am asking because I would like to see how you got it to run in perfectly smooth 60fps. I ported the game to the PS Vita recently, and can get it to run fast on that platform, but it is never so perfectly smooth like in your iOS port.
Even on my MacBook or Windows PC it never scrolls so perfectly
So I am very curious, what did you change to make it so smooth?
Thanks you in advance for your help.
Re: RnD for iOS
Holger, as far as I know VSYNC is always enabled on iOS at the OS level. Not sure if it can be bypassed.Holger wrote: ↑Fri Jun 01, 2018 7:22 pm Yes, that sounds reasonable. Please let me know if/how it works!
Besides this, I think I should add an option "vsync: on/off" to the graphics setup menu, to be able to both use smooth scrolling with VSYNC frame synchronization (if the system/hardware/driver supports it), and to also be able to choose one of the faster speed settings (which should then run without VSYNC).
@Les: Do you know if VSYNC is enabled by default on iOS?! I haven't found setting flag "SDL_RENDERER_PRESENTVSYNC" in the source code of your iOS version you sent me in 2016. And I think it is disabled by default in SDL 2.0. But I may be wrong here.