3 ms·
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 sp
by kevingadd 4y ago
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.
- mardifoufs 4y agoI'm completely uninformed about lua, but why isn't it being used more to build games then? I know it's a popular scripting language for games, but are there any engines that mainly use lua (in the same way Unity uses C#)?
- danbolt 4y agoLua very much hit a sweet spot in terms of performance and flexibility for proprietary codebases over the last twenty years. One or two programmers can embed it into an application and expose bindings for designers rather quickly. It’s kind of a min/max of flexibility and engineering work. As engines became larger products, companies often have the resources to make something bigger for game teams. Unreal’s Blueprints, or Godot’s GDScript integrate much more tightly with the engine’s runtime.
- kevingadd 4y agoLua is very widely used despite the fact that Unity and Unreal don't support it.