Flash vs Torque on iPhone - a comparison
by Conor O'Kane · in iTorque 2D · 10/04/2010 (8:47 am) · 16 replies
At RMIT University I supervise teams of 3rd years who are working on their game projects. Two teams asked me to help them get their games working on an iPad today. Here's how it went.
Team 1 has made a flash game. I'd never even used flash before today, but I googled it and found a PDF on Adobe's site on how to export flash games for iOS.
Here's the process:
Open your flash project in Adobe Flash CS5.
In the iPhone export settings, attach your certificate and provisioning profiles.
Add an icon file.
Click Publish - this creates an iPhone app, signed and ready to run.
Drag this app onto iTunes and sync your device.
Your game is now ready to play.
Note there's no need to use Xcode at all or download the iPhone SDK or change any of your scripts. It just works.
Team 2 has made a TGB game.
Here's the process to get their game working on iPad.
Download Xcode and the iPhone SDK.
Create a new iT2D project.
Copy the /game folder from the TGB game into the new project's /projectFiles folder.
Delete the /scripts folder from the new project as old torque projects use /gamescripts instead.
Set the correct level file to load in game.cs as loading "%level" doesn't work.
Replace all the instances of clone() in your game with cloneWithBehaviors() since clone() is bugged.
Add a %this.setUsesPhysics(true) for every moving object in the scene in its onLevelLoaded callback (do not use the editor checkbox - this doesn't work).
Edit the engine source so that particle effects continue to play after leaving the camera.
Edit the engine source so that particle systems load correctly.
Ignore the fact that the audio doesn't work on the Mac.
Change all of your onMouseDown scripts to oniPhoneTouchDown.
Do the same for mouseDragged and mouseUp.
Re-Write your entire touch handling scripts to use pickLists based on screen co-ordinates instead of object callbacks.
Export all of your UFT font files and put them in common/data/fonts.
Edit the level so that you add the level specific datablocks to load images.
Save your level.
Manually edit the .t2d file replacing every particle effect's load path, since saving a level wipes these.
Run your game to create .dso files.
Open the project in Xcode.
Set the correct project settings for code signing your application.
Make sure you're building for firmware 3.2 (for iPad in this case. It's set to 2.0 by default).
Make sure you're compiling with GCC 4.2 (it's set to 4.0 by default).
Click Build and Run on Xcode.
Discover that many of your objects aren't showing up or moving properly.
Open the console and start the real work of debugging your game on the hardware.
After about an hour we had their game visually loading on the iPad, and responding to touches, but there was still a lot of work to do before it will actually play like it did on the desktop.
I should also mention that I'm supervising a 3rd team who are making a Unity iPhone game. They didn't need my help to get their game working on the iPhone, they had it working on the hardware from week 1. They had never used Unity before, although 2 of them did attend my "Developing iPhone games with Torque" course last year, and have since decided to use Unity.
The performance of the Flash game was terrible when the screen was scrolling - around 10 frames a second, as it's rendering entirely on the CPU. However for situations where the camera was still the framerate was excellent and their game was completely playable.
I'd love to hear what whoever's in charge of iT2D has to say about this state of affairs.
P.S. If anyone considers this a rant, this is about the kindest rant you'll ever read about iT2D. I think Torque 2D's a great engine and I've made lots of games with it, I've even released two iPhone games and I'm working on a major iPad title now with it. I'm the closest thing you'll find to a supporter of iT2D but this is really bad. I never thought I'd see the day where I'd actually have to tell my students that if they want to make an iPhone game, they should use Flash instead of Torque.
If InstantAction/TorquePowered/GarageGames/Whoever you are now want to avoid losing their market share entirely they need to do the following:
1. Make the indie versions of Torque 2D and 3D completely free. No university or indie dev will even download Torque any more because Unity and UDK are free and they are better.
2. Put some fulltime staff on iT2D instead of contracting the whole thing out. Or if you must contract it out (and Luma seem to be doing a good job of it so far) - pay them enough so that they can have more than 1 person working on it part-time.
3. Hire someone to answer forum posts quickly.
4. Test your releases properly with external testers who are unfamiliar with Torque.
Team 1 has made a flash game. I'd never even used flash before today, but I googled it and found a PDF on Adobe's site on how to export flash games for iOS.
Here's the process:
Open your flash project in Adobe Flash CS5.
In the iPhone export settings, attach your certificate and provisioning profiles.
Add an icon file.
Click Publish - this creates an iPhone app, signed and ready to run.
Drag this app onto iTunes and sync your device.
Your game is now ready to play.
Note there's no need to use Xcode at all or download the iPhone SDK or change any of your scripts. It just works.
Team 2 has made a TGB game.
Here's the process to get their game working on iPad.
Download Xcode and the iPhone SDK.
Create a new iT2D project.
Copy the /game folder from the TGB game into the new project's /projectFiles folder.
Delete the /scripts folder from the new project as old torque projects use /gamescripts instead.
Set the correct level file to load in game.cs as loading "%level" doesn't work.
Replace all the instances of clone() in your game with cloneWithBehaviors() since clone() is bugged.
Add a %this.setUsesPhysics(true) for every moving object in the scene in its onLevelLoaded callback (do not use the editor checkbox - this doesn't work).
Edit the engine source so that particle effects continue to play after leaving the camera.
Edit the engine source so that particle systems load correctly.
Ignore the fact that the audio doesn't work on the Mac.
Change all of your onMouseDown scripts to oniPhoneTouchDown.
Do the same for mouseDragged and mouseUp.
Re-Write your entire touch handling scripts to use pickLists based on screen co-ordinates instead of object callbacks.
Export all of your UFT font files and put them in common/data/fonts.
Edit the level so that you add the level specific datablocks to load images.
Save your level.
Manually edit the .t2d file replacing every particle effect's load path, since saving a level wipes these.
Run your game to create .dso files.
Open the project in Xcode.
Set the correct project settings for code signing your application.
Make sure you're building for firmware 3.2 (for iPad in this case. It's set to 2.0 by default).
Make sure you're compiling with GCC 4.2 (it's set to 4.0 by default).
Click Build and Run on Xcode.
Discover that many of your objects aren't showing up or moving properly.
Open the console and start the real work of debugging your game on the hardware.
After about an hour we had their game visually loading on the iPad, and responding to touches, but there was still a lot of work to do before it will actually play like it did on the desktop.
I should also mention that I'm supervising a 3rd team who are making a Unity iPhone game. They didn't need my help to get their game working on the iPhone, they had it working on the hardware from week 1. They had never used Unity before, although 2 of them did attend my "Developing iPhone games with Torque" course last year, and have since decided to use Unity.
The performance of the Flash game was terrible when the screen was scrolling - around 10 frames a second, as it's rendering entirely on the CPU. However for situations where the camera was still the framerate was excellent and their game was completely playable.
I'd love to hear what whoever's in charge of iT2D has to say about this state of affairs.
P.S. If anyone considers this a rant, this is about the kindest rant you'll ever read about iT2D. I think Torque 2D's a great engine and I've made lots of games with it, I've even released two iPhone games and I'm working on a major iPad title now with it. I'm the closest thing you'll find to a supporter of iT2D but this is really bad. I never thought I'd see the day where I'd actually have to tell my students that if they want to make an iPhone game, they should use Flash instead of Torque.
If InstantAction/TorquePowered/GarageGames/Whoever you are now want to avoid losing their market share entirely they need to do the following:
1. Make the indie versions of Torque 2D and 3D completely free. No university or indie dev will even download Torque any more because Unity and UDK are free and they are better.
2. Put some fulltime staff on iT2D instead of contracting the whole thing out. Or if you must contract it out (and Luma seem to be doing a good job of it so far) - pay them enough so that they can have more than 1 person working on it part-time.
3. Hire someone to answer forum posts quickly.
4. Test your releases properly with external testers who are unfamiliar with Torque.
About the author
www.cokane.com
Recent Threads
#2
10/04/2010 (11:42 am)
I also agree, I think they should abandon iTGB in it's current form, making it based off of TGB was probably a mistake. Too much baggage, too much trying to make things fit. It would be way better if they came up with a new approach maybe like TX, or something else, but a new approach, kill torquescript. Having the source has been a crutch for IA more than a boon to us as devs. If I wanted to use C++ to make anything I really wouldn't need iTGB.
#3
I really think that iT2D is starved of resources. Apple are releasing firmware updates and new features every few weeks. There aren't even enough staff working on iT2D to keep it functioning, never mind supporting all of the latest iOS features. If IA don't so something to rescue it soon, nobody will be using it next year.
10/04/2010 (11:52 am)
Henry - I think abandoning it is a little extreme. iT2D 1.2 was very stable, I still use it for teaching purposes and I was able to release two iPhone games using it without the need to do any C++ coding. With iT2D 1.4 source changes are only really needed to apply fixes before IA fully supports them with the next release.I really think that iT2D is starved of resources. Apple are releasing firmware updates and new features every few weeks. There aren't even enough staff working on iT2D to keep it functioning, never mind supporting all of the latest iOS features. If IA don't so something to rescue it soon, nobody will be using it next year.
#4
Regarding some points of your list:
Fixed or not an issue in 1.4.1:
- Delete the /scripts folder from the new project as old torque projects use /gamescripts instead
- Set the correct level file to load in game.cs as loading "%level" doesn't work
- Replace all the instances of clone() in your game with cloneWithBehaviors() since clone() is bugged
- Add a %this.setUsesPhysics(true) for every moving object in the scene in its onLevelLoaded callback (do not use the editor checkbox - this doesn't work)
- Edit the engine source so that particle effects continue to play after leaving the camera
- Edit the engine source so that particle systems load correctly.
- Ignore the fact that the audio doesn't work on the Mac.
- Change all of your onMouseDown scripts to oniPhoneTouchDown
- Do the same for mouseDragged and mouseUp
- Manually edit the .t2d file replacing every particle effect's load path, since saving a level wipes these
- Make sure you're building for firmware 3.2 (for iPad in this case. It's set to 2.0 by default)
- Make sure you're compiling with GCC 4.2 (it's set to 4.0 by default)
Most likely fixed by the above:
- Discover that many of your objects aren't showing up or moving properly
- Updated documentation and the need for a clean demo
On the Flash side, you did not list downloading the iPhone SDK/Xcode as a step as you have to do with our tech. Am I to understand that is not a requirement for Flash, or was that an error on your port? Also, you left off the saving step for Flash and included it for iT2D.
Also, how have they exposed Flash to handle the changes necessary to keep up with the iPhone releases. For instance, if you wanted Game Center and the Flash version did not have it available, how does one implement it?
10/04/2010 (2:40 pm)
This is actually an extremely useful review. Thank you Conor. I'm going to print this out and bring it to a meeting, and send it out in an e-mail to the team.Regarding some points of your list:
Quote:Copy the /game folder from the TGB game into the new project's /projectFiles folder.Why do you have to do this? I have not had to do this for a single project.
Fixed or not an issue in 1.4.1:
- Delete the /scripts folder from the new project as old torque projects use /gamescripts instead
- Set the correct level file to load in game.cs as loading "%level" doesn't work
- Replace all the instances of clone() in your game with cloneWithBehaviors() since clone() is bugged
- Add a %this.setUsesPhysics(true) for every moving object in the scene in its onLevelLoaded callback (do not use the editor checkbox - this doesn't work)
- Edit the engine source so that particle effects continue to play after leaving the camera
- Edit the engine source so that particle systems load correctly.
- Ignore the fact that the audio doesn't work on the Mac.
- Change all of your onMouseDown scripts to oniPhoneTouchDown
- Do the same for mouseDragged and mouseUp
- Manually edit the .t2d file replacing every particle effect's load path, since saving a level wipes these
- Make sure you're building for firmware 3.2 (for iPad in this case. It's set to 2.0 by default)
- Make sure you're compiling with GCC 4.2 (it's set to 4.0 by default)
Most likely fixed by the above:
- Discover that many of your objects aren't showing up or moving properly
- Updated documentation and the need for a clean demo
On the Flash side, you did not list downloading the iPhone SDK/Xcode as a step as you have to do with our tech. Am I to understand that is not a requirement for Flash, or was that an error on your port? Also, you left off the saving step for Flash and included it for iT2D.
Also, how have they exposed Flash to handle the changes necessary to keep up with the iPhone releases. For instance, if you wanted Game Center and the Flash version did not have it available, how does one implement it?
#5
Use pickLists based on screen co-ordinates instead of object callbacks
Do they have an onMouseDown callback like iT2D has?
10/04/2010 (2:50 pm)
How does Flash handle what you listed:Use pickLists based on screen co-ordinates instead of object callbacks
Do they have an onMouseDown callback like iT2D has?
#6
How does one debug on the device using Flash's iPhone solution?
10/04/2010 (2:52 pm)
Open the console and start the real work of debugging your game on the hardwareHow does one debug on the device using Flash's iPhone solution?
#7
Download Xcode and the iPhone SDK (Apple requirement)
Create a new iT2D project
Add a %this.setUsesPhysics(true) for every moving object from the editor (optimization control)
Use oniPhoneTouchDown for direct iPhone touch input, onMouseDown callback still available but not required
Same for mouseDragged and mouseUp
**Export all of your UFT font files and put them in common/data/fonts
Edit the level so that you add the level specific datablocks to load images (visual editor for this)
Save your level
Run your game to create .dso files (Apple requirement for scripts)
Open the project in Xcode (Apple standard)
Set the correct project settings for code signing your application (Apple standard)
Click Build and Run on Xcode (Apple standard)
**I really dislike how we handle fonts and will be looking into a more automated process.
10/04/2010 (2:55 pm)
As for the 1.4.1 list, based on what you wrote and my responses I see the following steps:Download Xcode and the iPhone SDK (Apple requirement)
Create a new iT2D project
Add a %this.setUsesPhysics(true) for every moving object from the editor (optimization control)
Use oniPhoneTouchDown for direct iPhone touch input, onMouseDown callback still available but not required
Same for mouseDragged and mouseUp
**Export all of your UFT font files and put them in common/data/fonts
Edit the level so that you add the level specific datablocks to load images (visual editor for this)
Save your level
Run your game to create .dso files (Apple requirement for scripts)
Open the project in Xcode (Apple standard)
Set the correct project settings for code signing your application (Apple standard)
Click Build and Run on Xcode (Apple standard)
**I really dislike how we handle fonts and will be looking into a more automated process.
#8
does so on windows and osx which is why they got fired back that badly by apple and why and flash users are still violating their dev contract if they ever would have invested 30s reading it ;) (as it makes it pretty clear that xcode and osx is a must, not an option)
@conor: did they use optimized art? I ask cause many flashies tend to use vector art and vector art + game especially on idevice is a nonononono go. with bitmap art it will commonly work quite a bit faster (can be gotten by just baking out the vector art at load time of a level for example)
10/04/2010 (3:21 pm)
Correct, flash implements an own LLVM compiler and generates the final IPA for you, no xcode project.does so on windows and osx which is why they got fired back that badly by apple and why and flash users are still violating their dev contract if they ever would have invested 30s reading it ;) (as it makes it pretty clear that xcode and osx is a must, not an option)
@conor: did they use optimized art? I ask cause many flashies tend to use vector art and vector art + game especially on idevice is a nonononono go. with bitmap art it will commonly work quite a bit faster (can be gotten by just baking out the vector art at load time of a level for example)
#9
http://www.allnewsmac.com/2010/09/09/apple-removes-restrictions-from-ios-developer-program-adobe-flash-tool-is-allowed-again/
10/04/2010 (8:44 pm)
@Marc - Didn't Apple just repeal those restrictions?http://www.allnewsmac.com/2010/09/09/apple-removes-restrictions-from-ios-developer-program-adobe-flash-tool-is-allowed-again/
Quote:
In particular, we are relaxing all restrictions on the development tools used to create iOS apps, as long as the resulting apps do not download any code. This should give developers the flexibility they want, while preserving the security we need.
#10
But the developer contract as far as I'm aware has never changed and still explicitely forbids Flash in its current technical form that totally bypasses apples whole toolchain and OS.
The dev contract does impact rejection of your application and alike, if apple would go by it it would be even worse: They could terminate your developer contract at any time for using flash, meaning that all pending approvals are closed, all existing applications taken from the store, potentially without the option to get them on there ever again ...
Fact is just that apple didn't use this weapon yet nor talk about it and its not expected that they really use it after giving Adobe the ok basically
I would guess the reason that it changed back is actually Adobe (Flash) with the potential of top games from portals like shockwave, as well as Unity which was by the strictest possible interpretation forbidden too yet got even games featured during the ToS ban. It became apparent that it was primarily a step to threaten Adobe and make clear that no matter what: adobe will never be in the position to force apple to do anything to their liking. So little baby fight behavior with 250B babies
10/04/2010 (9:42 pm)
They altered the ToS which forbid it from the technical point of view and enforced C++ and ObjC basically, yes. (thats what you quote there)But the developer contract as far as I'm aware has never changed and still explicitely forbids Flash in its current technical form that totally bypasses apples whole toolchain and OS.
The dev contract does impact rejection of your application and alike, if apple would go by it it would be even worse: They could terminate your developer contract at any time for using flash, meaning that all pending approvals are closed, all existing applications taken from the store, potentially without the option to get them on there ever again ...
Fact is just that apple didn't use this weapon yet nor talk about it and its not expected that they really use it after giving Adobe the ok basically
I would guess the reason that it changed back is actually Adobe (Flash) with the potential of top games from portals like shockwave, as well as Unity which was by the strictest possible interpretation forbidden too yet got even games featured during the ToS ban. It became apparent that it was primarily a step to threaten Adobe and make clear that no matter what: adobe will never be in the position to force apple to do anything to their liking. So little baby fight behavior with 250B babies
#11
With regard to copying the TGB game into iT2D, I was following the process in this thread: www.torquepowered.com/community/forums/viewthread/117755
If any of you want to read more about Adobe's export and debugging process I found it all here: labs.adobe.com/technologies/packagerforiphone/ - in particular the PDF in link 3 explains the whole process step-by-step.
As for the student's Flash game - it was using bitmap art and yet it was still very laggy during camera moves. I wouldn't actually consider using Flash for serious game development - it's really only good for beginners or where the frame-rate isn't an issue. However the big plus for Flash was the wow-factor of being able to play your game on an iPad really simply.
The students who made this Flash game had assumed it would be pretty tricky to get it working on an iPad, and yet it was quick and easy. They were able to do it all on their Windows computers (I provided them with copies of my provisioning profile from my Mac to sign their app).
This ease of use counts for a lot when it comes to impressing students, or potential clients.
10/04/2010 (11:38 pm)
Mich - thanks for the detailed response! The fixes list for 1.4.1 sounds like it addresses all the major issues with 1.4With regard to copying the TGB game into iT2D, I was following the process in this thread: www.torquepowered.com/community/forums/viewthread/117755
If any of you want to read more about Adobe's export and debugging process I found it all here: labs.adobe.com/technologies/packagerforiphone/ - in particular the PDF in link 3 explains the whole process step-by-step.
As for the student's Flash game - it was using bitmap art and yet it was still very laggy during camera moves. I wouldn't actually consider using Flash for serious game development - it's really only good for beginners or where the frame-rate isn't an issue. However the big plus for Flash was the wow-factor of being able to play your game on an iPad really simply.
The students who made this Flash game had assumed it would be pretty tricky to get it working on an iPad, and yet it was quick and easy. They were able to do it all on their Windows computers (I provided them with copies of my provisioning profile from my Mac to sign their app).
This ease of use counts for a lot when it comes to impressing students, or potential clients.
#12
For games though I think gamesalad is the only thing thats even worse as it is closed, slow and lacks most features on top of that.
10/04/2010 (11:54 pm)
Yupp for prototyping is likely hard to beat, same goes for crossplatform RIAFor games though I think gamesalad is the only thing thats even worse as it is closed, slow and lacks most features on top of that.
#13
10/05/2010 (4:11 pm)
Conor: Did you actually get it running natively at 1024x768 on the iPad? We are looking at exporting a flash app we have to the ipad and everything we have seen suggests that the CS5 export option only supports iphone. While I know it'll still run on ipad, we would rather run it at full resolution of the device.
#14
10/05/2010 (9:35 pm)
Tim - no, so far we've only got the game to run at iPhone resolution, doubled on the iPad.
#15
If you are using Flash Pro CS5 go under "File->iPhone OS settings". On the General Tab of the iPhone OS settings there is an option named "Device" here you can set your app to support iPhone, iPad or both. Depending on which OS's you choose you will need to also added the appropriate app icon sizes under the Icons tab as well.
The iPhone OS settings screens are just a an interface to an XML file that iPhone Packager for flash uses to build the iPhone app via Adobe Air for iPhone.
If you are doing it the manual way in the you can open your application descriptor file and add the required settings. This example would be for an app for both iPhone and iPad. (1=iPhone 2=iPad).
This is described in the PDF docs that Adobe provides for the Packager for iPhone located here.
The performance of Flash Apps on the iPad is better than on the older iPhones, I don't know how it runs on the iPhone 4 since I don't have one to test on. It does support GPU acceleration but several display object types can not be GPU accelerated. It actually requires a lot of optimization knowledge to pull it off well and even then there are many limitations.
I agree it is pretty cool to get something working on an iOS device quickly and Flash Packager acomplishes that, but I think that in its current state it is just an excellent prototyping tool. I don't think its quite ready for prime time just yet.
10/06/2010 (4:47 pm)
Packager for iPhone does support the iPad as well. Its just a little confusing to find because they are still using the term "iPhone OS" every where instead of the newer "iOS".If you are using Flash Pro CS5 go under "File->iPhone OS settings". On the General Tab of the iPhone OS settings there is an option named "Device" here you can set your app to support iPhone, iPad or both. Depending on which OS's you choose you will need to also added the appropriate app icon sizes under the Icons tab as well.
The iPhone OS settings screens are just a an interface to an XML file that iPhone Packager for flash uses to build the iPhone app via Adobe Air for iPhone.
If you are doing it the manual way in the you can open your application descriptor file and add the required settings. This example would be for an app for both iPhone and iPad. (1=iPhone 2=iPad).
<key>UIDeviceFamily</key> <array> <string>1</string> <string>2</string> </array>
This is described in the PDF docs that Adobe provides for the Packager for iPhone located here.
The performance of Flash Apps on the iPad is better than on the older iPhones, I don't know how it runs on the iPhone 4 since I don't have one to test on. It does support GPU acceleration but several display object types can not be GPU accelerated. It actually requires a lot of optimization knowledge to pull it off well and even then there are many limitations.
I agree it is pretty cool to get something working on an iOS device quickly and Flash Packager acomplishes that, but I think that in its current state it is just an excellent prototyping tool. I don't think its quite ready for prime time just yet.
#16
10/06/2010 (4:48 pm)
I dug into that link you gave out about the iPhone packager for Air apps, and it looks like it has more options for setting up an iPad version. So it looks like it might be possible to convert an Air App to a native iPad app. I have not tried it yet though.
Torque Owner Scott Wilson-Billing
MeYuMe