D for Game Development

Rikki Cattermole via Digitalmars-d digitalmars-d at puremagic.com
Sat Aug 1 17:03:00 PDT 2015


On 2/08/2015 11:15 a.m., Brandon Ragland wrote:
> On Friday, 31 July 2015 at 21:40:51 UTC, Kapps wrote:
>> On Thursday, 30 July 2015 at 21:27:09 UTC, deadalnix wrote:
>>> On Thursday, 30 July 2015 at 15:10:59 UTC, Brandon Ragland wrote:
>>>> It's a dog because Java is a dog. But that's not because of the GC.
>>>>
>>>> It's not really that bad either, I can open up Minecraft at any time
>>>> and have it sit in the background quietly using ~800Mb ram and
>>>> virtually no cpu time.
>>>>
>>>> Either your kid has tons of mods in their Minecraft or your computer
>>>> is a bit dated.
>>>
>>> Now compare that kind of resources consumption with any game based on
>>> Quake III engine. While you are at it, compare the graphisms. Still
>>> not convinced ? Measure latencies, which are critical for most games.
>>
>> People always compare things to Minecraft when discussing if garbage
>> collection is feasible in a game. Which is annoying, because I'm sure
>> Minecraft's allocations would make most people sad. It's not a fair
>> comparison.
>>
>> Some quotes:
>> "Minecraft 1.8 has so many performance problems that I just don't know
>> where to start with. Maybe the biggest and the ugliest problem is the
>> memory allocation. Currently the game allocates (and throws away
>> immediately) 50 MB/sec when standing still and up to 200 MB/sec when
>> moving. That is just crazy."
>>
>> But that was just a one off thing for 1.8 I believe, the normal is
>> much better:
>> "How did that work in previous releases? The previous Minecraft
>> releases were much less memory hungry. The original Notch code (pre
>> 1.3) was allocating about 10-20 MB/sec which was much more easy to
>> control and optimize."
>>
>> 10-20 MB of garbage every second. That's just ridiculous to think of
>> in a language like D. And that was long ago, it's probably worse now.
>> Luckily D has things like ranges and other ways of improving this.
>>
>> Source:
>> http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1272953-1-8-7-optifine-hd-d6-fps-boost-hd-textures-aa-af?page=2111#c43757
>>
>
> The point is that because Minecraft does such a shoddy job at any kind
> of memory allocation, optimization, or conservation, the GC has a lot
> more to handle, and is abused quite regularly due to Mojang's lack of
> any real world coding experience it seems.
>
> The point of the comparison is this:
>
> If Minecraft, which is terrible, can do it with a GC, then why can't a
> *well* made D game work even better.
>
> I'm not defending Minecraft in any way shape or form, I'm actually
> defending the JVM GC.
>
> Minecraft is terribly designed and mad,e and uses excessive amounts of
> resources partially just based on it's design. A whole bunch of "blocks"
> yes "blocks" represent 12 outer triangles and on diagonal triangle
> through the center. The stairs, etc. that the game has represents even
> more tris.

Notch has said previously, if he had known Minecraft was going to become 
a hit like it was, he would have made it in C++. It was never made to be 
performant unfortunately.

> So if you have:
>
> * A game which regularly renderings in excess of 200,000 trs per frame
> * A game with terrible optimizations (if any....)

In the last few releases Mojang has been rewriting large portions of 
Minecraft for the purpose of performance optimization. E.g. thread friendly.
It's broken mods ridiculously every single release.

> * A game based on Java with a GC
>
> And it can still pull 30FPS on my cruddy 8 year old Gateway, than a GC
> is NOT the reason to NOT use the D language.
>
> If anything, you should take the lessons from Minecraft and do it
> *better* in D and you'll have much much better resource allocation,
> usage, and far less GC abuse.
>
> -Peace



More information about the Digitalmars-d mailing list