<div dir="ltr">On 24 May 2013 05:37, Kiith-Sa <span dir="ltr"><<a href="mailto:kiithsacmp@gmail.com" target="_blank">kiithsacmp@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Thursday, 23 May 2013 at 18:13:17 UTC, Brad Anderson wrote:<br>
</div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
While there hasn't been anything official, I think it's a safe bet to say that D is being used for a major title, Remedy's Quantum Break, featured prominently during the announcement of Xbox One. Quantum Break doesn't come out until 2014 so the timeline seems about right (Remedy doesn't appear to work on more than one game at a time from what I can tell).<br>

<br>
<br>
That's pretty huge news.<br>
<br>
<br>
Now I'm wondering what can be done to foster this newly acquired credibility in games.  By far the biggest issue I hear about when it comes to people working on games in D is the garbage collector.  You can work around the GC without too much difficulty as Manu's experience shared in his DConf talk shows but a lot of people new to D don't know how to do that.  We could also use some tools and guides to help people identify and avoid GC use when necessary.<br>

<br>
@nogc comes to mind (I believe Andrei mentioned it during one of the talks released). [1][2]<br>
<br>
Johannes Pfau's work in progress -vgc command line option [3] would be another great tool that would help people identify GC allocations.  This or something similar could also be used to document throughout phobos when GC allocations can happen (and help eliminate it where it makes sense to).<br>

<br>
There was a lot of interesting stuff in Benjamin Thaut's article about GC versus manual memory management in a game [4] and the discussion about it on the forums [5].  A lot of this collective knowledge built up on manual memory management techniques specific to D should probably be formalized and added to the official documentation.  There is a Memory Management [6] page in the documentation but it appears to be rather dated at this point and not particularly applicable to modern D2 (no mention of emplace or scoped and it talks about using delete and scope classes).<br>

<br>
Game development is one place D can really get a foothold but all too often the GC is held over D's head because people taking their first look at D don't know how to avoid using it and often don't realize you can avoid using it entirely. This is easily the most common issue raised by newcomers to D with a C or C++ background that I see in the #d IRC channel (many of which are interested in game dev but concerned the GC will kill their game's performance).<br>

<br>
<br>
1: <a href="http://d.puremagic.com/issues/show_bug.cgi?id=5219" target="_blank">http://d.puremagic.com/issues/<u></u>show_bug.cgi?id=5219</a><br>
2: <a href="http://wiki.dlang.org/DIP18" target="_blank">http://wiki.dlang.org/DIP18</a><br>
3: <a href="https://github.com/D-Programming-Language/dmd/pull/1886" target="_blank">https://github.com/D-<u></u>Programming-Language/dmd/pull/<u></u>1886</a><br>
4: <a href="http://3d.benjamin-thaut.de/?p=20#more-20" target="_blank">http://3d.benjamin-thaut.de/?<u></u>p=20#more-20</a><br>
5: <a href="http://forum.dlang.org/post/k27bh7$t7f$1@digitalmars.com" target="_blank">http://forum.dlang.org/post/<u></u>k27bh7$t7f$1@digitalmars.com</a><br>
6: <a href="http://dlang.org/memory.html" target="_blank">http://dlang.org/memory.html</a><br>
</blockquote>
<br>
<br></div></div>
Without official confirmation, I think it's rather early to assume D's<br>
being used in Quantum Break. D might compile on the new consoles, but<br>
what about druntime/phobos/etc ?<br>
<br>
That said, I support this idea.<br>
<br>
When I get time I'll try looking at Phobos if there is some low-hanging fruit with regards to GC usage and submit pull requests (I didn't make any non-doc contribution to Phobos yet, but I have a general idea of how its source looks).<br>

<br>
I also think that many people overreact about GC too much. @nogc is certainly a good idea, but I think strategically using malloc, disabling/reenabling GC, using GC.free and even just using standard GC features *while taking care to<br>

avoid unnecessary allocations* is vastly better than outright removing GC.<br></blockquote><div><br></div><div style>Just to be clear, while I've hard many have, I've NEVER argued for removing the GC. I think that's a hallmark of a modern language. I want to use the GC in games, but it needs to have performance characteristics that are applicable to realtime and embedded use.</div>
<div style>Those are:</div><div style>1. Can't stop the world.</div><div style>2. Needs tight controls, enable/disable, and the allocators interface so alternative memory sources can be used in mane places.</div><div style>
3. Needs to (somehow) run incrementally. I'm happy to budget a few hundred µs per frame, but not a millisecond every 10 frames, or 1 second every 1000.</div><div style>    It can have 1-2% of overall frame time each frame, but it can't have 10-100% of random frames here and there. This results in framerate spikes.</div>
<div><br></div><div style>The GC its self can be much less efficient than the existing GC if it want's, it's only important that it can be halted at fine grained intervals, and that it will eventually complete its collect cycle over the long-term.</div>
<div style>I know that an incremental GC like this is very complex, but I've never heard of any real experiments, so maybe it's not impossible?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

It'd be good to have an easy-to-use way to manually allocate classes/structs in Phobos (higher-level than emplace, something close in usability to C++ new/delete), preferably with a way to override the allocation mechanism (I assume the fabled "allocators" have something to do with this? Maybe we'll get them once DNF is released... ... ...)<br>

</blockquote></div></div><br></div>