C#, Roslyn and Licencing

I’ve seen a few posts flying around about integration of various scripting languages into the Unreal Engine (Mainly Lua and Javascript via V8) but people normally mention some vague legal issues when someone brings up a .Net platform language like C# or Visual Basic.Net; I don’t get why there would be an issue though, I looked into “Roslyn” (Microsoft’s Open Source implementation of the compiler platform, See : http://msdn.microsoft.com/en-gb/vstudio/roslyn.aspx and http://roslyn.codeplex.com/) and it would appear that it is under the Apache 2.0 Licence (https://tldrlegal.com/license/apache-license-2.0-%28apache-2.0%29#fulltext and https://tldrlegal.com/license/apache-license-2.0-%28apache-2.0%29) since the 3rd of April as it says on the Wikipedia article (http://en.wikipedia.org/wiki/Microsoft_Roslyn)

My understanding of this license is that it requires attribution and a notice of the files you’ve modified from the original source but doesn’t include anything that would conflict with the terms of the Unreal Engine licence such as a “copyleft” clause; Please can someone explain if I’m right here or what the potential issue/s everyone is referencing might be

Please stop asking for C#, start using/learning C++. There is no point to carry over a .net framework just because you (and some folks) refuse to use C++.

Please let Unreal devs continue working ON engine instead losing time making C# bindings and taking care of all the problems what come with them.

The OP is not demanding Epic implement C# bindings, chill out.

Roslyn is just one piece of the puzzle, while it can be used to replace the compiler part of the Mono framework, you still need the Mono runtime libraries to actually run Roslyn or any of the code it generates on any platform other than Windows. So any licensing issues you may have seen mentioned relate to the Mono framework being licensed under the GPL.

TDoro; I do know C++ (I wouldn’t call myself an expert by any measure though) and am actively trying new things to improve my skills, This wasn’t meant for Epic or anything either, I was just a little confused as to the legal issues I mentioned… My intention for such a system was to create a mod system like past interations of the engine but based on C# instead of UnrealScript to aid the learning curve for novice programmers (And because I personally find C# a lot more intuitive for higher level programming)

enlight_2014; Thank you for your feedback, Does this mean I wouldn’t have any issues using such a system for a Windows only release?

There should be no licensing issues, but I can’t speak for technical ones since I haven’t tried this myself. Microsoft refers to embedding of the CLR in a native binary as CLR Hosting. You’d probably want to create a separate library for the hosting code that loads the CLR runtime, build it outside your UE4 project and then specify it as a depedency in your UE4 project’s .Build.cs (see Bob Gneu’s Javascript plugin for an example). You should also be aware of the scripting language plugin infrastructure which may help you expose the UE4 API to C#.

Also there was some work being done on the C# integration in the early days, as far as I recall there were at least two interested parties working on something, but I haven’t heard much about that lately, I wonder how they’re getting on. Here’s the relevant thread: Mono C# Bindings for Unreal 4 - Community & Industry Discussion - Epic Developer Community Forums

No but he try somehow.

Please start using C++, will solve all your problems.

Again, so many artificially created problems because some peoples refuse to use C++.

TDoro; I think that you’re willfully misinterpreting what I’m writing to troll now

I think I made it rather clear this question was about the licencing and potentially the implementation rather than asking Epic for features

Both languages are Turing Complete, Your point here is?

I already stated my intention and (hopefully) made it clear I’m not trying to replace C++ at all… Now If you have nothing constructive to add to proceedings, Please go give your “advice” elsewhere

OK; Another question, Is it possible to use this as my base then instead as it’s under the Apache Licence : .NET Micro Framework - Wikipedia

EDIT; It’s for ARM devices, Ignore me (Although it might be useful in the Android build of the engine) :smiley:

It’s most likely for Microsoft’s ARM platforms (WinRT, Windows Phone) and as everything made by Microsoft i doubt it’s unix-like enough to port it to Linux (on which Android run on top of) without a rewrite on most things.

In general everything that has .NET in name runs only on Microsoft platforms.

Please could you explain in detail what you want?

You can do in UE4 **anything ** you want in Blueprints. For the very few moments when you need super optimizations (speed optimization of a Blueprint, making an addon or making your super cool game/app code) make a freaking effort and do it in C++.

Why you need C#??? For what exactly What do you want to achieve besides adding a .net layer full of bindings? Please en-light me! =))

“Why you need C#??? For what exactly What do you want to achieve besides adding a .net layer full of bindings? Please en-light me! =))”

Simply couldn’t agree more.

Quote Originally Posted by
And because I personally find C# a lot more intuitive for higher level programming

This is because you don’t know C++ well enough. C++ allows you to write on identical level of abstraction as C#. C# gives you nothing extra, but takes enormous amount from you, just to list few:

  1. Performance, boy, you are in gaming industry, C# is slower than C++ ranging from 2 to 10 times. What it means that by using C# you loosing on the start from 200% to 1000% on performance. And that before you’ve even written one line of code.
  2. Portability, boy, you are in gaming industy, C# isn’t portable, C++ is portable to virtually any platform. What it means is that by using C# you constrain yourself to just one platform.

Pull yourself together, learn C++, you will never look back.

I like the way everyone completely ignores what I actually said; Unrealscript was managed and ran on top of the raw C++… Why was that? To allow the engine to be modded without access to the source, this isn’t for me, It’s to provide features for the game and if everyone would stop going off on tangents about how great C++ is and how I should “learn it” (When I’ve explicitly stated I’m not “replacing” C++ and that I am learning it before), I might get somewhere

Hi, everyone is trying to tell you that in gaming industry if you really want to get serious you should start using C++ and forget about C#, java, javascript, php, python and all others slow-mo creatures.
Believe me, once you learn C++ you will not want to touch other languages, you will never look back.

Please don’t respond to the trolls, maybe a kind mod can clean up the nonconstructive posts.

Is this any use? it looks promising (unsure of the licensing right now though) : http://www.csscript.net/

EDIT; Licence looks fine : http://www.csscript.net/Licence.html

C# on it’s own, is just another language with C-like syntax.

What really makes C# stand out are libraries that accompany it and compiler. You will still need to hook up mono or .NET to make full use of it.

I agree with you totally there but I find it a very easy (Read productive) language to use, Even without mscorelib.dll etc. Is it possible to write an interpreter for C#'s syntax which would work only within the context of my game/The Unreal Engine then? That’s what I really want, a custom scripting language for modification etc. and the .net/CLR overhead might not be worth it for that purpose… That being said, Unrealscript worked in a virtual execution environment; I may be oversimplifying too far here but it seems to me that the real work is in recreating the virtual machine that the IL outputted from Roslyn will actually execute on (And, of course, creating the backing libraries to replace mscorelib.dll)

EDIT; Just to make this 100% clear, I don’t mean to replace C++ in terms of the main developmental effort, I realise that most, If not all of my work will still be in C++; This is more of an after-market feature for mod support

EDIT 2; And I’m not asking Epic for anything either, I just want pointers as to how I could implement such a system

Also; Another query… it seems that the Mono licencing issues will only come into play if the libraries are statically linked (TLDR Legal LGPL) So that would only be an issue on platforms such as iOS if I’m correct?

Thanks for your patience . The thread is interesting.

I’m a Unity developer that’s done a ton of work in C# and I’m trying to figure out if it’s time to jump ship. As a programmer of 20 years, I could switch to C++, but find C# much more fluid. Of course there’s a performance hit, but it’s not as dramatic as it used to be. In fact, I’d worry more about the render pipeline.

For most of us indies the performance hit is overshadowed by the efficiency boost, support-ability, and reusable libraries that exist for C#.

Anyway, great questions.


Don’t let the C++ trolls get to you, most of us would love to see different language plugins for UE4. Even Unreal has added prototype Scripting Plugins to 4.2 and includes Lua support.

Have you looked at Xamarin? They have C#/.NET support for iPhone and Android that gives you commercial licenses for those platforms. Pricey but may be worth the support.

Writing a C# scripting language is easy, once you have mono/.net available. The compiler is just another built-in class so you can feed C# (or Visual Basic or even F#) to it and then run it. I did that for client who needed a powerful scripting language.