Pages

Wednesday, May 18, 2005

I have taken apart the toaster . . .

and now I sit on the kitchen floor surrounded by unidenfiable parts and wondering if I'll ever eat toast again. This sums up the current state of my project really. I'm putting it back together in a much cleaner fashion though. I'm in no hurry with my project and I think this is an important point, I have time for such luxurious fiddling, I have all the time I want. An detail to keep in mind with a hobby project or you might get burnt out.

As I go I notice small bugs that would cause havoc later on and be really quite hard to spot. I've actually worked on getting myself organized too so I have a todo list and a method. I don't think there's any point in posting about my method until I proven to myself that it works (and then it will only be that is works for me). I am still wrestling with a GUI system and I've decided something small and hard coded really isn't going to cut it - I need something reusable and quite seperate from my project.

So first question is - has some one else done this for me? Well microsoft has - they have the framework - which to me is a big rusty cage of cogs and springs in pot of green bubbling slime - it's all voodoo (I have little practice reading others code, it's something I need to work on) with little documentation. I guess it's easy to use but you don't know why you're doing things a certain way. If you don't know why you are doing certain things bugs are always going to seem extra intimidating. Their GUI system on the face of it looks very nice and all the source code is there (so you can work out why if you're determine - but for reading code I prefer printed and alas no printer). So I may steal bits of it once I have the foundation of my own system up and running. As I'm not using the framework then that's the frameworks GUI pretty much out.

Well second there's a book called "DirectX 9.0 User Interface Design and Implementation". It's not an awful book but it's not good - it could have been at least half the size for one thing. It really does waffle on at the start about things that anyone buying this book will almost certainly know - who starts learning DirectX by creating their own User Interface Library - no one! It would probably sell more by reducing the price and size. The descriptions of the actual code are pretty brief too, he doesn't describe what everything is going to be used for. This, of course, is no problem to look up as you write but surely the books purpose is to explain this kind of stuff. He doesn't give a reason why his design is this way, why not to do it another way - that's really what the book should have had to make it good or even excellent. At the moment it's more like a code repository. The following quote really sums it up for me:

Nowadays, in a world of skinnable apps like media players andinstant messengers, users can customize the look of their controls suchthat they are non-rectangular. This can be implemented in Direct3Dby using alpha tested textures. However, this is an advanced topic thatis beyond the scope of this book.

Surely this is the exact scope of this book. Everything and everything about DirectX GUI's is what should be covered especially using alpha blending as it's it so basic. And we all want to use non-rectangle controls in a computer game!

Despite this the code seems to work and probably works very well. It's written in C++ but I assume most C#er's aren't going to find this a problem as they've probably programmed in this too and conversion is a snip (infact the code I've written looks a lot cleaner but I think that's just an intrinsic advantage C# has over C++ which tries to straddle both worlds of OOP and C-procedural). If you're looking for a GUI solution, at this point in time, it's defintely worth a look. There are also a number of articles over at GameDev but I didn't find the design philosphy to be my sort of thing at all. Still worth checking though!

"So first question is - has some one else done this for me? Well microsoft has - they have the framework - which to me is a big rusty cage of cogs and springs in pot of green bubbling slime - it's all voodoo ... and so on" - there's some further ranting, I think I make some attempt to justify my opinions.

I feel more comfortable rolling my own at the moment. I don't want to force my current codebase into the new Microsoft framework (though I'm sure this is a worthwhile thing to do. It's best practices and all that and it has all the advanatages that come with well tested, widely used code).

Apologies. Very true. I have little practice reading others' blogs. It's something I need to work on.

I must confess, when I first began with C# (3 yrs ago) the CLR looked menacingly large, and I was reluctant to learn it (MFC & C++ would suffice thought I). Currently I'm a complete convert. The CLR has since become much less intimidating, and I revel in its ease of use daily, especially due to good documentation and in combination with a great tool such as . I'm not disagreeing with your decision - especially, as you point out, one wants to understand all one's own code, and it's hugely beneficial to learn by doing. However, I wouldn't completely discount the value of a] using available tools where possible; and b] learning from others (and their code). But that's just me, and forgive my intrusion into your blog!

But with reference to my own experience of b] - thank you for all your postings, especially on c# game dev - it has certainly inspired me to recommence my own efforts in this respect (the aims of which bear marked similarity to yours).