Getting back to business

I’ve been programming as a hobby for as long as I can remember. My dad built our first computer at his work, a ZX81. Back then there wasn’t a whole lot to do with a computer other than to write your own software. The ZX81 came with BASIC in rom, and a manual with all kinds of example programs. Back in the day, electronics magazines would also publish some BASIC listings, so you could try your hand at typing those in and making them work (every computer had its own flavour of BASIC in those days. They were similar, but various things were *just* a bit different).

So well, young as I was, I tried to understand the basics of BASIC… Later I got a Commodore 64, where it was MUCH easier to get software, mostly games. But still, I would occasionally do some of my own programming, just as a hobby. I was mostly fascinated by visual effects, scrolling texts, flying objects, some nice chip music etc. When I got an Amiga, it got a bit more serious, because even in BASIC you could actually do some reasonable graphics and audio stuff, and more powerful languages became available. The phenomenon known as the ‘demoscene’ came into existence, where visual effects were no longer just used as an introduction from the person or group who cracked the software (‘intro’ or ‘cracktro’), but they became standalone pieces of art.

I wanted to do stuff like that myself, and I’ve always had some kind of hobby projects going. Later I went to university to become a professional software engineer. So in a way, I turned my hobby into my profession. However, even during my studies I continued doing hobby projects on the side… mostly because the stuff at university often wasn’t as challenging or wasn’t really in my area of interest. In a way it paid off as well, because I had a lot of experience in some areas, and things like the graphics courses at university were really easy, because I had already figured out and implemented most of the assignments on my own, and I went more in-depth than these courses did.

When I left university a few years ago, and started working fulltime, I lost interest in hobby programming. I didn’t have that much spare time anymore, and I already spent the entire day writing code anyway. I suppose I had to adjust to this new way of life anyway.

But sadly the things I have to develop at work are often not as interesting as most of my hobby projects either. In fact, most of the time I find myself having to add functionality to existing software, a lot of which is of pretty appalling quality. What makes it even more boring is the fact that there usually is little or no documentation, so I have to write documentation for things I didn’t even write in the first place. Things I would be too embaressed to have written. However, I do become responsible for that code this way. In fact, I sometimes have to add functionality to a piece of code which turns out not to have worked properly in the first place, so I have to redesign and fix the application on top of adding the requested functionality. And people wonder why projects often take longer than planned. Sometimes you feel like it would have been better and faster to just have started from scratch.

In a way this makes me feel like I’m ‘losing my edge’, so to say. I no longer work out interesting algorithmic problems or solve mathematical equations and such. Aside from that, I don’t really get any satisfaction from most of the things I write. So recently I picked up my old 3D engine again. It hadn’t really seen much use since I started working. Besides, I had achieved most of the goals I had set for myself with Direct3D 9. I did start on migrating the engine to Direct3D 10, but when this turned out to be far more difficult than expected, I just put it aside.

A few weeks ago however, I regained interest in the code. The new DirectX SDK also includes a preview of DX11… I would like to have an engine that can do Direct3D 11. I want to move right from D3D9 to D3D11, for two reasons. Firstly, D3D11 will also support DX10 and DX9 hardware, so a single engine will give you compatibility with a large range of hardware, much like how it was in the D3D9 days. Secondly, D3D11 builds on the new API model of D3D10. So if I have a D3D10 engine, I can migrate it to D3D11 with relatively little effort. Therefore I planned a strategy to first get basic D3D10 functionality going, and then moving straight on to D3D11 as soon as it becomes widely supported (basically all it needs is an update of the driver and DirectX runtime, since it can run on Windows Vista and existing DX9/DX10 hardware).

So I picked up the D3D10 project where I left off a few years ago. It’s a nice challenge to have to rethink some approaches, because of how differently D3D9 and D3D10 work. I’m trying to combine the good parts from my software Java engine and my D3D9 engine into the interface for the D3D10/11 engine. The D3D9 engine was very lightweight, and relied directly on a lot of API functionality. In D3D10 a lot of this functionality is gone, since there is no fixedfunction support at all anymore. On the one hand this means I have to implement more myself. On the other hand, the underlying engine can be very clean and simple, because everything works through shaders. I also have more freedom in how I implement things, as I rely more on my own code and less on built-in functionality. In that sense it’s more like my software engines were.

It actually went smoother than I thought. After only a few days, I had replaced enough of the engine’s code to get basic object rendering and animation working again. In the process I also added support for the DX Effects stuff, which I had previously ignored. Performance seems great, and it’s quite convenient to use, so I may stick with that, even though my engine now also supports ‘manual’ shader handling. Because D3D10 forced me to implement my own stuff, I actually found a few solutions that are better than in my D3D9 engine, and could be backported. I may do that in the future… I’m actually thinking of integrating the D3D9 and D3D10 APIs into a single project, because although the underlying framework is different, a lot of the drawing code in my D3D10 engine looks identical to the D3D9 stuff now. Back in the day I even wrote my Java software engine to mostly behave the same way as the Direct3D8 engine I was developing in parallel at the time… but I haven’t really worked out the details yet.

There are a few more hurdles to overcome to deal with all the renderstates in a nice way. D3D10 only gives you very basic control over renderstates. I want a more flexible and granular way, more like how D3D9 handled it. But that requires me to write my own state machine for that. I’ve worked out the idea in my head, with a caching system for maximum efficiency, but I have yet to implement it. But this is exactly what I wanted though… I’m thinking about problems that *I* find interesting again, and coming up with creative solutions, getting results that give me a sense of satisfaction and accomplishment.

Another thing I’d like to mention is that I started using an online version control system. There’s a bit of a story behind it. I recently ran into an old classmate of mine. We used to code on C64/Vic20/Amiga together at the time, and we were both interested in the demoscene. In a way we started out together with graphics programming and things. Turns out that he has become a VJ, and he started to develop his own software for the video effects he uses in his shows. I may assist him with some of his code in the future. He told me he uses a free online version control system at www.unfuddle.com, and gave me access to his project.

I had played with the idea of storing my code online, but I never really took the time to look into it. Thanks to him, I found out about Unfuddle, and how conveniently it works with TortoiseSVN. So I created a repository for myself as well, and uploaded both my D3D10 engine and Java engine projects. It’s nice to have an online backup of my code, and it’s actually quite convenient since I sometimes like to develop on my laptop rather than on my desktop. Instead of having to copy the latest code from my desktop to the laptop, I can just get a code update straight from Unfuddle. It’s much easier to keep two or more systems in sync now. I can recommend it to anyone.

Well, that’s enough for tonight I suppose…

Advertisement
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s