D game engine -- Any suggestions?

Rene Zwanenburg renezwanenburg at gmail.com
Wed Nov 20 01:15:39 PST 2013


On Wednesday, 20 November 2013 at 07:48:21 UTC, Mineko wrote:
> Yo, I'm starting off a new game engine designed around D, and I 
> just wanted to know if some of you might be kind enough to 
> review some of my base code and tell me if I need to change 
> anything in it.. While it's small. ;_;
>
> I'm still learning D, I quite like it, the power of C++ in some 
> parts, and the ease of Java in others. (Good job Walter!)
>
> Anyway here, check it out, only ones you really need to pay 
> attention to are main.d, time.d, and input.d.
>
> https://github.com/ICGCC/Breaker-3D-Game-Engine
>
> Thanks for helping out a newbie, and if you want to contribute 
> to it, even better!
>
> ..That and if I'm using the GPL right. >_____>"

Hi,

A few things jumped out at me:

Camera.d:

- The use of x, y, z and rx, ry, rz. These should really be in 
some vector struct. Since you're using Dub, you can easily use 
gl3n [1][2]. While it's still pretty basic, should be more than 
enough to get you started.

- Use Quaternions to store your rotations instead of euler angles.

- You can use @property instead of trivial getters and setters

- You may want to store your camera matrices in the camera class, 
and pass them to OpenGL when rendering. These matrices can be 
useful, and you don't want to use glGet* functions ever if you 
care about performance ;). gl3n provides matrix structs and 
facilities to create projection matrices and the like.

Oops, I have to run.. Will take a look at the rest later.

[1] http://dav1dde.github.io/gl3n/index.html
[2] http://code.dlang.org/packages/gl3n


More information about the Digitalmars-d-learn mailing list