Writing game engine in C++, considering switching to D

francesco.cattoglio via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 20 01:57:47 PST 2015


On Thursday, 19 February 2015 at 02:08:39 UTC, Will Cassella 
wrote:
> Thanks for the replies, everyone!
>
> I think I'll try my hand at writing bindings for my existing 
> game engine, as Grøstad suggested - that way I can gradually 
> transition the codebase to D if I like what I see.

My 2 cents would be: start with a toy project that stresses a bit 
resource management (the toy project might as well be the 
rendering part of your existing engine). The only part of D I 
really don't like is non-deterministic resource destruction, 
because it can be really painful when it comes to stuff like 
OpenGL resources (e.g: if the GC calls any OpenGL function, you 
get a "nice" crash since OpenGL is not multithread-aware by 
default).

IMO the first thing you should do, is trying to see if you are 
able to manage all your critical resources (including OpenGL 
objects) by using D structs coupled with Unique! and RefCounted! 
templates you can find in std.typecons module.

I highly suggest you to do that, because that is the worst hurdle 
I had to face during any kind of D + OpenGL development. If you 
understand how to get stuff done right, you are set, and the rest 
of the work will be painless and fun.


More information about the Digitalmars-d mailing list