Sebastian\’s Coding Blog

  • Categories

  • Advertisements

Archive for the ‘the Evilness engine’ Category

GUI? Heightmap? Where to start…

Posted by randomz on July 23, 2006

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.


Posted in D, Sofu, the Evilness engine | Leave a Comment »

evilness directory structure

Posted by randomz on July 5, 2006

I just checked in a pile of changes into the evilness SVN in which I cleaned up the directory structure a bit (separating source and game directories, for instance).

There’s also a new feature: evilness can now be run from any directory – the CWD doesn’t have to be the executable’s directory. Another strategy for resolving path names will be in order for linux, but linux building doesn’t work yet anyway.

Posted in the Evilness engine | Leave a Comment »

D enums != type safety

Posted by randomz on June 28, 2006

I’ll post here the last post from my old coding blog, since I just wrote it a couple of minutes ago:

Copy & Paste struck on me again, as it often does. I had written a function to take a Sofu.Encoding.Encoding enum value (which is one of the possible Unicode encodings) and return the endianness that will be used by that encoding, as an Endian enum value.
However, I had pasted this from code that used’s BOM enum type. So, I had written:

switch(encoding) {
  case BOM.UTF16LE: case BOM.UTF32LE: return Endian.LittleEndian;

Of course, I should have written

switch(encoding) {
  case Encoding.UTF16LE: case Encoding.UTF32LE: return Endian.LittleEndian;

This actually caused little and big endian to be exactly reversed.

I guess this is a serious downside of having the enums be actual int variables. The compiler wasn’t able to see that I was comparing an Encoding enum value to a BOM enum value.

Oh, and BTW, the SDL_mixer bug has been fixed and I was able to check the new DLLs into the Evilness SVN. 🙂
(Not that anything has changed over the old version…)

Posted in D, Sofu, the Evilness engine | Leave a Comment »