Introducing C# in Godot
godotengine.org
godotengine.org
if (ev is InputEventMouse)
{
var mouseEvent = (InputEventMouse)ev;
Vector2 mousePos = mouseEvent.Position;
}
else if (ev is InputEventKey)
{
var keyEvent = (InputEventKey)ev;
bool aPressed = keyEvent.Pressed && keyEvent.Scancode == GD.KEY_A;
}
would be better written as: switch (ev)
{
case InputEventMouse mouseEvent:
Vector2 mousePos = mouseEvent.Position;
break;
case InputEventKey keyEvent:
bool aPressed = keyEvent.Pressed && keyEvent.Scancode == GD.KEY_A;
break;
} if (ev is InputEventMouse mouseEvent)
{
Vector2 mousePos = mouseEvent.Position;
}
else if (ev is InputEventKey keyEvent)
{
bool aPressed = keyEvent.Pressed && keyEvent.Scancode == GD.KEY_A;
}(Modern) C# is my favorite language, but I've been looking into F# recently. Wonder if someday that might be an option in Godot as well. Given how both languages compile to the same binary format, there have been workarounds to use it in Unity even though it's not officially supported.
Therefore I find it very odd they chose to use the Mono runtime. It sounds to me the .NET Core runtime is a much better choice, since the underlying CLR is in the basis the same as the .NET Framework CLR, including the Ryujit and all the other goodies.
Mono is only used in some targets, they actually compile to native code via IL2CPP for production deployment.
The Unity is already supporting 4.6 on its beta version.
Godot Engine – Free and open-source 2D and 3D game engine | https://news.ycombinator.com/item?id=15523416 (Sep 2017, 131 comments)
I notice the post reveals ms has funded the project now. I hope Godot doesn't owe ms any favours..
[0]: http://www.mono-project.com/news/2016/03/31/mono-relicensed-...
Note how Microsoft was mentioned for their license change (why would that be if Microsoft had nothing to do with the change, wondering if buying out Xamarin gave them power over making Mono more open), and it was announced at the annual big Microsoft event no less. I'm all for yelling at Microsoft when they screw up, but they're doing good things with .NET and C#.
Yes, the standard build doesn't make use of the C# module.
This is an explicit dig at Unity, which is still(?) on Mono 2.x and C# 3.5 owing to their custom IL2CPP toolchain (with Mono 4.x / C# 6 in beta for the editor only).
The last thing I want is any dependency on MS tooling as they've shown everything they release will include telemetry. I'm just getting started with game dev and I really like Godot, but if the future is going to require MS anything, I'm going to jump ship.
They can all run code targeted at Standard but all have slightly different libraries on top of Standard. Mono was originally was intended to be a cross platform stand-in for .NET Framework which is why they can mostly run the same code. I believe Mono and Framework are slowly merging together.
.NET 4.6.2 was only for .NET Standard 1.0, but they realised basing on 4.6.1 would be a more sensible decision and fixed it in version 2.0.