Sebastian\’s Coding Blog

  • Categories

  • Advertisements

Archive for the ‘D’ Category

Sofud 1.0.alpha.2 released

Posted by randomz on March 20, 2008

The biggest change in this release was the switch from Phobos to Tango. In the process, the List and Map classes were changed to implement Tango container interfaces. Unfortunately, some of that code isn’t yet well tested and well documented, so please report any bugs you may find. You can find the release in the file release system.


Posted in D, Sofu | 1 Comment »

Sofud now works with Tango

Posted by randomz on July 11, 2007

I just commited the changes to Sofud that make it work with Tango instead of Phobos. As expected, it wasn’t really difficult, just annoying. Writing I/O code is pretty error prone if you’re working on the level of Tango conduits and trying to support all Unicode encodings. Debugging was the really tough part of it; most of the conversion was done with a couple of find & replaces.

I shall release this version as 1.0.alpha.2 as soon as I feel like it. Right now, I’m too exhausted from bug fixing. :o)

By the way, I finally found a nice text editor that can correctly handle any Unicode encoding. It’s a small freeware called BabelPad. To my puzzlement, most editors out there can only handle UTF-8 and UTF-16, even though UTF-32 has been around for a long time now.

Posted in D, Sofu | 3 Comments »

Sofud will be using Tango

Posted by randomz on July 8, 2007

I’ve finally had an opportunity to try out Tango. As it seems like I’ll be using it for my game project (details to come… maybe), I’ll switch Sofud over to Tango.

As I don’t have the energy to create and maintain a dual version, there will be no Phobos support. I think this is better than the other way round, because I already feel that Tango, although the documentation isn’t complete yet, is more complete and better designed than Phobos.

I hope moving to Tango won’t be a big problem, so I plan to do it within the next week or so. After that, an alpha.2 release may be due.

Posted in D, Sofu | Leave a Comment »

Trying out GDC, but Bud does not agree

Posted by randomz on April 6, 2007

I spent too much time today trying to get Bud to work with GDC under windows. GDC works fine, and installing it was actually pretty straightforward: Installing MinGW, installing GDC via the installer, and then installing ActivePerl in order to be able to use the ‘gdmd.bat’ perl wrapper script for dmd command line compatibility.

What followed then was a bud error and reading through the (terribly unorganized) bud docs in order to find something. Having found nothing, I tried the bud forums, which promised to be at least of some help. I created a build.cfg file and spent about two hours trying various settings, finally managing to compile my source files. But I still haven’t moved bud to link the resulting objects to an exe file.

Actually, this isn’t my first time fighting with bud (formerly build). My recent attempts to use bud on linux (with DMD at that time) also have been only partly successful. However, there seem to be people who have accomplished using bud on linux.

I think build is a wonderful tool. But it’s a shame that development seems to have stalled (the SVN repository hasn’t been touched in almost half a year) at a phase where there still are many unresolved problems. I think the build tool is pretty central to the D community, so maybe it would be good to have a larger (non-one-man) team to make it a more mature, better-working tool (and to improve the documentation!!!).

In fact, I feel I would like to contribute to the project. Still, I’m afraid it will eat more of my time than I can bear, so I will give it some more thought.

Posted in D | Leave a Comment »

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 »

build & linux

Posted by randomz on June 28, 2006

I just tried to check out and build the Sofud code on my Debian Linux system. While building build itself worked fine, building the Sofud test program posed a problem. Build ended up putting the object files to each module into the current working dir, in which test.d also resides, instead of the Sofu subdirectory, where the Sofu source files reside. For linking, gcc looks for them in the Sofu directory, and fails.

However, I also haven’t been able to link them together manually, or build the program by hand using the dmd compiler, due to some unresolved references (despite linking libphobos.a in)… but I guess I’ll look into that again once the build problem is fixed.

It’s a pity that setting up dmd on linux is such a pain… although there must be people using it…

Posted in D | 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 »