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 CommanderData » Wed Jul 14, 2010 2:11 pm

It would only be restored to "base +0 value", because the item data structure has no variable for armor to tell me what it was prior to becoming a rusted out piece of junk, and I really don't want to monkey with the item structure and accidentally break large numbers of things :lol:

Anyway, a scroll that acts the way *you* would prefer will probably exist in Spirit Hunter Mineko, based on my reasons in the previous post. In Rogue Touch, it would be disappointing due to only restoring armor to +0. Although I could call it a "refurbish" scroll perhaps? Someone would find it useful, bringing a set of -6 rusted out plate mail back to +0 might just make someone's game a whole lot more survivable ;)
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 Biffsnot » Fri Jul 16, 2010 5:56 pm

Hello. I am noticing this slowdown on almost all 2d games on the 3g with ios 4, including other roguelikes like iNethack and slash-em. Doing a little research I came across this, I dont know if it will help - but hell, couldnt hurt.

I’m talking about CGContextDrawImage. My two most popular games, reMovem and reMovem free, made heavy use of this functionality to draw the balls on the screen. It’s not uncommon, especially for code ported from Mac OS X, where Quartz 2D is widely used for drawing. I’m not sure how this is possible, but CGContextDrawImage (and its cousin [UIImage drawInRect:]) is measurably slower on older iPhone devices. In my case, where it used to take less than 20 ms to render key elements of the screen on iOS 3.x, it now takes around 500 ms. That is, suffice to say, enough to cripple these games.

With all the commotion around the successful iPhone 4 launch recently I’m sure Apple would rather not worry so much about compatibility and performance on older CPUs. Fortunately you don’t have to wait for Apple to address the problem. I solved it in reMovem by using CALayer to draw the images I needed, and was able to get a performance boost at the same time. The same key elements of my game now render in around 2 ms. Here’s how.

The key to using CALayer is to understand that each UIView is backed by a Core Animation layer object. Each layer can have multiple sublayers. Each layer object has numerous properties, many of which are animatable. Simply attach a sublayer to your view’s existing layer, set its content property to your image, and you are done. Well, sort of. A good place to learn more about Core Animation is the excellent Cocoa Is My Girlfriend blog by Matt Long and Marcus Zarra.
...

Adding CALayer drawing to you code requires a little setup, but that can be done once in an init function. In mine, we create a bunch of sublayers, modify the properties appropriately, and add them to the view’s main layer. The tradeoff here is we require slightly more resources (sublayer memory) but we obtain vast improvements in performance. Why’s that? I imagine Apple’s engineers are spending tons of time optimizing Core Animation, which is literally behind everything you see on the iPhone and iPad screen. Betting on CALayer is a safe bet for the foreseeable future. Here’s the new code, which is not too different from the old code:


This info is from http://blog.mundue.net/2010/06/ios4-why-you-so-slow/ where the blogger put up several code snippets to get people rolling on it.

So this may or may not be valuable info for you, I am not sure.

It is very disheartening that apple would take something every 2d game uses and screw it up so bad. iNethack, Rogue Touch, and tons of other games take forever to scroll and update the screen now. Rogue Touch alone fades in so damn slow when starting or loading a game, and its a good half second lag from touch to move. I could go on about this but this isnt the place for venting my disappointment :)

One last bit - for those who want to know, you can indeed roll back to OS 3.1.3, though doing so is not as simple as upgrading. Google it and you can find info on downgrading, which I may very well do myself, because while Rogue Touch is being updated because its Dev is active, many other games will likely never get the proper fixes to repair this issue.

Keep up the great work and thanks for a fine roguelike for the iPhone. Good luck battling Apples bad decisions every update or so though ;)
Biffsnot
 
Posts: 2
Joined: Thu Apr 23, 2009 4:37 pm

Re: iOS 4 on iPhone 2 kills the performance

Postby CommanderData » Fri Jul 16, 2010 6:57 pm

Biffsnot wrote:Hello. I am noticing this slowdown on almost all 2d games on the 3g with ios 4, including other roguelikes like iNethack and slash-em. Doing a little research I came across this, I dont know if it will help - but hell, couldnt hurt.

I’m talking about CGContextDrawImage. My two most popular games, reMovem and reMovem free, made heavy use of this functionality to draw the balls on the screen. It’s not uncommon, especially for code ported from Mac OS X, where Quartz 2D is widely used for drawing. I’m not sure how this is possible, but CGContextDrawImage (and its cousin [UIImage drawInRect:]) is measurably slower on older iPhone devices. In my case, where it used to take less than 20 ms to render key elements of the screen on iOS 3.x, it now takes around 500 ms. That is, suffice to say, enough to cripple these games.

With all the commotion around the successful iPhone 4 launch recently I’m sure Apple would rather not worry so much about compatibility and performance on older CPUs. Fortunately you don’t have to wait for Apple to address the problem. I solved it in reMovem by using CALayer to draw the images I needed, and was able to get a performance boost at the same time. The same key elements of my game now render in around 2 ms. Here’s how.

The key to using CALayer is to understand that each UIView is backed by a Core Animation layer object. Each layer can have multiple sublayers. Each layer object has numerous properties, many of which are animatable. Simply attach a sublayer to your view’s existing layer, set its content property to your image, and you are done. Well, sort of. A good place to learn more about Core Animation is the excellent Cocoa Is My Girlfriend blog by Matt Long and Marcus Zarra.
...

Adding CALayer drawing to you code requires a little setup, but that can be done once in an init function. In mine, we create a bunch of sublayers, modify the properties appropriately, and add them to the view’s main layer. The tradeoff here is we require slightly more resources (sublayer memory) but we obtain vast improvements in performance. Why’s that? I imagine Apple’s engineers are spending tons of time optimizing Core Animation, which is literally behind everything you see on the iPhone and iPad screen. Betting on CALayer is a safe bet for the foreseeable future. Here’s the new code, which is not too different from the old code:


This info is from http://blog.mundue.net/2010/06/ios4-why-you-so-slow/ where the blogger put up several code snippets to get people rolling on it.

So this may or may not be valuable info for you, I am not sure.

It is very disheartening that apple would take something every 2d game uses and screw it up so bad. iNethack, Rogue Touch, and tons of other games take forever to scroll and update the screen now. Rogue Touch alone fades in so damn slow when starting or loading a game, and its a good half second lag from touch to move. I could go on about this but this isnt the place for venting my disappointment :)

One last bit - for those who want to know, you can indeed roll back to OS 3.1.3, though doing so is not as simple as upgrading. Google it and you can find info on downgrading, which I may very well do myself, because while Rogue Touch is being updated because its Dev is active, many other games will likely never get the proper fixes to repair this issue.

Keep up the great work and thanks for a fine roguelike for the iPhone. Good luck battling Apples bad decisions every update or so though ;)


Hi Biffsnot! Thanks for reporting in :mrgreen:

You are correct that Apple has a problem with CGContextDrawImage, and it does affect many 2-D games out there, especially the roguelike family you brought up. CGContextDrawImage has been slowed down roughly by a factor of 10! I've seen and worked a bit on the code for iNethack and SlashEm in the past, and can confirm that those same draw calls are used. Dirk Z. and I haven't spoken recently but I may have to check in with him to see if I can help a bit.


Regarding the info and site you found:
Actually, since version 1.0 Rogue Touch has been using CALayers to hold all drawn objects on screen. It was the only way to get decent performance... If I'd done all drawing straight to a single view, RT would never have seen the light of day. I'd found that article as well and groaned when I discovered that guy's revelation was actually something I have already been doing all along. That meant I needed to get more devious to find new levels of performance on iOS 4.


On the topic of Rogue Touch:
You have been playing with the latest, version 1.52, right? What zoom level do you usually play at? I notice you're on an iPhone 3G, which is the oldest and slowest device that iOS 4 can be installed on. If you can answer these questions it'll help me to help you more... so please let me know :lol:

I made some changes in 1.52 that optimized drawing quite a bit, and version 1.52 has been regarded as making the game very playable on more recent devices, or older ones if you keep the zoom level at 100%. Pinch zooming out to 50% or 25% is much slower, and I bet on an old 3G iPhone it is painful. :evil:

Since I am never one to stop tweaking, after version 1.52 was ready for download in iTunes I went back through and actually came up with some other methods to increase speed, including a very new and clever way to render the mini-map. All these new ideas combined for a pretty dramatic increase of speed in version 1.6. Also added in some new items, iOS 4 multitasking enhancements, and retina display support for good measure!

Version 1.6 was submitted to Apple today, 7/16/2010, and with any luck should be available by next weekend! :mrgreen:


Final notes:
I can't really talk about what happens in Apple's private developer forums, but I can say that others have brought up the slow draw speed issue, and fairly high profile people at Apple have acknowledged its existence. At least enough to indicate they will look into it. Whether any action is taken in a firmware update and when, I have no idea.
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 Biffsnot » Fri Jul 16, 2010 9:40 pm

Hey, thanks for the response. Sorry the page didn't solve the issue :D But I will keep my eye out for more info.

As far as my issue on my machine, it is indeed the most underpowered piece of machinery since the TRS-80. The 3g was a poor excuse of a computing device, and it amazes me to see just how little processor speed and ram they gave it in an age where neither is expensive enough to skimp on - especially with some of the powerful PDA based offerings from Apple's competitors. Its hasn't sunk Apple yet, as they have a very strong reputation and fan base, but no one is bullet proof, and if they do things like release a phone with 128MB(like the 3g) of ram, and then use 95-100MB(also like the 3g) for system processes and the like, they will damage themselves greatly in the future.

Anyway enough ranting - cant help it really when it seems Apple is trying real hard to make the device I spent a good amount on obsolete by force rather then letting it flow its course ;)

However, I am playing at 100% zoom. My fiancée has the 16gb model of the same phone running 3.1.3, and the game runs flawless, just as it did on my machine right before 'upgrading' to iOS 4 (codename 'GetTheNewPhoneSinceWeSlowedYoursToACrawl'). Now on my machine, when 'running' I do maybe 1 or 1.5 tiles a second. Chuga-chuga-chuga is all I got to say. It is the newest released version of Rogue Touch, as I am a compulsive updater.

If you could shoot me a beta or w/e I could tell you if your changes have elevated my performance above that of an Atari 800 from 1982, and will also let me know if I truly should go through the trouble of a downgrade, since its safe to say if you cannot find a way around this, others will not either.

Thanks again.
Biffsnot
 
Posts: 2
Joined: Thu Apr 23, 2009 4:37 pm

Re: iOS 4 on iPhone 2 kills the performance

Postby CommanderData » Fri Jul 16, 2010 10:13 pm

Biffsnot wrote:Hey, thanks for the response. Sorry the page didn't solve the issue :D But I will keep my eye out for more info.

As far as my issue on my machine, it is indeed the most underpowered piece of machinery since the TRS-80. The 3g was a poor excuse of a computing device, and it amazes me to see just how little processor speed and ram they gave it in an age where neither is expensive enough to skimp on - especially with some of the powerful PDA based offerings from Apple's competitors. Its hasn't sunk Apple yet, as they have a very strong reputation and fan base, but no one is bullet proof, and if they do things like release a phone with 128MB(like the 3g) of ram, and then use 95-100MB(also like the 3g) for system processes and the like, they will damage themselves greatly in the future.

Anyway enough ranting - cant help it really when it seems Apple is trying real hard to make the device I spent a good amount on obsolete by force rather then letting it flow its course ;)

However, I am playing at 100% zoom. My fiancée has the 16gb model of the same phone running 3.1.3, and the game runs flawless, just as it did on my machine right before 'upgrading' to iOS 4 (codename 'GetTheNewPhoneSinceWeSlowedYoursToACrawl'). Now on my machine, when 'running' I do maybe 1 or 1.5 tiles a second. Chuga-chuga-chuga is all I got to say. It is the newest released version of Rogue Touch, as I am a compulsive updater.

If you could shoot me a beta or w/e I could tell you if your changes have elevated my performance above that of an Atari 800 from 1982, and will also let me know if I truly should go through the trouble of a downgrade, since its safe to say if you cannot find a way around this, others will not either.

Thanks again.


Have you run AdHoc builds for anyone else before? If you can, PM me your UDID and I'll try to get you hooked up with a test version. I'd definitely be curious to know how the upcoming version 1.6 will behave on that dinosaur :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 Geddy » Sun Jul 18, 2010 3:41 pm

Has anyone else noticed this?
I've now played 3 different games (not in a row) where I've been alerted "you sense powerful magic on this level" and yet, each time, after searching each square (!) nothing special was to be found! :evil:
Geddy
 
Posts: 3
Joined: Wed Jul 14, 2010 12:10 am

Re: iOS 4 on iPhone 2 kills the performance

Postby Nighthawk » Sun Jul 18, 2010 5:08 pm

Geddy wrote:Has anyone else noticed this?
I've now played 3 different games (not in a row) where I've been alerted "you sense powerful magic on this level" and yet, each time, after searching each square (!) nothing special was to be found! :evil:


It depends on your definition of "special". "You sense powerful magic on this level" isn't just weapons (or, rarer, armor). Wands and staves with ~2x the regular number of charges, rings with unusually high bonuses: all of these count, too!
User avatar
Nighthawk
 
Posts: 172
Joined: Fri Mar 27, 2009 12:48 am
Location: Philadelphia, PA

Re: iOS 4 on iPhone 2 kills the performance

Postby CommanderData » Mon Jul 19, 2010 6:57 am

Nighthawk wrote:
Geddy wrote:Has anyone else noticed this?
I've now played 3 different games (not in a row) where I've been alerted "you sense powerful magic on this level" and yet, each time, after searching each square (!) nothing special was to be found! :evil:


It depends on your definition of "special". "You sense powerful magic on this level" isn't just weapons (or, rarer, armor). Wands and staves with ~2x the regular number of charges, rings with unusually high bonuses: all of these count, too!


Thats right... Weapons seem to be the one thing most people associate with this, but armor, wands and staves, and sometimes rings can be the trigger for this (Ring of Strength +5 for example) :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 oldroguer » Fri Jul 23, 2010 4:56 pm

CD,

Any update on getting the new build up to the App Store? I've got a pool going as to which solution to my RT performance problem will arrive first: the update or my new iPhone4 :lol:

Did you ever imagine you would have such influence over people's lives when you sat down to develop RT? Thousands of people waiting breathlessly for your next miracle upgrade....rushing to buy a new phone that may not actually make phone calls due to a bad antenna design....just so we can spend countless more hours running your code! What a rush that must be...
oldroguer
 
Posts: 30
Joined: Tue Oct 06, 2009 2:46 pm

Re: iOS 4 on iPhone 2 kills the performance

Postby CommanderData » Fri Jul 23, 2010 8:40 pm

Have to admit I never really expected many people to enjoy Rogue Touch as much as I did! It was meant to scratch that itch I had since playing the Atari ST version in the 1980s. Glad that it became a cult classic anyway :D

Rogue Touch 1.6 was submitted last Friday night, so we are at the one week mark now. It is still "waiting for review" at my last check. Maybe punishment for my expidited review of 1.52 :twisted:

I will update here if any news surfaces!

EDIt- I wrote the words, and it appears that Rogue Touch is now "in review" with Apple. Tonight may be the night after all! :lol:
User avatar
CommanderData
Site Admin
 
Posts: 609
Joined: Sun Jan 25, 2009 3:17 pm

PreviousNext

Return to Rogue Touch

Who is online

Users browsing this forum: No registered users and 3 guests

cron
Left Anchor
Right Anchor