Sharing Code between Flash Apps and iPhone Apps - iphone

I am interested in writing games for the iPhone and the Web. Ideally, there would be one language that I could write my games in and it would work on both platforms. I know this is not the case, so what is the best way to leverage code between iPhone apps (Objective-C/C++) and Flash SWFs (ActionScript)?

This maybe of some help
It uses the NME library which will allows code to mostly be written to the Flash 9 API and create the C++ for XCode to compile and run on the iPhone and Touch. This creates a path to port Flash games to iPhone/Touch.

Unfortunately, Flash and Objective-C are very, very different - and it's unlikely that a Flash player will be available for the iPhone in the near future. The native input methods used in Flash games - the keyboard and mouse - don't lend themselves well to the iPhone. While Apple could make Flash run on the iPhone, most Flash games would be totally unplayable (or feel very unnatural. They'd have to overlay a keyboard probably?). With the success of the App Store and native iPhone games, I think it's very unlikely you'll see Flash support anytime soon.
You might want to consider using a game development tool like Unity instead of Flash in the future. Unity allows you to create both 2D and 3D games, and you can program them in various .NET scripting languages. Once you've created the game, you can cross-compile it for web (their own plugin, not Flash), iPhone, or the desktop.
I know that doesn't help much since you have an existing codebase, but it might be something to consider for the future!

My company is developing a toolchain that allows compiling ActionScript3 to native code for mobile devices.
It now supports Windows Mobile and Symbian, and iPhone supported will be released in a couple of weeks.
Check it out at: http://developer.openplug.com/
BR
Guilhem

Adobe Alchemy looks promising. It is not released yet, but from their website:
Alchemy is a research project that allows users to compile C and C++ code that is targeted to run on the open source ActionScript Virtual Machine (AVM2).
This would allow iPhone apps and Web apps to share non OS-dependent C/C++ code, which is a very exciting prospect.

One option would be building everything in unity. The engine facilitates building the same game project to any of the following platforms:
Webplayer
OS X
Windows
iPhone
Wii

Actually, the iPhone supports Flash technically (see Developer creates Flash for iPhone and Flash Installer Update #2). It is just Apple's crippleware restrictions that prevent installation.
Other than that, there's really not much you can do. Flash/ActionScript and Objective-C are radically different. You can have a central server store data, but that doesn't solve the duplicated logic.

If you're already willing to use ActionScript you could go all the way over to the dark side and switch to Javascript. That's the only common language supported by your clients (web and iPhone).

How comfortable you are with either development environment certainly plays a role here. If you are a die-hard Objective C and a super star Actionscript programmer then doing both shouldn't be much of a problem. It will be lots of work of course, but not a problem.
However, if you are neither or only skilled at Actionscript then I suggest you focus on Flash/Actionscript for the time being. Eventually Flash will be available on the iPhone anyway. When that happens you can already have a number of apps ready to be quickly ported to iPhone. Also keep in mind. There are more portable devices out there than just iPhone. Getting your apps running on other devices might be worth it in the mean time.
Just keep in mind when you're developing your apps now that at one point you also want to run these apps on the iPhone. So make 'm in such a way that they can be controlled with an iPhone as well.

Updating this old QA with new information. The recently released monkey development framework deploys to both iOS and Flash: http://www.monkeycoder.co.nz/
It's so new that I wouldn't necessarily recommend it, but it has a great pedigree: the creator made Blitz3D and BlitzMax before, and those were great game development tools.
That said, I would strongly recommend a combo like Corona for iOS and Flash for web, so that you're using optimal tools for each platform.

Related

Anything similar to XNA for Android or IOS?

I want to start creating games for Android/IOS. I have already created 2D games using XNA and I want to publish them on other platforms even PCs but my highest priority is Mobile platforms. As I said I am familiar with XNA so I need a similar Engine for 2D. It would be great if I could write once and publish on many platforms. Please dont suggest Unity or Unreal. They are not that easy when it comes to 2D.
By similar I mean, for example, how easy to draw a sprite on the screen.
Note: I am working on Windows so no Mac suggestions please.
Regards,
You may also want to consider MonoGame ( https://github.com/mono/MonoGame/ ) as that is also an Open Source, OpenGL implementation of XNA that currently has support for iOS, Android, MacOS X, Windows and recently Linux. It is now all ES 2.0 on the mobile platforms. Our biggest change is that we now support Windows 8, and have a DirectX 11 backend thanks to SharpDX. We now also have initial PlayStation mobile support.
Actually ExEn, is a fork of MonoGame( originally called XNATouch ).
For a list of games on the AppStore or Android Market place and even NaLC, currently using MonoGame look here -
http://monogame.codeplex.com/
I hope this helps.
D.
You might want to keep up on the project called ExEn, which has already successfully ported some XNA samples and smaller games to iPhone and Android. It requires relatively little work to port and refactor to these platforms.
I suggest you check out AndEngine, its an open-source 2d open-gl based game engine that has a strong community. If you want something that you can make cross platform games with check out LibGDX It too is free, open source and based on openGl but it also allows for 3d games. It is also cross platform so a game you write for android can be compiled for, Windows, MacOS (see below), Linux. It also has a really strong community.
Regarding iOS and OSX games you really can't make them unless you buy a Mac. Apple doesn't distribute their SDK for use on any other platform but their own. That said you could maybe get something working under VMWare
Check out MOAI SDK. It's completely free and open-source. It is in beta right now but it is still pretty good. Crimson Pirates for iOS was developed with it.
Right now it supports iOS, Android, Mac, Windows, and Linux. Really good. I thought I liked Cocos2D-x, which is a C++ variant of Cocos2d-iphone supporting windows, iOS (not Mac), and Android but not truely supporting desktop kinda made me like MOAI more.
You can use C++ with MOAI or you can use Lua (they highly encourage using Lua). Being built in C++ is really great because you get access to a vast amount of libraries and you can easily bind them to Lua.
You should try games development with cocos2d.
Cocos2d is one of the best 2d engines for ios/Android I have come across.
http://www.cocos2d-iphone.org/
It is openGL based free engine.
Regards,
Sam
These might be useful to you. However, the first two aren't free, but they have editions for both iOS and Android.
iOS:
http://ios.xamarin.com/
Android:
http://android.xamarin.com/
I've never used either of them, but it's something I've been looking into a bit.
Apparently it lets you run C# and .NET code on both iOS and Android which is pretty cool considering how much easier drawing and things like that are in XNA compared to Open GL ES 2.0. Not to mention the fact that you'd be using C# instead of objective C.
There's also a free open source version sponsored by the same people who make the two I listed above. This one lets you run C# and .NET code on Windows, Linux, and Mac OS X.
http://www.mono-project.com/Main_Page
I have been researching this topic intensively over the last few weeks.
I think the best solution for you is Marmalade, formerly known as Airplay SDK. It is actually more Windows-oriented than Mac (work in Visual Studio), although you still need a Mac for the final step of getting a signed app onto the store. It sounds like a very capable pure C++ product with iOS and Android as well as a bunch of other platforms, Personal license with splash screen $150 pa, single seat Professional $500 pa for all platforms. They have a 45 day trial license which I'm currently using.
I was tempted by MonoGame, could live with the $400 price tag for each platform (for the needed MonoTouch) but it is just way too buggy. The final straw was a combination of a bug causing it to crash all the samples on iOS5 and that keyboard input is broken on iOS.
Too be fair, I'm pretty sure that is all on the MonoGame side and was very impressed with how well MonoTouch worked and was looking forward to programming in c# with LINQ et al.
Since it is not obvious from the other answers, it should be noted to those who are unaware that the ExEn project and the MonoGame projects both build on the Monotouch platform from Xamarin (formerly from Novell) - which is a prerequisite for both for iOS games.
The Xamarin projects was mentioned in another answer as an alternative to Xna, but is really not. Monotouch and Mono for Android are a way to run C# and .NET on iPhone/iPad and Android.
Game development at least on the iPhone side, is typically done using OpenGL and OpenGL is also wrapped in Monotouch. The Xna implementations in Exen and MonoGame also uses OpenGL as the foundation as far as I know.
It should also be noted that Monotouch and Mono for Android are commercial products.
BTW: Exen also compiles to other platforms e.g. silverlight.

Developing apps for jailbroken iOS devices?

I know that you need a Mac and Xcode and the SDK. But is it possible to develop apps for jaibroken devices and/or regular devices using Windows/Linux platforms ?
Edit
Also, what's the lowdown on the Airplay SDK ? Heard that it's pretty good but doesnt offer the same performance as an app developed through Xcode.
Found this PDF Document, for what it's
Actually you can, and that's what programming is all about. If you're a tough programmer you can do lots of cross platform and cross hardware stuff. Don't forget that no matter how cool Steeve Jobs is (or pretends to be) for Apple and maybe even non-Apple consumers they care about their profit and would never declare officially that building apps for iPhone and other iOS devices is possible on PC too. This way they make you get a Mac. They've been very successful in making people believe that building apps for iPhone is not possible otherwise.
There's a toolchain for Linux platforms, but it doesn't have Interface Builder or other niceties. Here's an example application that uses it.
You may be looking for theos. Have a look at this thread.
Of course, you will have to have your toolchain installed, which shouldn't be that hard. There are a lot of projects which involve having a Linux iOS toolchain. Windows is another story, though :P (not saying it's impossible!).
Short answer is no - fundamentally iPhone OS uses Cocoa, which is a closed framework only distributed with XCode. Some people have thought about reverse engineering (like Wine) but I don't think anybody has really been successful thus far, let alone use Cocoa as a development environment.
You might be able to create some debian packages (dpkg) that can be run in the background or via the mobile terminal. This is kind of limiting though, because you don't have access to GUI and your app won't be very intuitive.
There seems to be a development platform for porting Blender game logic into a full-fledged iphone game. Maybe you could avoid Xcode this way, but I doubt it.
http://sio2interactive.com/
You could run OSX within Virtualbox/VMWare Player but that's not allowed by Apple.
Don't listen to other people who insist that you HAVE to get a Mac. You just need to download a copy of cracked VMWare with pre-installed Mac from http://thepiratebay.org/. You also need to download a copy of cracked VMWare player from the same site. Then download Xcode inside the Mac. No need to pay for anything. I've been using it and working great.
Short answer -- YES.
Although i'm not entirely sure what you mean by "ONLY" for jailbroken devices, but if you have any experience at all with flash scripts or action scripts then check out Adobe Flash Professional CS5.5. It's a program that lets you design and write your own apps for ipod/iphone/ipad.
http://www.adobe.com/products/flash.html
I've used it for years and find it perfect.

Flash Programming(Adobe Air) Vs Objective C?

This isnt a Programming quest but i couldn't think of a better place to ask this question..
I recently started Developing Apps for iPhone using Objective C and Apple xcode environment.now i am quite comfortable with Objective c and iPhone SDK. But now my Company has decided to stop using XCode Environment to build apps but use Adobe Air(Flash Programming) to build apps instead and i have been asked to start Studying Flash Programming and using Adobe Air.. since i couldn't find much information regarding developers or apps build with Adobe Air anywhere i had few questions in mind which i thought someone might be able to answer here
Yes Flash will have the best animations i guess but isnt iPhone's Core Animation Framework ,use of Open GL or use of Game Engine's like Cocos2d available for iPhone good enouf if compared with Adobe Flash??
The Utility Apps can be better build with Apple's own Development Environment even if entertainment apps that dont require much development task might be a bit easy with Flash
Apple Development Environment Xcode and iPhone Sdk must have tons of better api's and features then adobe air could offer??
I have no idea how actually Flash Programming is done.. so after getting comfortable with Objective C is it really worthwhile to just let it go and start studying Flash??
IT would be really great if someone can help me with which will be the right process to develop apps for iPhone Objective C or Adobe Flash ??
The advantage of flash, as sosborn said, is that you will be able to easily port the project to Android, iPhone, and other platforms. You guessed correctly when you said that apple's environment will be able to function with less issues. By going from flash to iphone, you may have some conversion issues to fix.
If the company wants to develop for multiple platforms, then that change is totally valid and smart. If the only reason is ease of development from a graphics standpoint, ask them to look into cocos2d. If they really must use flash graphics, they can be pretty easily set up for use with coco.

Multiplatform development options

I have an application (actually a game) that I'm close to starting work on for iOS and the web, however I'd like to DRY up my code bases as much as possible so that I don't have to maintain so many aspects for platform portability. So essentially my two requirements are to run on iOS and the web, but I wouldn't mind it if I could also deploy it for Android as well.
What options exist?
If possible, which I am doubting at the moment, I have considered using Cappuccino (http://cappuccino.org/) to build out the app and then utilize NimbleKit for iOS compilation. Any ideas if this is possible?
What would work better if anything? Are there any frameworks in particular that would scale across platforms and mobile devices well + allow it to easily run on the web?
Also, Flash comes to mind, would that perhaps be best if developed properly such that it will compile over and not utilize non-compatible iOS functions?
The recently released monkey development framework deploys to both iOS and Flash:
http://www.monkeycoder.co.nz/
It's so new that I wouldn't necessarily recommend it, but it has a great pedigree: the creator made Blitz3D and BlitzMax before, and those were great game development tools.
That said, I would strongly recommend a combo like Corona for iOS and Flash for web, so that you're using optimal tools for each platform.
Check out Unity 3D. Works for iOs, Android, Web, Mac, and Pc. Not free for the mobile platforms, but it's worth a try.
You should try Titanium (it's free). You can use javascript and HTML5 to build your game and it can be compiled for iOS and Android. Since you will be using web standards to code, your application can be deployed for the web with few (or no) modifications.
You can use this project as a start point.

Programming iOS apps with PhoneGap and/or QuickConnect

A friend of mine told me that some frameworks (PhoneGap and/or QuickConnect) can transform my HTML/JS/CSS code to an iOS App.
Personally, I hate this kind of frameworks because when you get a bug, it's very hard to debug. But, on the other hand, as i'm starting learning iOS programming, I find Objective-C hard to learn.
Did anyone tried these tools? What are their limits? What about performances?
Thank you,
Regards.
These frameworks are handy if you are coming from web development world. Since they allow you to develop using HTML/CSS/Js you'll be able to get going quite rapidly.
Even though they offer more interaction with the native capabilities of the device (contacts, camera, accelerometer, etc.) than pure web development (using Sencha Touch or jQuery Mobile for example) they are still more limited than a native application.
Webkit
Most of these solution are focused on devices using a WebKit based browser for the rendering. Which is used by many of the main mobile OS :
Symbian, iOS, Android, BlackBerry, Bada, etc.
Main exception being Windows Phone which uses Internet Explorer
Cross-platform
Their goal is to enable cross-platform development ever by wrapping your web development into a native app (PhoneGap, Titanium) or by "translating" to the appropriate language for the targeted device (RhoMobile Rhodes, MoSync).
iPhone specific
Aiming several platforms implies that some phone specific features might not be so easily supported. And the UI won't look as native since it's targeting different OS. So if you are only aiming iOS4 you could maybe try some of the more specific solutions such as:
iWebKit
Ansca Corona
Performances
For standard apps you should'nt notice much difference. But if you are planning to develop games some of these frameworks are probably not the best solution. Corona claims to be appropriate...
Caution
If you plan to develop a commercial application beware of Apple's policy.
Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine
Many applications using these tools/frameworks are still accepted but there is nothing official.
Edit: As stated by Rydell the policy has changed since September 9.