Live data from Hacker News

What's new in C# for Godot 4.0

godotengine.org

61–70 of 112 posts

Re: What's new in C# for Godot 4.0

#61

It’s surprising to me that javascript wasn’t chosen as the scripting language for all these gaming engines. Though I do see the benefit of C# being typed and compiled.

It's mostly a historical accident, like Python ending up as the data science language.

Microsoft XNA used to be a popular indie game framework that used C#. Stardew Valley, Celeste and Terraria run on XNA.

Mono used C#. Xamarin used Mono to create a cross-platform application framework that worked on mobile. Unity leveraged Xamarin to create a cross-platform game engine that worked on mobile, ending up using C#.

Thus, two generations of indie gamedevs ended up learning C# to create games. Then Unity grew a whole lot, so more and more people ended up associating C# with game engines, so as soon as Godot was released people started asking for C# support.

But C# being the language of choice doesn't really depend on specific C# features. It could've just as easily been Lua or JavaScript instead. For example, RPG Maker moved from Ruby to JavaScript when they upgraded to a new engine, again, because their new rendering engine was nw.js, and getting it to run almost anywhere was easy.

Re: What's new in C# for Godot 4.0

#62
[elf/linux] vulkan and guidelines/build container to workaround (modules/version)&(symbol/version)s based aggressive planned obsolescence from glibc libs and the static libstdc++ (-static-libstdc++).

Re: What's new in C# for Godot 4.0

#63
post #32

Earlier quoted context omitted.

Hobbyist unity dev here. Can anyone explain the mono/coreCLR commentary in this comment thread? I recently learned that mono works kinda like an interpreted language. This makes sense I think because the internals of unity run C++ code; the C# code is just an interface into the C++ parts of the engine. I haven't done a deep dive into .net ecosystem ever. I probably should at some point. Since I only work in unity and…

Mono and coreCLR are two alternative implementations for .Net runtime. Just like Firefox and Chrome are two implementations for various web formats, or CPython and PyPy for python language and many other examples. Note in this comment I might be slightly imprecise with the use of naming since the specification, standard library, runtime can be separate projects each with its own name. But often multiple of those part…

FYI, Mono was largely folded into CoreCLR a couple releases ago, and is currently used when deploying to certain targets - for example WebAssembly.

[disclosure: I work on Mono at Microsoft.]

Re: What's new in C# for Godot 4.0

#64

Earlier quoted context omitted.

You can use mono for targets that need it and .NET 6 for those that don't

Keeping two implementations side by side would be expensive to maintain and not a good user experience: you start writing nice, "modern" .NET6 code and then need to rewrite things to run on top of .NET4-ish (and the older BCL and C#). And I think .NET6 supports mobile now?

Mono was largely folded into CoreCLR a couple releases ago and part of that infrastructure is used to support some targets like mobile and WebAssembly.

[disclosure: I work on Mono at Microsoft.]

Re: What's new in C# for Godot 4.0

#65

It’s surprising to me that javascript wasn’t chosen as the scripting language for all these gaming engines. Though I do see the benefit of C# being typed and compiled.

It's mostly a historical accident, like Python ending up as the data science language. Microsoft XNA used to be a popular indie game framework that used C#. Stardew Valley, Celeste and Terraria run on XNA. Mono used C#. Xamarin used Mono to create a cross-platform application framework that worked on mobile. Unity leveraged Xamarin to create a cross-platform game engine that worked on mobile, ending up using C#. Thus…

I'd argue that the availability of value types in C# gives it a leg up over languages like JavaScript for performance-sensitive games work. These days v8 and spidermonkey have incredible garbage collectors capable of incremental/parallel collection so people have been able to ship JS-based games on PC+Console, but when it comes to game scripting it's either languages with value types like C#/C++ or languages with more predictable garbage collection behavior and performance like Lua and Ruby (Ruby especially is popular with Japanese developers, likely because the language originated over there.)

C# being possible to mostly AOT compile (some exceptions) is also an advantage over JS for scripting since JS is not particularly efficient to run in an interpreter and many deployment targets don't allow you to JIT code at runtime. Languages like Lua have much better characteristics for those targets since they have high performance interpreters and cleaner language semantics.

Re: What's new in C# for Godot 4.0

#66

Earlier quoted context omitted.

I think it was more that Unity's "JS" was actually their own language that was just very similar to real Javascript. They were forced to support the language itself as well as the integration. It was a lot easier to just support C#, which is maintained by others.

Hmm. Cocos Creator manages JavaScript/TypeScript ontop of their bespoke (ios:Obj-C++, Android: Java) + C++ native stack and they don't have that many engineering resources. Granted, they did have multiple breaking non-backwards compatible re-architecturings of their engine(s), along the way.

Cocos is likely using actual JavaScript. When I used Unity's JS dialect (a very long time ago, to be fair) it was very much not traditional JS and was its own beast, so Unity likely was having to do a lot of work on it.

Re: What's new in C# for Godot 4.0

#67
post #57
post #55

Earlier quoted context omitted.

How does it help with vector math?

I would imagine operator overloading helps with vectors so you can do things like: public static Vector operator -(Vector a, Vector b) { Vector v = new Vector(); v.X = a.X - b.X; v.Y = a.Y - b.Y; return v; } So then you can just write: Vector result = myVector1 - myVector2;

Also if you wrote the JS equivalent of that, each vector would be 3-4 individually heap-allocated doubles in v8, because they aren't able to allocate floating-point values inline. There would also be a new heap allocation for the result vector itself when performing each operation. The overhead really adds up. :/

At one point Mozilla had a prototype implementation of strongly-typed value types in JavaScript, but it fell by the wayside once WebAssembly became a thing.

Re: What's new in C# for Godot 4.0

#68

Earlier quoted context omitted.

You can use mono for targets that need it and .NET 6 for those that don't

Keeping two implementations side by side would be expensive to maintain and not a good user experience: you start writing nice, "modern" .NET6 code and then need to rewrite things to run on top of .NET4-ish (and the older BCL and C#). And I think .NET6 supports mobile now?

[deleted]

Re: What's new in C# for Godot 4.0

#69
post #59

Any godot programmers here. How is godot's support of games in the browser? 4 years ago I was deciding on a game engine to use. I considered it to unreal, Unity, and godot. I want to be able to build games that can be played on the web. I have many fond memories of the Flash game days. Distributing games over the web allows me to share games with people without the friction of installers, or App Store gate keepers, w…

Does anyone actually play games in the browser? I mean, there is no technical reason not to, but I kinda find it strange.

Sorry if my question was worded badly. Obviously, some people are playing games in the browser - perhaps I should have asked more specifically what the appeal is, e.g. is it mostly small casual games like what Flash used to be used for, or do people actually play more invested games?

And sorry again if the answer to these questions is so obvious to some of you that the question itself sounds dumb, but I'm simply not experienced with this topic.

Re: What's new in C# for Godot 4.0

#70
post #59

Any godot programmers here. How is godot's support of games in the browser? 4 years ago I was deciding on a game engine to use. I considered it to unreal, Unity, and godot. I want to be able to build games that can be played on the web. I have many fond memories of the Flash game days. Distributing games over the web allows me to share games with people without the friction of installers, or App Store gate keepers, w…

Does anyone actually play games in the browser? I mean, there is no technical reason not to, but I kinda find it strange.

Yes, lots of people do. Not as much long story based games, but more arcadey/casual games. This is especially common for kids using computers at school. Just think about all the old Flash games, that style of game is still popular.
Post reply on HN