I spent a nice time with the internals of the evilness engine today. Actually, I was looking to code a small heightmap test scene, similar to what I did before, but in a more general way and better integrated with the engine. Well, I basically ended up changing a couple of things in the engine here and there…
By far the most tedious change to make was that I came to think that the Vec2d class should instead be a struct. It’s really small – only consisting of two doubles – and is instantiated dozens of times each frame. So allocating (and garbage collecting) all those small objects on the heap has probably burnt some processor cycles. Of course, this optimization is pretty much against the book, because I didn’t profile or anything to verify that I get better results after the optimization. I’m a rogue coder after all… =)
I really like D’s new import mechanics. Saying “import Vec2d : Vec2d = Vec2d;” finally has allowed me to avoid qualifying Vec2d’s module whenever I’m calling a member function. Since I tend to name my classes the same as the containing modules (which would be considered good style by most people anyway), I’ve been waiting for something like this for a while. (Of course, I could have just aliased, but I was kind of too lazy for that ^^)
I also realized that I should start to whip up a little GUI system for the evilness engine to ease creating scenes (and eliminate the need for the horrible ReadScene in many places). This is gonna be quite a lot of work, even if I restrict myself noly to the really necessary classes at first, but I don’t really see a premade GUI kit that does what I want – it would have to be written in C or D and use OpenGL.
In the process of working on evilness, I also discovered two bugs in Sofud, one of which I believe to have fixed already, but seem to have lost that change… and of course, I ended up immediately making a new Sofud release after fixing the first bug, so I actually made two Sofud releases today. I updated the web site, too – I’m really proud of myself.