XNA touch and Mono

Nibbie
Posts: 2
Joined: 2009.09
Post: #1
I found this link today http://xnatouch.codeplex.com/ basically is about developing in xna for the iphone, my question is, does it work?? how does it manage all the cocoa touch framework?.

And finally, does apple support developing on xna touch??
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #2
I suppose it's theoretically possible that it could work on iPhone through Mono, but I would conjecture that it wouldn't be approved for the App Store based upon a rather nebulous rule in the iPhone SDK agreement. The rule is sort of that you can't run "interpreted" code on iPhone. They don't actually specify what "interpreted" means exactly, that I've seen. That could easily cover anything which runs through a virtual machine of any sort, which would cover anything related to C# (obviously including Mono). OTOH, I've heard rumors of folks getting past approval for games using Lua, which, since it is a scripting language, must run through a virtual machine. I haven't stumbled across a straight answer either way on this yet.

Since neither Flash (using the VM) nor Java is allowed, I'm totally guessing XNA ain't gonna fly either.

As far as "managing the Cocoa Touch framework", there isn't much to it for games really. Once you're up and running and supporting some basic input and windowing stuff, other things aren't really necessary to deal with, as opposed to normal "apps" which typically make use of lots of system GUI features.

Quote:And finally, does apple support developing on xna touch??
At least to that I can say: Absolutely no way.
Quote this message in a reply
Nibbie
Posts: 2
Joined: 2009.09
Post: #3
I thought so, i guess apple is very jealous about everything!!.

Thank you for the quick answer.
Quote this message in a reply
Moderator
Posts: 335
Joined: 2002.04
Post: #4
It's more about protecting phone users than jealousy. If apps were allowed to run scripts or otherwise modifiable code it would be another possible way to change code after it's gone through Apple's approval process where it's checked to make sure it doesn't cause any security issues for the phone. This means there's more potential for someone to change the script after the user has downloaded the app and either breach the phone's security or crash the phone.

On the flip side, I'm sure Microsoft aren't exactly happy about the idea of XNA being used outside of the Zune, Xbox or PC either.
Quote this message in a reply
Apprentice
Posts: 6
Joined: 2009.05
Post: #5
Game development in C# via Mono on the iPhone DEFINITELY works. Hundreds of apps have been approved and sold. Basically any app using the Unity engine.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #6
GhostDog Wrote:Game development in C# via Mono on the iPhone DEFINITELY works. Hundreds of apps have been approved and sold. Basically any app using the Unity engine.
So I wonder how the Unity guys managed to do it in a way that Apple was okay with? I've heard of apps being rejected while using Lua, even though there was no way a user could download any external script to the device. Total inconsistency here, and Apple seems to be mum about it.
Quote this message in a reply
Member
Posts: 166
Joined: 2009.04
Post: #7
AnotherJake Wrote:So I wonder how the Unity guys managed to do it in a way that Apple was okay with? I've heard of apps being rejected while using Lua, even though there was no way a user could download any external script to the device. Total inconsistency here, and Apple seems to be mum about it.

They compile everything to arm asm .
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #8
warmi Wrote:They compile everything to arm asm .

Well then, see, there you go! So I guess XNA Touch can indeed run just fine on iPhone and there isn't anything Apple can do to stop it -- as long as they compile everything to ARM. Personally, I like XNA, so more power to 'em! Smile

Like Zwilnik said though, I'm sure MS wouldn't be very happy about it either. I wonder if they'd go so far as to change their terms to prevent it? Doubt it, but when speculating about either Apple or MS, anything is possible.
Quote this message in a reply
Member
Posts: 166
Joined: 2009.04
Post: #9
I don't think there is much sense using XNA and C# on iPhone ...
The device is already quite underpowered (at least compared to what C# generally runs on) so why make it even worse for no benefit whatsoever ?

I think one of the smartest things Apple did with iPhone was to rely on natively compiled code for their SDK ... this alone gives them significant advantage over competitors like Android or the latest Palm.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #10
I agree that on a platform-wide basis, avoiding the idea of VM induced performance suckage was a smart move. But... Money is money, and on an individual app basis, Unity is working fine compiling down to ARM and selling boatloads (1 app in the top ten grossing apps, I believe), so... I say if they can get XNA or even Flash working on iPhone and making $$$, then all other arguments are pretty much crap unless Apple (or MS, in the case of XNA) changes the rules. [shrugs] thems is dollars for ya'
Quote this message in a reply
Member
Posts: 21
Joined: 2006.11
Post: #11
Here is picture of the XNA platformer Starter Kit game running on the iPhone simulator - http://twitpic.com/oanbx/full .

It turned out that someone had already made a ZuneHD Touch/Accelerometer version here - http://www.allaboutcoding.com/tutorials/cs/zunehd.asp

So I ported that code to XNATouch as well.

So what works...

1. Touch for jump
2. Accelerometer to move left and right
3. Music plays

The XNATouch framework still needs some work, but I have to say, it is a bloody good start and it can only get better. Best of all I don't need to learn Objective C if I want to write something for it and with some careful IF Defs the same code should compile and run on PC, Xbox, Zune and iPhone.

I plan on helping port the XNA Marblets and RPG Starter Kits over to XnaTouch when I have more time around Christmas.

Btw, it is NOT C# running on the iPhone but native ARM code.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #12
Wow, trip out! Looks pretty neat man, keep us updated if you make anymore progress. Smile

savage Wrote:Btw, it is NOT C# running on the iPhone but native ARM code.

Not sure I understand what you mean by this -- C# can't run on anything by itself anyway. Rasp As I understand it, C# would first be compiled down to Common Intermediate Language (CIL), then assembled down to bytecode for the Common Language Runtime (CLR). If it's still running through a virtual machine replacement for the CLR then of course the VM is executing in ARM, but I assume you mean that it's assembled from CIL straight down to ARM. That would be pretty neat, although I have zero knowledge of how that's possible. Do you have more info or a link on that?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #13
It's possible in the same way that the JIT compiler compiles code to native code, it just does it at compile time instead of runtime. LLVM and GCC do pretty much the same thing, they generate an intermediate representation of code that is common to the different languages that they compile, then compile that to native code. The difference is that GCC's intermediate representation cannot be run in a VM.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #14
Does anyone have a link handy with instructions on how to actually compile C# to ARM? Googling throws me a mish-mash up front. I could dig harder, but it isn't on my priority list ATM.
Quote this message in a reply
Member
Posts: 21
Joined: 2006.11
Post: #15
The only way I'm aware to compile C# to ARM is using MonoTouch ( trial version here - http://monotouch.net/DownloadTrial ). This will allow you to test things on the iPhone simulator.

The only other tool that uses this MonoTouch functionality is the Unity3D ( now FREE for development and deployment on PC, Mac OS X and Web - http://unity3d.com/ ) engine, which uses MonoTouch to compile the game engine's C# scripts into native iPhone speak.
Quote this message in a reply
Post Reply