Chronosoft
Left Anchor
Right Anchor

iOS 4 on iPhone 2 kills the performance - Fixed in V1.6(?)

Discussion about Rogue Touch for the iPhone and iPod Touch

Re: iOS 4 on iPhone 2 kills the performance

Postby kharstin » Tue Jun 29, 2010 1:57 pm

I am running on an IPOD Touch. A little unsure about whether it is 3G, but I think it is. OS 4.0 definitely kills performance as well as the battery.

I would be happy to test a fix.

Ken Harstine
kharstin
 
Posts: 2
Joined: Thu Jun 24, 2010 3:41 pm

Re: iOS 4 on iPhone 2 kills the performance

Postby CommanderData » Wed Jun 30, 2010 1:37 pm

I have my iPhone 4 in hand, yesterday was spent getting it ready for development, which also included updating to Mac OSX 10.6, iTunes 9.2, and the latest iPhone SDK. Took forever to finish all that junk, guess that will teach me to update as things become available instead of waiting until I need it all! :oops:

Now that I've had several hours to mess around with Rogue Touch in iOS 4.0 there are a few things I can see...

1) Looks like default thread priorities may have changed, so I am trying to force my game thread into a higher priority (for the technically inclined, I needed a joinable pThread to make things work properly. NSThreads are not joinable). This might be due to Apple's "Grand Central" technology trying to schedule things based on it's idea of need, rather than MY idea of what is needed.

2) Updates to some objects seem to take a long time. Select an item in inventory, and as the screen comes into view, the "action" buttons (not throw or drop) will end up showing the wrong activity as it slides in. Let's say I look at a weapon, then go to look at a scroll. As the scroll detail screen slides in, the action still says "wield", and switched to "read" after it stops. Oddly, the item name and icon show correctly, all that info is set AT THE SAME TIME, prior to sliding the display in.

3) Coregraphics draw calls are dramatically slower. I see calls to a resample_create, resample_filter, img_interpolate_stage, resample_byte_v_Ncpp_vector, and esample_byte_h_3cpp_vector... these would appear to be happening due to the new scaling that iOS 4 allows on UIViews and objects so that they can display normal on older devices and upscale to fit the iPhone 4 screen. Googling reveals pretty much nothing on the topic of this.


I do see that the performance degrades more quickly the further out you are zoomed. If you pinch-zoom back up to 100% magnification, things are not perfect, but it does help quite a bit. Zooming way out caused the screen to update slower than molasses in January.

Battery life would likely be affected as kharstin notes, because this Coregraphics scaling appears to be handled by the CPU. Monitoring it shows huge spikes of activity when screen updates are taking place.

Attempting to disable antialiasing did not help. I'm afraid if I can't find a simple solution in a few days I might have to pull it from the app store completely, pending a rewrite in OpenGL when I'm done with Mineko. Hopefully it does not come to that. I'll be asking for UDIDs to test with as soon as I have something that makes a noticeable improvement.

Sorry for the gloomy outlook here, wish I had some better news to report. The good news is I've only spent a couple of hours on this so far, and a solution may present itself yet :D
User avatar
CommanderData
Site Admin
 
Posts: 609
Joined: Sun Jan 25, 2009 3:17 pm

Re: iOS 4 on iPhone 2 kills the performance

Postby Ace Pumpkin » Wed Jun 30, 2010 2:40 pm

CommanderData wrote:I do see that the performance degrades more quickly the further out you are zoomed. If you pinch-zoom back up to 100% magnification, things are not perfect, but it does help quite a bit. Zooming way out caused the screen to update slower than molasses in January.


I am zoomed out to the second level (not with the smallest icons but with the next-smallest) and can multiple-hit ice monsters. I seem to be able to do so only if I strike first, however... I am on Floor 1 as an Apprentice, in the middle of a lit room, away from walls (though that doesn't seem to matter), I am "wielding" fists and am playing as Jared. Something replicable at last! Inventory (in order of display) (which is what I started with, although I removed the ring of regeneration and wore the ring of slow digestion):
+0 scale mail [armor class 5]
(Currently Worn Armor)
Some food
A ring of regeneration (jade)
A +2 ring of add strength (turquoise)
(Currently on Right Hand)
A ring of slow digestion (tiger eye)
(Currently on Left Hand)
A scroll titled "tuwzaj battot roq"

Also, I notice that if I press and hold the sleep button while I am on top of stairs, the repeat of the "Zzzzzz..." message is slower than if I step off the stairs and press and hold the sleep button.

Also [last edit, I promise!], my strength shows as 16(16) and not 18(16). I'm about to remove the ring of add strength and re-wear it... I'm at 14(16) now! Re-wearing it places me back at 16(16)... (Come to think of it, this bug may not be related to iOS4!)
User avatar
Ace Pumpkin
 
Posts: 6
Joined: Fri Jun 25, 2010 11:24 am

Re: iOS 4 on iPhone 2 kills the performance

Postby CommanderData » Wed Jun 30, 2010 3:37 pm

I think some funny business you are seeing is due to the fact that drawing is so slow, and the pthreads being treated differently. Ideally if the drawing speed is brought up to par we should see all these synchronization problems disappear. Probably explains why you can make the really crazy stuff happen when zoomed out all the way too (down to 25%).


Interesting notes from the last few hours work:

1) I think CGInterpolationQuality has changed. I notice that kCGInterpolationMedium has been added for iOS4, and it's likely that the default value has been updated too. I cannot say with certainty but the default interpolation is probably Medium or High. Turning this OFF has given me a speed boost.

2) You lose speed/performance as you explore a level, and then it goes back to normal at the start of the next floor. Turns out that drawing the MINI-MAP in iOS4 is hurting things as you reveal more and more of the floor. This goes back to the same performance issues of zooming way out, causing the iOS4 graphics system to scale and rescale images like mad. :evil:

By turning interpolation OFF, and limiting zooms to between 50-100%, and turning off the mini map I get a rendering speed on the iPhone 4 that appears to be 30-50% faster than the app store version of Rogue Touch on my 3GS, running OS 3.0. That means it is FAST. Fast like you'd expect it to be on the fastest device out there, instead of watching paint dry. :D

What I need to do:
1) Determine if possible a way to render the mini-map without killing performance
2) Decide if I can allow interpolation on the main dungeon view. Right now if you zoom below 100%, things are a bit blocky
3) Decide if zooming should simply be disabled? Would save a lot of graphic glitches and preserve speed gains from elsewhere.

So many problems would go away if I had the time to rewrite Rogue Touch to use OpenGL... If only I had that much free time :lol:
User avatar
CommanderData
Site Admin
 
Posts: 609
Joined: Sun Jan 25, 2009 3:17 pm

Re: iOS 4 on iPhone 2 kills the performance

Postby CommanderData » Thu Jul 01, 2010 11:46 am

Ok! Everyone must be ready for an update now...

To recap: iOS 4.0 appears to make some changes to how threading is handled, and it especially has messed with the interpolationQuality defaults for CGContextDrawImage (which is the main workhorse for getting my screen drawn in Rogue Touch). It is doing extra scaling at all times due to the abstraction layer in iOS 4 for points vs pixels on screen. Finally, someone in the Apple developer forums also speculates that they may no longer be caching images in memory for redraws which is quite possibly part of the speed problem, but not as much as the scaling/interpolation issues.

Good news is I've put in a lot of work on the problem and come up with an acceptable balance for working around iOS 4 "features". The changes I have made also speed up OS 3.X device refreshes too, so everyone wins! The only thing some may not like here is I've limited the zoom level to 50-100% to ensure high performance. At least the mini-map is there to help :lol:

Version 1.51 will be submitted today, containing the following:
* iOS 4 speed improvements (any device will play faster now!)
* Nymphs no longer steal the *last* item of your pack, but a truly random magic item from you
* Venus Flytraps now prevent you from going down stairs if held in their vines
* Scroll of Safe Passage fixed- it would actually *hide* previously found traps without disarming them. Not anymore!
* Tweaks to search messages (scrawlings and gold in cracks will be less frequent)
* Slimes will no longer split when hit with a War Hammer :D
* Knockback Atttacks! You have a chance to push back a monster with each successful blow you strike! The chance grows with increased strength and higher experience levels. Monsters that get pushed into a wall or another monster take additional damage!

*** Important note for when the update arrives ***
Please write a review in iTunes (or update your existing review)... Your continued support will be rewarded with more goodies! :mrgreen:
User avatar
CommanderData
Site Admin
 
Posts: 609
Joined: Sun Jan 25, 2009 3:17 pm

Re: iOS 4 on iPhone 2 kills the performance

Postby NightOwl40 » Thu Jul 01, 2010 3:09 pm

Good to know that your're submitting at least a perfomance update ;) Havent upgraded to the latest operating system yet, but I will soon.
User avatar
NightOwl40
 
Posts: 160
Joined: Mon Mar 16, 2009 7:44 pm
Location: USA

Re: iOS 4 on iPhone 2 kills the performance

Postby CommanderData » Fri Jul 02, 2010 1:53 pm

NightOwl40 wrote:Good to know that your're submitting at least a perfomance update ;) Havent upgraded to the latest operating system yet, but I will soon.


Well, there's hope for more to come ;)

I wanted to make sure that there was a bit more than the simple iOS4 performance improvement, so I backported some of the bugs I'd identified and fixed in my test build here, along with a couple of additional features. That test build has other stuff happening in it that's not quite ready for prime time, hence the 1.51 update :D

The update is still "waiting for review". Not sure how much Apple's people will be working on the holiday weekend, so this probably won't get approved until middle of next week. Fingers crossed it happens soon! It's been so long since I have submitted, the rules have changed :mrgreen:
User avatar
CommanderData
Site Admin
 
Posts: 609
Joined: Sun Jan 25, 2009 3:17 pm

Re: iOS 4 on iPhone 2 kills the performance

Postby CommanderData » Wed Jul 07, 2010 9:58 am

The wait is killing me, as much as it must be for all of you!

Update has been in Apple's hands since Thursday July 1st. Of course there was the holiday weekend in there, probably not much app-review work got done during it. Rogue Touch version 1.51 is still in the queue "waiting for review"... I will chime in again as soon as I know more. Fingers crossed! :mrgreen:
User avatar
CommanderData
Site Admin
 
Posts: 609
Joined: Sun Jan 25, 2009 3:17 pm

Re: iOS 4 on iPhone 2 kills the performance

Postby CommanderData » Wed Jul 07, 2010 10:56 pm

Good news, Rogue Touch version 1.51 has just been approved for sale at 10:45PM EST!

It will take several hours to propogate through Apple's various iTunes servers, but you should be able to download the update soon... Anyone with iOS 4, please chime in here with before/after impressions of speed (and what device you are running on). Thanks for your patience, more to come! :D
User avatar
CommanderData
Site Admin
 
Posts: 609
Joined: Sun Jan 25, 2009 3:17 pm

Re: iOS 4 on iPhone 2 kills the performance

Postby Nighthawk » Thu Jul 08, 2010 12:30 am

Just grabbed it now... something to play with to get me over my Dice Diving addiction!
I'll give it a once over (perhaps tonight yet) and get you some details.

*******

(edit): So, first bug I notice - the monsters appear anchored in place and do not attack me, even if I stand right next to them and "sleep." These aren't sleeping monsters (no "zzzzz"s above their heads). Creatures that are asleep wake up properly when I approach them non-stelthily, but show no other signs of life. Creatures that are asleep when I leave a room appear to have woken up properly (to start their following routines), but are not following - just anchored in place. Creatures that can attack at a distance (ice monster, etc.) do not do so when I'm close to them and in their firing path, so it looks like the monsters are totally docile. Wondering if you forgot to flip a #define from off to on for testing?

(edit2): WTF.... after restarting a new game (my second since the update), now the monsters seem to be just fine. I did a full reboot of my phone before I started it the first time, to make sure there wouldn't be any weirdness, but that was weird. Wondering if anyone else will have the same experience... Going to try deleting RT entirely from my phone and re-installing, just to see if I can get it to do it again...

(edit3): Nope, everything's fine after a full delete - reinstall - reboot cycle. No monster issues. What I can tell you is that I wasn't in the middle of a (saved) game when I updated to v1.51.... DOH! Just figured out what's going on... If you start a game, then home button back out, then come back in, it turns the monsters "off"! So, the problem is in whatever you did to handle iOS4 multitasking, because if I "multitask" out to say, Settings, and then back in, the same thing happens. The monsters stay "dead" until you start a new game, then they're fine again (until you quit). Turning the phone off while playing and then on again is not an issue, but I suspect that taking a call while playing will be.

(edit4) Bed now, but what's in this post should keep you busy (and panicking) for at least a day or so. I may attempt a 0 kill Amulet retrieval just for giggles.

(edit5) No really, bed now (it's 3:30am!).
******************

Speed is much improved (32Mb 3GS, iOS 4.0), however running is very jerky - sometimes runs fast, then slows a little, then fast again, similar to what I described in v1.50 on iOS4 - seemed like an "encountered a door I need to put on the screen" kind of thing. Not sure if it's the mini-map or something else. The "movement is quick when starting a level but slows down the more you explore" is still there, but not as bad. Fade out on stairs decent and fade in on new level (after the first) still seem a little sluggish. Combat is good and quick, but has its own issues.

In the menus, when selecting an item, the screen wipes from right to left and presents the buttons of what to do with the item. It may be my imagination, but the screen wipe feels slower than it used to be. Also, button(s) not labelled "Throw" or "Drop" - no word fills in until after the wipe completes - I don't remember that being the case in v1.5. Scroll casting animation and wand zap / weapon throw are nice and zippy.
Last edited by Nighthawk on Thu Jul 08, 2010 3:36 am, edited 1 time in total.
User avatar
Nighthawk
 
Posts: 172
Joined: Fri Mar 27, 2009 12:48 am
Location: Philadelphia, PA

PreviousNext

Return to Rogue Touch

Who is online

Users browsing this forum: No registered users and 3 guests

cron
Left Anchor
Right Anchor