On Friday, 6 July 2018 at 17:43:29 UTC, JN wrote:
On Friday, 6 July 2018 at 17:26:26 UTC, wjoe wrote:
On Friday, 6 July 2018 at 15:53:56 UTC, Ecstatic Coder wrote:
With D, ANY forgotten allocation during the game loop (and I
really mean even JUST ONE hidden allocation somewhere in the
whole game or engine), may cause the game to regularly freeze
at the wrong time, because of an unwanted GC. Hence the
phobia.
You make it sound like a C++ game codes, debugs, profiles and
optimizes itself.
And like there are no gotchas with C++.
Anyway, I know I'm on a D forum here, so "those who don't
want to understand won't, and those who want will", to
paraphrase a former poster here.
Well, it appears that you don't.
And since you point out the D forum folks, I know game
developers are a very special lot, too, with ther mantra like
repetition of GC is the devil, acting like it's 1985 and the
need to count clock cycles and top-of-the-food-chain
I-never-make-mistakes arrogance like nobody else knows how to
write fast code, yet most games of those clever guys are bug
ridden pieces of poor quality even years after release,
including top AAA titles *cough* TES. Despite - or more likely
because - being made in C++.
Maybe performance aware game developers would do well to also
adopt the idea of code quality and D offers a lot in that
regard. Plus C++ish performance on top of that.
Yeah. There are plenty of games done in GC languages. C++ folks
want to use C++. The ones that wanted to switched, switched
already. Even if nogc gets more mature, they will find another
excuse. Probably something like "yeah but now I don't know
which parts of the language and library I can use and it's
awkward to put nogc everywhere".
I do some free time game development work in various languages,
even GC ones and the existence of GC was never a big issue for
me. Sure, I am not a super mighty C++ programmer, so I don't
know much, but for me it's more important as a gamedev to have
features such as operator overloading, value types/be able to
cast Vector3f[] to float[] without copying (something C/C++/D
can do, for example Java can't do, C# can partially do that
with LayoutKind.Sequential), accessibility of C bindings for
popular libraries like SDL, SFML, ODE.
nogc, betterC, interfacing to C++, at most they get a "hmm,
that's interesting", but I haven't really seen them bring
people to D. And I'll take a fun and convenient language over
performant one any day.
As I said, I wanted to explain the roots of the GC phobia for
some C++ developers.
If you don't agree when I said that one allocation during a C++
game loop is no problem, which one allocation during a GC
language game loop MAY eventually become a problem, that's fine
by me.
But as many people here told me to "disable the GC" to completely
avoid this potential risk of game freeze, I guess that all those
D experts are also wrong in giving me this advice.