I briefly checked out this whole Burst / DOTS thingy and I must say I am a bit confused.
As far as I understand (correct me if I’m wrong) the general sentiment is that moving to DOTS offers better performance at the cost of reduced ability to write clean, abstract code. This post for example:
The response to this post was:
HOWEVER, functional programming / data driven development evangelists have claimed for years that moving to these paradigms offers dramatic improvements in code quality, regardless of its performance. According to them it is object-oriented and imperative programming that leads to convoluted, overly complex and bug prone code, while functional and data driven programming enables us to write simple, abstract, easy to understand and bug resistant code. However, they admit that their focus on immutability might make code less performant in some cases.
So what is the truth? Does ditching OOP and switching to data driven programming offer (a) cleaner code at the cost of reduced performance or (b) better performance at the cost of worse code? Because I’ve heard both claims.
My guess is that if Unity’s approach to ECS leads to difficulties in writing code then this is because of Unity’s insistence to keep using C#.
As far as I understand the tenets of DOTS are the direct opposite of what C# was designed for. To reduce cache misses we want data driven code, for ease of parallelization we want immutability, since the garbage collector is one of the major performance bottlenecks we want manual memory management, and to reduce performance impacts of code interpretation and JIT activation during runtime we want ahead of time compilation to native code rather than IL bytecode. So we now want functional, data driven, AOT compiled code with manual memory management. C#, however, is, and has always been an imperative, object-oriented, bytecode interpreted language with automatic memory management. It looks like C# is one of the worst language choices for DOTS.
As far as I’m aware the major reason why Unity uses C# is to reduce entry barrier. Most developers are already familiar with OOP and C# is more straightforward than, say, Rust, which, despite its other merits, is regarded as one of the more difficult languages available. However, C# may only be easy to learn if it used to what it was designed for. The bastardization of C# to write functional, data driven code with manual memory management suddenly makes C# a far more difficult language and certainly less convenient than languages designed from scratch to support such paradigms.
Another big reason for continued support of C# are historical reasons. Unity was always developed with C# in mind, lots of already existing code is written in C#, game developers who use Unity are familiar with C#, so moving away from C# would be a very bad decision now.
I checked out the manual of Burst: https://docs.unity3d.com/Packages/com.unity.burst@1.8/manual/index.html Actually, is it still C#? The supported subset of C# is so small that no C# code not written from scratch with Burst in mind can be hoped to be compiled by Burst. But probably the worst part is that in certain parts language semantics have been changed:
(the quotation is from https://docs.unity3d.com/Packages/com.unity.burst@1.8/manual/csharp-language-support.html)
Arguably this what Burst supports is no longer C#, but rather, it is an entirely different language inspired by C#.
Developers’ pre-existing expertise with C# might indeed be, in a small part, transferable to Burst, at the cost however of using a language that is ill-suited to the goals of Burst.