About Gallery SF.net Project Bug tracker Downloads Forums Manual Wiki DevBlog News

Archive for July, 2010

Movies… at last!

Monday, July 26th, 2010

About… er… wow. 2 years ago.

About 2 years ago I gave news about the “upcoming movies support”. It was “soon to be ready”. Well, soon meant 2 years it seems.

You all know how it goes, I guess. One gets inspired, one gets all the right ideas, starts coding, gets 90% there, then real life decides to throw you a curve ball. This time was no exception.

Curve balls come in two flavors: unexpected (or expected but unaccounted for) time-consuming real life stuff. Like school, work… girlfriend ;) … all that which threatens to seriously reduce commitment to any coding project. And, of course, unexpected (or mispredicted) time-consuming coding tasks.

Movies had both of those.

Let me recount the experience a bit.

In my last post 2 shameful years ago, I conveyed my intent not to rewrite the sound system. Really, it would be a huge task for the little time I had left - though it would certainly be a fun task, for me at least - so, in order to get things rolling out ASAP, I said, I would resist the temptation to rewrite the sound system. It turned out harder than I thought.

Getting streaming within VS meant hacking the main loop to perform either threaded or multiplexed reading from several audio streams (yep guys, I was, am, committed to supporting multiple streams playing at once - it’s pretty much required for many of the interfaces I have in mind). The existing sound system in VS had no place in the main loop, so I would have to write bookkeeping routines and data structures from scratch. The more I studied the idea, the more I realized that I would be, essentially, writing a parallel sound system from scratch.

So, eventually I said: “heck, I won’t write a sound system twice - lets start the rewrite, it won’t be less work than trying to hack streaming into this”.

So I did. I started the sound system. I drew inspiration from Ogre’s design, BTW. Thanks sinbad (I really learned a lot from Ogre).

I must say I went straight to the point. In contrast with my attempt to embrace Ogre as VS’s rendering engine, case in which I overdesigned quite a bit, more than once, in this case it was the complete opposite. I designed the minimum functionality to get what I wanted, but always leaving the door open for extensibility (and the features I really really wanted - but weren’t really really needed). In fact,I found myself refactoring things several times because the design fell short in this or that aspect. So I can’t blame the lengthy time it took to roll this out on overdesigning as with the Ogre port. No… this was just a lot of work done in really really short bursts spaced perhaps weeks or months apart.

Which brings me to the other curve ball: real life. I got busy at school. My dad got sick. I left school. My dad got better. I got back to school. I got really busy at school. In the meanwhile, I worked 12 hours a day or so. I traveled a lot too (though this part was fun :D ). I don’t know what else - oh ya, at one point I had two jobs, and no energy left (one coding, one teaching). Real life conspired in a way that I could dedicate only a few hours time, perhaps once a month or so. I’d get nice full weekend sprints every now and then, but I would waste a lot of effort trying to find out where I left. A real waste.

Then came Trac. Our friend chuck_starchaser installed trac in his server at wcjunction, and boy it helped. It so happened that I was very used to working with trac at work, so I started organizing myself just as I did at work. Suddenly, the little time I had really paid off - if I wanted to know where I had left, I would simply log into trac and check. I love trac. Ya, it’s missing a lot of features, but it’s so useful.

Then came testing time. Lipsync issues, crashes, segmentation faults, it didn’t build in windows I think at one point - minor stuff anyway. All expected, in fact. After all, who writes 8700 lines of code that work flawless from the get go in multiple platforms? who writes 8700 lines of code in two years, btw? 12 lines of code a day. That’s snail pace - I guess a lot of thought went into each line ;) (I sure hope so).

Yeah, you may have noticed I’m ashamed of how long it took me. Lets say that again: I’m ashamed of how long it took me. There.

In any case, the effort, the design, the thought that went into every step, and the sweet time it took really paid off. The final phase (testing) went as smooth as I could ever had hoped. The system isn’t flawless yet, there are issues with slow computers, there’s a lot of room for optimization, there’s still a lot of features to implement, not the least of which are threaded background loading and proper resource budget management. There are bugs. Known bugs to resolve. But the foundation is there, and it works.

Hurray!

So… I have to thank a few people who really contributed to this:

  • chuck_starchaser: you know… without trac I wouldn’t have gotten anywhere. Our talks also shaped the sound system in some of the pending features… with luck, in less than 2 more years you’ll see the features in all their splendor.
  • hellcatv: with the needed windows testing. I can’t even build in windows anymore.
  • sinbad: inspiring my design with Ogre’s design is no small contribution. I just hope mine is up to par.

I’m probably forgetting someone, I apologize in advance. Shenle for instance helped in getting a windows build, and even though the job was finished by hellcatv, getting it started wasn’t small either.

Now… lets put the feature to use?

Note: at the time of this writing I haven’t merged it into trunk - but it’s coming, a helluva lot sooner than the last time I said “soon”.

Klauss++