Mono Performance For Games - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Tools & Technology (/forum-10.html)
+--- Thread: Mono Performance For Games (/thread-3024.html)
Mono Performance For Games - Nick - Sep 19, 2007 11:41 PM
I've become a huge fan of C#. I truly love the language. I picked it up to use XNA and play with making Windows applications, but I want to bring that experience to OS X. I know about Mono and have been playing with it. I have yet to use Cocoa#, the C# bindings for Cocoa, but overall it's nice.
My question though is how capable it is as a runtime. I've heard some people say that Mono's .NET implementation is too slow to do any real game programming. I was just wondering if anyone here has any more experience with Mono and could comment on it. I plan to use SdlDotNet and Tao.OpenGL for my windowing and graphics, respectively.
Just looking for opinions or statistics or anything relevant. Thanks in advance.
Mono Performance For Games - skyhawk - Sep 19, 2007 11:49 PM
I use C# inside unity. As they've done most of the hardwork, only my game logic code is in C#, and it is more than fast enough.
Mono Performance For Games - Nick - Sep 20, 2007 12:19 AM
I did notice Unity uses it and I believe they even use Mono for the CLR and JIT (if I read correctly). But Unity probably also has a large C/C++/Objective-C (one of them) underlying engine to implement the intensive parts.
I'd like to try and create an entire OpenGL game in C# using Mono. Granted right now I just want 2D, but I'm trying to figure out if it's even going to be powerful enough to make a nice 2D game without showing lots of performance issues.
Mono Performance For Games - Fenris - Sep 20, 2007 08:12 AM
Only AAA games are CPU-bound nowadays anyway, so I say go for it. It can't reasoably be much slower than Rosetta emulation, and that works for a lot of games.
Mono Performance For Games - AnotherJake - Sep 20, 2007 09:20 AM
I picked up C# through XNA as well. I'd say it's definitely worth exploring!
Mono Performance For Games - aarku - Sep 20, 2007 11:28 AM
It's very fast. I'd wildly guess only 2-10 times slower than C.
So another point, is that it's actually really easy to have your C# call C/C++, and the reverse. This page is the bible for that:
So rarely, when something is too slow, you can just rewrite it in C/C++/Obj-C/Whatever.
Mono Performance For Games - aarku - Sep 20, 2007 11:34 AM
Nick Wrote:I did notice Unity uses it and I believe they even use Mono for the CLR and JIT (if I read correctly). But Unity probably also has a large C/C++/Objective-C (one of them) underlying engine to implement the intensive parts.That's correct with regards to Unity, and you should be able to. And if it is turning out slowly, see my last post about interoperating with native libraries.
Mono Performance For Games - Nick - Sep 20, 2007 12:53 PM
Do you know of resources showing how to interoperate with Objective-C? I can see how C# would work with C and C++, but how do I go about doing it with Objective-C? I'm thinking I could just use the GameBaseFramework for my windowing and leave C# to just the gameplay and graphics, but I have no idea where to start.
Mono Performance For Games - aarku - Sep 20, 2007 01:31 PM
Unfortunately you have to have C callable wrappers that call the Obj-C.
Mono Performance For Games - OneSadCookie - Sep 20, 2007 01:55 PM
Note that there is a distinct set of "fast" language implementations at the top of the list (up to about 3x slower than C) and then a distinct set of "slow" language implementations at the bottom (9-64x slower than C).
Mono is distinctly in the top section. That means it's good for like 99% of your game code, though you might still have to drop into C for some really performance-intensive bits.
Mono Performance For Games - AnotherJake - Sep 20, 2007 02:49 PM
Wow, I didn't realize Lua would be *that* much slower than Mono C#. That makes me seriously interested in ditching Lua for Mono if I could swing it. I would rather use C# any day over Lua (or anything else except obj-c for that matter!), but I wonder about the size. Surely one would only need to include a small subset of Mono, like maybe a basic runtime, but I really don't know anything about Mono's components. Taking a wild guess that the runtime and compiler might be in the mono binary (in the mono framework/bin), that would still be 11.2 MB, which is far more than Lua's ~550k.
Mono Performance For Games - OneSadCookie - Sep 20, 2007 04:15 PM
The minimal size for a Unity UB used to be in excess of 20MB... I think they may have managed to reduce it since then though... perhaps a Unity user can comment
Mono Performance For Games - Nick - Sep 20, 2007 05:58 PM
I was able to use Mono's macpack utility to package up an app bundle with the Mono libraries included and it totaled about 9mb. So it's definitely a larger app than a native C one, but with today's internet speeds, it's nothing I'm particularly worried with. The art assets are bound to outweigh the library size.
Mono Performance For Games - AnotherJake - Sep 20, 2007 07:06 PM
Still, if your app is only 20 MB including Mono, it kinda stinks to be paying for half of your bandwidth just because of it. Bandwidth is cheap, sure, but it ain't free, especially for indie or hobby projects. I hate to think I'd spend a lot of effort compressing images and assets and stuff into a 10 MB footprint, only to lose all that ground to Mono. Lua is so small that it could be considered just another image asset, not to mention great performance and familiarity, with only a relatively small price to pay in the funky syntax and non-easy-oop department. But C#'s usability, syntax and performance blows away pretty much everything that runs in a VM IMHO. I dunno, maybe 10 MB is a good space to budget for C# if that can be done. Tough call! I guess I need to start looking more seriously at it.
Well anyway, if you figure anything more out about it I'd be interested to hear!
Mono Performance For Games - OneSadCookie - Sep 20, 2007 07:37 PM
Is your 9MB Mono app package a UB? Is that a compressed measure or an uncompressed measure?