News for hackers. Stuff that matters.
Re:Mono for Unreal Engine by j_s on Thursday October 23, 2014 @04:22PM (#8500536)
Maybe this will light a fire under Unity to get a recent version of a C# compiler. No one has ever been able to point me to an official explanation for why theirs is so far behind.
Re:Mono for Unreal Engine by TillE on Thursday October 23, 2014 @04:53PM (#8500688)
That was my number one reason for moving to UE4; announcing Unity 5 with no Mono runtime update was the last straw. Current versions of Mono could probably do a serviceable job with simulation-heavy games, but not Unity's ancient one.

Bizarrely, they don't even have a C or C++ API. You can add native code libraries to your project in Unity Pro, but you always have to go through Mono to interact with the engine.

Re:Mono for Unreal Engine by azakai on Thursday October 23, 2014 @05:29PM (#8500867)
Unity is writing a C#-to-C++ compiler, il2cpp, see

http://blogs.unity3d.com/2014/05/20/the-future-of-scripting-...

it's much faster that Mono on some things currently,

http://blogs.unity3d.com/2014/10/07/benchmarking-unity-perfo...

but it is so far only used in the WebGL port. Long-term, il2cpp is meant to replace Mono in Unity, according to the first of those links.

Re:Mono for Unreal Engine by migueldeicaza on Thursday October 23, 2014 @05:49PM (#8500945)
Small clarification.

It is faster than the old Mono they ship.

Their Mono is at best Mono 2.10, about three years old, without any of our optimization work for three years, very notably, a lot of the LLVM support, or the new garbage collector.

That said, the il2cpp looks like a very promising an interesting project, so kudos for that!

Re:Mono for Unreal Engine by azakai on Thursday October 23, 2014 @05:59PM (#8500994)
Yes, I think those benchmarks are based on the Mono they use, which is indeed old. I would be very curious to see benchmarks compared to trunk Mono - should be interesting.

My information may be out of date, but typically people tell me that Mono tends to not match Microsoft's .NET implementation in speed, and in turn, .NET tends to not match native C++ either. So I would still guess il2cpp can win here. Or are there benchmarks showing Mono matches .NET and/or native C++?

Re:Mono for Unreal Engine by Skinney on Thursday October 23, 2014 @06:24PM (#8501076)
It's important to consider that C++ code, is not the same as C# to C++ code. The Facebook guys originally converted PHP to C++ code for speed, just like il2cpp, but eventually they wrote a JIT because it was faster AND they could keep the dynamic features like code generation and dynamic loading.

C# is ment to be a safe language, unlike C++ which has, among other things, the notion of undefined behaviour and manual memory management. This is what makes C# initially slower than C++. You might be able to compensate with a JIT, but safety still costs. Not to mention, the Unity guys will still probably have to implement their own GC and spend years on optimisations.

Also, several games are using dynamic loading for things like plugins and mods, as far as I know, il2cpp will force them to change how this is implemented.

From my standpoint. The cheapest option, and best option for everyone really, is to continue using (an up-to-date) Mono and instead allow for writing games in C++ as well.

Re:Mono for Unreal Engine by therealunreal on Friday October 24, 2014 @08:05AM (#8503218)
> From my standpoint. The cheapest option, and best option for everyone really, is to continue using (an up-to-date) Mono and instead allow for writing games in C++ as well.

Yes. It seems logical that there have been some licensing negotiations that we're not aware of, and maybe all this is part of ongoing negotiations too.

What's puzzling is that they're keeping il2cpp closed. Opening it would make sense and would show they mean serious business but keeping it closed makes me wonder if their risk will pay off or if it's just a bluff.

Re:Mono for Unreal Engine by azakai on Thursday October 23, 2014 @06:31PM (#8501103)
Good point about code compiled to C++ not being the same as idiomatic C++ code.

However, unlike PHP which is dynamic, C# is statically typed. It is a much more direct match for C++, and performance should be pretty good.

But with that said, I think your point still stands, as there are still things like bounds checks in C# which would need to remain when compiled to C++, while idiomatic C# might not have those checks.

I wonder though if those bounds checks couldn't be disabled in some cases. Sandboxing isn't a concern on the Unity WebGL port, for example, since the browser provides that, so il2cpp code doesn't need to be safe in that sense.

Re:Mono for Unreal Engine by virtue3 on Thursday October 23, 2014 @07:57PM (#8501406)
C# has very defined behaviour that when "ported" to C++ is going to result in similar speed hits. Allocations are zero'd out. boxing/unboxing objects, array bounds checking.

GC is going to be the big hit as you're still going to need to pay for that even in C++ land. I'm not really seeing what you'd get over just C# with a more modern JIT unless you start converting to non-safe C code and doing sneaky c stuff behind the scenes (and I'm sure absolutely nothing will go wrong*).

The webgl stuff is fine to not be bound (I'm assuming it's being converted to js anyway?) but anything running in the plugin better be.

Re:Mono for Unreal Engine by azakai on Thursday October 23, 2014 @08:24PM (#8501498)
First and foremost, compiling to C++ means you then optimize it using a full C++ compiler like gcc or clang+LLVM. Not only are those compilers generally better than JITs, they can also do whole-program optimizations. JITs are getting that too (Dalvik=>ART, newer .NET runtimes), but the C and C++ compilers have a big head start.

(In theory a JIT can do all the things C++ compilers do, of course.)

Aside from performance, Mono must be ported to each target platform (I've heard this can take significant effort). On the other hand, well-written C++ code should just run (the rest of the engine is in C++ anyhow).

edit: yes, Unity compiles C# to C++, then to JS to run in the browser.

Re:Mono for Unreal Engine by Skinney on Friday October 24, 2014 @04:59AM (#8502766)
All true, but you're forgetting that Mono can AOT compile C# to native code using LLVM. That's how Xamarin.iOS works. So il2cpp doesn't really bring anything new to the table.
Re:Mono for Unreal Engine by pdaddyo on Friday October 24, 2014 @07:59AM (#8503202)
But it does solve their biggest issue - ultimately enabling Unity projects to publish to the web without plugins (WebGL / javascript).

Once all code in a Unity project eventually ends up as C++ (even if it started as C#), they can leverage Emscripten, asm.js and related technologies to enable Unity devs to use C# in the editor, which is converted to C++, and ultimately Javascript. It seems crazy, but it might just work!

Re:Mono for Unreal Engine by cwyers on Friday October 24, 2014 @09:28AM (#8503516)
"But it does solve their biggest issue - ultimately enabling Unity projects to publish to the web without plugins (WebGL / javascript)."

I'm not really sure that is their biggest issue; HTML5 publishing of Unity games seems mostly a novelty at this point.

Re:Mono for Unreal Engine by azakai on Friday October 24, 2014 @12:57PM (#8504613)
It is still pretty new, yes, but it seems to work well (see for example https://hacks.mozilla.org/2014/10/unity-games-in-webgl-owlch... ), and it's been one of the most-asked for features by Unity users on their forums.
Re:Mono for Unreal Engine by Skinney on Friday October 24, 2014 @08:07AM (#8503222)
Regarding the C# -> C++ -> JS thing, it really must alot easier to do a C# -> JS conversion...
Re:Mono for Unreal Engine by pjmlp on Friday October 24, 2014 @12:53AM (#8502202)
>NET tends to not match native C++ either

Let's see if with the new RyuJIT and the AOT compiler sharing the Visual C++ compiler backend in the upcoming .NET, that still holds.

Re:Mono for Unreal Engine by eropple on Thursday October 23, 2014 @06:31PM (#8501111)
Can't be understated - I've benchmarked my current MonoGame stuff with 2.10 and 3.10 and the modern stuff is leaps and bounds better in terms of GC performance (that alone being my biggest hurdle). Perf improvements have been coming very steadily and while there are areas I wouldn't recommend it for I wouldn't hesitate in recommending it for the logic level of many games.
Re:Mono for Unreal Engine by tormeh on Thursday October 23, 2014 @07:22PM (#8501271)
But why? Why not directly compile it by implementing an LLVM frontend? And if you're going to transpile like this, I would assume translating to Java would be easier, since the languages are really similar. The JVM is, depending on task, as much as four times faster than Mono, and that's the official Mono, not Unity's stagnated one.
Re:Mono for Unreal Engine by WallWextra on Thursday October 23, 2014 @04:25PM (#8500545)
The unoffical reason is Xamarin wants too much money.
Re:Mono for Unreal Engine by pjmlp on Thursday October 23, 2014 @04:55PM (#8500698)
Or the Unity guys want to pay too little money.
Re:Mono for Unreal Engine by Mikeb85 on Friday October 24, 2014 @12:19AM (#8502133)
You haven't seen Xamarin licensing prices...
Re:Mono for Unreal Engine by pjmlp on Friday October 24, 2014 @01:03AM (#8502216)
No, but they are surely cheaper than a lot of comercial software I have to deal with in the enterprise space.

Plus let's not forget Unity was just another 3D engine before they got Mono integrated. Whereas Mono was already being used in multiple areas.

Anyway, this is playing conspiracy theory until someone issues an official statement.

Re:Mono for Unreal Engine by frik on Friday October 24, 2014 @06:49AM (#8503023)
Mono is open source and free software. Because of the "single static binary" policy (no dynamic linking) of app stores you have to obtain a proprietary license from Xamarin.

• The C# compiler is dual-licensed under the MIT/X11 license and the GNU General Public License (GPL).

• The tools are released under the terms of the GNU General Public License (GPL).

• The runtime libraries are under the GNU Library GPL 2.0 (LGPL 2.0).

• The class libraries are released under the terms of the MIT X11 license.

and:

When do I need to obtain a license from Xamarin to the Mono Runtime?

We only require licensing for uses of Mono and Moonlight on embedded systems, or systems where you are unable to fulfill the obligations of the GNU LGPL.

source: http://www.mono-project.com/docs/faq/licensing/

Re:Mono for Unreal Engine by gillianseed on Friday October 24, 2014 @12:03PM (#8504282)
>We only require licensing for uses of Mono and Moonlight on embedded systems, or systems where you are unable to fulfill the obligations of the GNU LGPL.

In other words, you have to pay a license fee for shipping the Mono runtime in a proprietary game, which is what Unity does.

So Unity has negotiated a license deal with Xamarin for the Mono runtime version they use, and if they want to use a newer version they will have to pay more, which they aren't doing.

Instead Unity has developed il2cpp which means that they no longer have to ship the mono runtime with each game and therefore no longer have to pay the license fee for shipping mono.

Atleast that's what I've gathered.

Re:Mono for Unreal Engine by mnglkhn2 on Friday October 24, 2014 @02:20PM (#8505072)
Unity has negotiated a license with Novell. Now they would have to do it again with Xamarin for the newer version of Mono. But we don't know if Unity was really nice to the Mono guys when Novell pushed out what would quickly become Xamarin. As always, if it were only money things would be simpler. But if there is some beef things will drag.

Plus, Unity has forked Mono and they contribute to their own internal version. At the same time they are working hard on their own proprietary il2cpp (to export to C++). The writing is clear: they will drag things as long as possible with using their old version of Mono until they are able to switch to il2cpp.

My personal opinion is that Xamarin guys are better at Mono and that UE4 coupled w. Mono/C# might put quite a bit of pressure on Unity.

Re:Mono for Unreal Engine by gillianseed on Saturday October 25, 2014 @07:03AM (#8507831)
>Unity has negotiated a license with Novell. Now they would have to do it again with Xamarin for the newer version of Mono.

Ah, so the deal was before Xamarin bought the rights to Mono from Attachmate/Novell, I didn't know that.

>At the same time they are working hard on their own proprietary il2cpp (to export to C++). The writing is clear: they will drag things as long as possible with using their old version of Mono until they are able to switch to il2cpp.

From what I understood they would still ship Mono as part of Unity (as in development framework), however what they want to avoid is the license costs that comes with shipping the Mono runtime with each Unity game, hence il2cpp, but perhaps I'm mistaken here ?

Re:Mono for Unreal Engine by mnglkhn2 on Saturday October 25, 2014 @09:22AM (#8508130)
For them to invest serious resources into a Mono fork and also in a proprietary solution (il2cpp) shows that they do not believe in a deal for a license of their liking, whatever the reasons: interpersonal or purely monetary.
Re:Mono for Unreal Engine by the_why_of_y on Friday October 24, 2014 @02:20PM (#8505071)
You can bundle LGPL libraries with proprietary applications quite easily; it just has to be possible for the user to replace it, which is rarely a problem because the usual situation is that your proprietary code sits "above" the LGPL library.

But reportedly Apple does not allow LGPL in its app store for some reason.

Re:Mono for Unreal Engine by gillianseed on Saturday October 25, 2014 @07:09AM (#8507846)
Well there are likely lots of potential markets where a prerequisite of allowing the end user to swap out LGPL libraries won't be accepted (sadly), not only Apple but the consoles as well, so from that perspective Unity needs to buy a license which allows them to forego the LGPL requirements.
Re:Mono for Unreal Engine by MrDom on Friday October 24, 2014 @07:25AM (#8503113)
It's not just mono they need, it's the IDE. The default IDE that comes with Unity is MonoDevelop. If they upgraded the runtime, they'd have to pay for Xamarin's IDE. I wonder if embedding the java runtime would have been cheaper in the long run.
Re:Mono for Unreal Engine by jstedfast on Friday October 24, 2014 @01:23PM (#8504751)
Our IDE is free for anyone to use, whether you are using our iOS, Android or Mac products or not. It's also open source (except for the addins that work with our iOS, Android and Mac products).

There are a lot of Unity customers on our forums using Xamarin Studio already.

Re:Mono for Unreal Engine by Alphasite_ on Friday October 24, 2014 @12:58PM (#8504625)
How would that work with the App store now, since you can dynamically link to frameworks?
Re:Mono for Unreal Engine by _random_ on Thursday October 23, 2014 @05:06PM (#8500761)
I think it is very fair if Unity will be in the same boat as e.g. MonoGame.
Re:Mono for Unreal Engine by Mikeb85 on Friday October 24, 2014 @12:11AM (#8502112)
> No one has ever been able to point me to an official explanation for why theirs is so far behind.

They don't want to pay Xamarin. Mono commercial licensing sucks...

Re:Mono for Unreal Engine by pjmlp on Friday October 24, 2014 @12:57AM (#8502207)
Compared to what? I fail to see any difference to other comercial software offerings.
Re:Mono for Unreal Engine by MrDom on Friday October 24, 2014 @07:22AM (#8503106)
Compared to free. The version they're using doesn't require any licensing.
Re:Mono for Unreal Engine by mnglkhn2 on Thursday October 23, 2014 @04:40PM (#8500614)
I suspect the issue is related to the licensing fee which might be on a per dev seat and hence might not fit unity 3d's business model. Unless there is a hard stop issue, business wise, it won't happen.
Re:Mono for Unreal Engine by mnglkhn2 on Thursday October 23, 2014 @05:21PM (#8500827)
When unity got their mono license xamarin wasn't yet a business, hence the license was most likely zero.
Re:Mono for Unreal Engine by shadowmint on Friday October 24, 2014 @06:44AM (#8503009)
It would have been zero to Xamarin, but doubt it was free.

I imagine they bought a perpetual license to distribute sans-GPL the full code of a specific version of mono from Novell.

This thread has a bunch of speculation and a few comments from unity developers: http://forum.unity3d.com/threads/new-version-of-mono-with-un...

Re:Mono for Unreal Engine by forrestthewoods on Thursday October 23, 2014 @04:30PM (#8500579)
They forked a long, long, long time ago.