Tutorial :XNA on iPhone



Question:

I don't know if it's a strange question but how could I run a game made with XNA on the iPhone/iTouch ? Which steps/tools (existing ones or imaginary...) should be used ?

note: The goal is to avoid modifying existing C# code

UPDATE :
If I understand correctly, I must be able to:
1) Run my XNA code on Mono (monoxna or SilverSprite, promising?)
2) Run Mono on iPhone (MonoTouch)


Solution:1

I don't believe there is a good answer to your question. XNA doesn't target the iPhone, so the chances of being able to effectively port an XNA game without modifying the C# source code isn't likely to happen.

Instead, I'd recommend that you take a look at the various frameworks that exist to help you craft cross-platform games. Unity often comes up in these discussions, but it isn't free.

If cross-platform isn't your goal, but free iPhone development is, then I'd recommend looking at Cocos.

Edit: The MonoTouch project may be able to assist you in the future, but doesn't help you out right now. Still, it's something to keep an eye on.

Edit: The landscape has changed a lot in the ~5 years since this question was posted. If you have an XNA project that you want to get running on iOS, then Xamarin.iOS (formerly MonoTouch) plus MonoGame is a near-perfect fit. MonoGame is missing a huge chunk of the XNA content pipeline, which means you'll either have to abandon it or have a VS2010 instance somewhere compiling your assets.


Solution:2

Not only is it possible but here is a video of someone doing XnaTouch on MonoTouch: First game to IPhone build with XnaTouch (XNA for IPhone)

Here is the mono article about doing it http://www.mono-project.com/MonoTouch


Solution:3

The MonoTouch project may eventually help here, since it allows you to write C# targeting the iPhone (it is statically compiled to native code).


Solution:4

MonoGame is a free OpenGL implementation of the XNA 4.0 Framework. It is built upon the excellent range of Mono compilers and is compatible with MonoTouch (iOS), Mono for Android (Android), MonoMac (Mac OS X), Mono for Windows and now Linux!

A list of 12 games currently using MonoGame that are on the Apple iOS App Store can be found @

http://monogame.codeplex.com/

https://github.com/mono/MonoGame/wiki/Released-Games


Solution:5

I believe XNA depends on Direct3D 9 (see http://msdn.microsoft.com/en-us/xna/aa937793.aspx), which may hint at the hurdles one might encounter in both porting to mono as well as having sufficient graphics horsepower on iPhone.


Solution:6

Everyone saying this is possible because there are CLR libraries for Mono, does not even think about the fact that XNA is a WHOLE DIFFERENT set of frameworks:

"The XNA Framework class library is a library of classes, interfaces, and value types that are included in XNA Game Studio."

As another responder noted, this is so far from happening it's not even funny. If you really want to write a game I'd check out Unity. It's commercial, but it looks utterly impressive and you can script your game logic in Javascript or (here's the funny part) C#!

Yes, instead of going through a ton of work to port a whole framework because you want to write a game in C#, why not just use a framework that lets you do that today?


Solution:7

From the horse's mouth:

MonoTouch + SilverSprite = XNA 2D games on iPhone? :)

What Bill means is that it will eventually be feasible to write a 2D XNA game, then use SilverSprite to run it on Silverlight, then use MonoTouch to run it on the iPhone


Solution:8

This space is definitely heating up. There is now an XNA Touch project on codeplex that aims to bring the XNA API onto the iPhone/iPad platform:
http://xnatouch.codeplex.com/


Solution:9

'Maybe' you could just change XnaTouch's namespace to match those of existing Xna code (i.e. Microsoft.Xna.Framework.*), when developing a MonoTouch project? This could be done on a vendor fork (copy) of the XnaTouch code, easy to manage using Git, Mercurial or Piston etc.

I'm unsure as to whether the XnaTouch team would undertake such a change on its own codebase, so this is probably best done on your own, personal, code branches (interestingly, the Mono.xna project uses the original Microsoft.Xna.Framework.* namespaces, I'm unsure why XnaTouch chose not do so).

JFYI, the current XnaTouch (v1.0) follows Xna 4.0 quite faithfully. I've found a [small] few missing method calls, which I've 'implemented' to throw not implemented exceptions (?). The original-xna4-and-modified-xna-touch code does compile, now I need to implement iphone-specific gui and handling etc.

Hope this helps someone.

Cheers

Rich


Solution:10

For starters you would need a CLR implementation on the iPhone, which doesn't exist at the moment, but it seems someone is trying: MonoTouch.


Solution:11

A friend of mine is developing an architecture port of XNA 4.0 for the iOS platform. It's of course written in Objective-C, but it has the feel of XNA. He has published the source under LGPL at http://code.google.com/p/xni/.


Solution:12

Xna is not officially supported on iPhone; however, you could use ExEn (http://exen.codeplex.com/) or MonoGame (http://monogame.codeplex.com/) to port your Xna games. A bonus for using either of these is that they support Mono for Android.


Solution:13

If you're looking for a free cross-platform sort of thing, you could check out phonegap. I don't have any experience with it but it looks cool. http://phonegap.com/


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »