Author Topic: iOS Canabalt Problems/Solutions  (Read 18588 times)

axcho

  • Active Member
  • ***
  • Posts: 174
  • Karma: +0/-0
    • View Profile
    • Evolution Live!
Re: iOS Canabalt Problems/Solutions
« Reply #40 on: Tue, Mar 22, 2011 »
Thinking about possible permutations for display, on the iPhone, iPad, and retina display...

Here's what I've come up with:

  • 1x-res art, unscaled, on iPhone (480x320)
  • 1x-res art, scaled, on retina (480x320)
  • 2x-res art, unscaled, on retina (480x320)
  • 1x-res art, scaled, on iPad (512x384)
  • 2x-res art, unscaled, on iPad (512x384)
  • 1x-res art, unscaled, on iPad (1024x768)

Can you think of anything else?

For specifying these options, choosing between 1x and 2x art could be pretty straightforward with a "@2x" suffix for filenames like Apple uses, or "-hd" like Cocos2D. And I guess there could be a boolean flag for using iPad proportions on the iPad, when you want to actually change the layout for the iPad version of the game.

Then on top of that there is the zoom property, which could be manipulated separately. Though it would be kind of silly to use zoom > 1 at the same time as 2x-resolution retina images, but who knows...

Thoughts?
« Last Edit: Tue, Mar 22, 2011 by axcho »

initials

  • Contributor
  • ****
  • Posts: 378
  • Karma: +0/-0
  • Initials
    • View Profile
    • Initials Blog. Code and other things.
Re: iOS Canabalt Problems/Solutions
« Reply #41 on: Wed, Mar 23, 2011 »
Nice thinking about that filtered accelerometer idea - I'll try that. :)

I'll also plan on looking into the buttons. Maybe the "over" state could be used for a "down" state instead on iOS?

There is demo code on the Apple developer site to do filtered accelerometer stuff with high and low pass.

Let me know if you have trouble finding it.
Initials: Super Lemonade Factory, Super Lemonade Factory Part Two, Above The Clouds, Revvolvver, Four Chambers of the Human Heart

axcho

  • Active Member
  • ***
  • Posts: 174
  • Karma: +0/-0
    • View Profile
    • Evolution Live!
Re: iOS Canabalt Problems/Solutions
« Reply #42 on: Wed, Mar 30, 2011 »
Hmm, I can hardly believe it but I think I've got all the retina display issues fixed for Flixel iOS! :D

...no, wait, FlxSprite's loadRotatedGraphic method doesn't seem to be working. Though it doesn't work in the original Flixel iOS release either...

...okay, I figured out why loadRotatedGraphic doesn't work - it's because there's no support for unique bitmaps with createGraphic! Urgh...

I'll work on that next.

twothreetwo

  • Member
  • **
  • Posts: 13
  • Karma: +0/-0
  • Game monkey
    • View Profile
Re: iOS Canabalt Problems/Solutions
« Reply #43 on: Fri, Apr 1, 2011 »
I hope this can help someone, but I just stripped down the Canabalt source to get something simple to start from without losing all the iPhone specific start-up stuff.  So, here's a HelloWorld template for your xCode, easy to install.

Just drop the whole folder into Developers/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Application

If you notice anything Canabalt-specific I forgot to remove, let me know!

Get it here: https://github.com/bigjko/Flx-iOS-template

FYI this template isn't compatable with Xcode 4 and above as Apple have changed the template format. You'll need Xcode 3.

axcho

  • Active Member
  • ***
  • Posts: 174
  • Karma: +0/-0
    • View Profile
    • Evolution Live!
Re: iOS Canabalt Problems/Solutions
« Reply #44 on: Sun, Apr 3, 2011 »
Hey, I downloaded Xcode 4 (no, I didn't overwrite Xcode 3!) and I've made a working test template for Xcode 4 already, so I feel pretty confident I can put one together for Flixel too.

Also, Eric Johnson found the translator code and sent it to me, so hopefully I'll have some time to try that out soon! :D

twothreetwo

  • Member
  • **
  • Posts: 13
  • Karma: +0/-0
  • Game monkey
    • View Profile
Re: iOS Canabalt Problems/Solutions
« Reply #45 on: Thu, Apr 14, 2011 »
I noticed that the pause functionality in FlxG has been commented out, I guess that's because it doesn't work at the moment? Does anyone know of a way to get the game to pause (even a hack will do)?

initials

  • Contributor
  • ****
  • Posts: 378
  • Karma: +0/-0
  • Initials
    • View Profile
    • Initials Blog. Code and other things.
Re: iOS Canabalt Problems/Solutions
« Reply #46 on: Thu, Apr 14, 2011 »
There is a FlxButton for pause in the PlayState.
All the pause functionality is in the PlayState also. It's a little confusing to be honest. There's a variable called ReallyJustPaused. I don't completely understand it actually, but it works.
Initials: Super Lemonade Factory, Super Lemonade Factory Part Two, Above The Clouds, Revvolvver, Four Chambers of the Human Heart

axcho

  • Active Member
  • ***
  • Posts: 174
  • Karma: +0/-0
    • View Profile
    • Evolution Live!
Re: iOS Canabalt Problems/Solutions
« Reply #47 on: Sat, Apr 16, 2011 »
By the way, I think I got createGraphic working for unique bitmaps, but Eric Johnson says that the draw method doesn't work either! :/

So I'm tackling that next...

twothreetwo

  • Member
  • **
  • Posts: 13
  • Karma: +0/-0
  • Game monkey
    • View Profile
Re: iOS Canabalt Problems/Solutions
« Reply #48 on: Sun, Apr 24, 2011 »
There is a FlxButton for pause in the PlayState.
All the pause functionality is in the PlayState also. It's a little confusing to be honest. There's a variable called ReallyJustPaused. I don't completely understand it actually, but it works.

Thanks a lot for your help! It definitely seems to do the trick.

axcho

  • Active Member
  • ***
  • Posts: 174
  • Karma: +0/-0
    • View Profile
    • Evolution Live!
Re: iOS Canabalt Problems/Solutions
« Reply #49 on: Mon, Apr 25, 2011 »
Just a progress update, or lack thereof.
I've been working on game prototypes in Flixel v1.43b and starting to play with v2.50b this week, so I haven't gotten around to fixing the draw method in Flixel iOS yet...

Flixel v2.50 is impressive, and now I'm stuck between the choice of making my games in v2.50 and taking advantage of these new, powerful features, or making them in Flixel v2.43b and being able to port them easily to iPhone. :/

It should be an easy choice in favor of v2.43b, but this latest game idea would benefit a lot from being able to zoom a camera in and out...

twothreetwo

  • Member
  • **
  • Posts: 13
  • Karma: +0/-0
  • Game monkey
    • View Profile
Re: iOS Canabalt Problems/Solutions
« Reply #50 on: Wed, Apr 27, 2011 »
What's everyone doing when it comes to "tweening" an objects property? In ios I've seen two methods; NSAnimation and CAAnimation but I don't think they will work with the Flixel port...or will they?

axcho

  • Active Member
  • ***
  • Posts: 174
  • Karma: +0/-0
    • View Profile
    • Evolution Live!
Re: iOS Canabalt Problems/Solutions
« Reply #51 on: Wed, Apr 27, 2011 »
What's everyone doing when it comes to "tweening" an objects property?

Using cocos2d instead of Flixel iOS? ;)

IQpierce

  • Gamewright
  • Member
  • **
  • Posts: 39
  • Karma: +2/-0
    • View Profile
    • Deep Plaid Games
Re: iOS Canabalt Problems/Solutions
« Reply #52 on: Wed, Apr 27, 2011 »
I actually started to write a fairly elaborate Tweening class to use in my Flixel iOS project (that would dynamically execute a "setXXX" selector on an object every frame where "XXX" was the property name you provided), but I had some trouble implementing it. Then I realized that I could get 90% of the effect I wanted by using the velocity and acceleration parameters on the sprites I wanted (similar to how the Canabalt code "tweens" in the background on the opening screen). It requires tweaking of numbers to get right but I got UI elements (FlxSprites, etc.) smoothly scrolling onto screen, etc. It was a decision to "cut with the grain" and work with the strengths of the engine, even though it wasn't exactly what I wanted.

A tweening solution would be a fantastic addition to Flixel iOS - I assume that most Flixel developers, like me, just use the awesome greensock libraries for tweening on AS3. Not having an equivalent available for iOS is frustrating... if anyone knows of a Cocoa alternative that has even 50% of the features of greensock's stuff, please please share.
I'm just one guy trying to make some interesting decisions!

goshki

  • Active Member
  • ***
  • Posts: 172
  • Karma: +0/-0
    • View Profile
    • Vigeo Games
Re: iOS Canabalt Problems/Solutions
« Reply #53 on: Thu, May 12, 2011 »
I actually started to write a fairly elaborate Tweening class to use in my Flixel iOS project (that would dynamically execute a "setXXX" selector on an object every frame where "XXX" was the property name you provided), but I had some trouble implementing it. Then I realized that I could get 90% of the effect I wanted by using the velocity and acceleration parameters on the sprites I wanted (similar to how the Canabalt code "tweens" in the background on the opening screen). It requires tweaking of numbers to get right but I got UI elements (FlxSprites, etc.) smoothly scrolling onto screen, etc. It was a decision to "cut with the grain" and work with the strengths of the engine, even though it wasn't exactly what I wanted.

A tweening solution would be a fantastic addition to Flixel iOS - I assume that most Flixel developers, like me, just use the awesome greensock libraries for tweening on AS3. Not having an equivalent available for iOS is frustrating... if anyone knows of a Cocoa alternative that has even 50% of the features of greensock's stuff, please please share.


Just so you know, there is a Objective-C tweening library based on ActionScript 3 Tweener: http://www.tweenc.com/. Unfortunately I cannot verify how well would it suit the Flixel iOS.

IQpierce

  • Gamewright
  • Member
  • **
  • Posts: 39
  • Karma: +2/-0
    • View Profile
    • Deep Plaid Games
Re: iOS Canabalt Problems/Solutions
« Reply #54 on: Thu, May 12, 2011 »
That's great to know about goshki, thanks for pointing it out!

I don't know if I'll have a chance to evaluate it with Flixel on my current project, but we are redoing a lot of animations and menu stuff right now. If I do try it with Flixel then I'll be sure to post about my experiences with it here on the forums.
I'm just one guy trying to make some interesting decisions!

twothreetwo

  • Member
  • **
  • Posts: 13
  • Karma: +0/-0
  • Game monkey
    • View Profile
Re: iOS Canabalt Problems/Solutions
« Reply #55 on: Fri, May 13, 2011 »
Hey, I'm trying to get the retina display working with my game and at the moment the image I'm appending "@x2" to is selected by default but isn't getting scaled down. Is that because I need to upscale all of my other images as well? I have about a hundred images that would need up scaling so was hoping to test with one image first :s...

My game is landscape.

IQpierce

  • Gamewright
  • Member
  • **
  • Posts: 39
  • Karma: +2/-0
    • View Profile
    • Deep Plaid Games
Re: iOS Canabalt Problems/Solutions
« Reply #56 on: Fri, May 13, 2011 »
Higher in this thread, there were some posts about Retina issues. I posted the workaround I had settled on:

Quote
Ultimately my fix was simple: in my FlxGame's primary init function, where it calls [super initWithOrientation...], I no longer ever pass in TRUE for the "useTextureBufferZoom:" parameter (the code provided with Canabalt was passing in TRUE when using an iPads or Retina display). I do however change the "zoom" parameter to be 2.0 when Retina is enabled - and everything just works, the game is scaled up 2x.

Note that I'm not making an iPad game, just an iPhone game that I need to be sure works on iPhone 4... so I haven't tested how this changes iPad behavior yet. In other words, YMMV.

However axcho later posted that he had consulted with Eric Johnson and fixed the Retina issues properly! (But it sounded like there were still issues with rotated textures.) Not sure what happened with that. It looks like neither that, nor anything else, have gone into the official git branch of iOS Flixel, which hasn't been updated since December: https://github.com/ericjohnson/canabalt-ios/commits/master

axcho, do you have somewhere we could pull your additions from?
I'm just one guy trying to make some interesting decisions!

axcho

  • Active Member
  • ***
  • Posts: 174
  • Karma: +0/-0
    • View Profile
    • Evolution Live!
Re: iOS Canabalt Problems/Solutions
« Reply #57 on: Sat, May 14, 2011 »
I do in fact have a version of Flixel iOS that would fix all your retina issues, twothreetwo.

And rotated textures work fine, just not the rotation caching (which is pointless for iOS anyway). But currently the draw method does not do anything, and there are other things which I'd like to change and clean up before I make a public release of it.

However, I'd be glad to send you what I have - just PM me your email address.

ExpertNovice

  • Active Member
  • ***
  • Posts: 124
  • Karma: +0/-0
  • Now we're cookin' with bacon!
    • View Profile
Re: iOS Canabalt Problems/Solutions
« Reply #58 on: Mon, Jun 27, 2011 »
I just wanted to encourage everyone hard at work on this project.  You guys are gonna put flixel firmly on the map when people start making a buck off of it.

Flixel is just so quick! And my brother always says the iPhone is the best platform, everyone has one. :D

Seriously guys, nice work.

initials

  • Contributor
  • ****
  • Posts: 378
  • Karma: +0/-0
  • Initials
    • View Profile
    • Initials Blog. Code and other things.
Re: iOS Canabalt Problems/Solutions
« Reply #59 on: Mon, Jun 27, 2011 »
Thanks!

I would be great to see the same level of community input as the Flash version but not everyone can buy all the Apple stuff to start making games. It's really quite expensive when you add it all up.
Initials: Super Lemonade Factory, Super Lemonade Factory Part Two, Above The Clouds, Revvolvver, Four Chambers of the Human Heart