Tuesday, February 26, 2008

R.I.P. HD-DVD

This entry was originally published at Ken Noland



So the format wars appear to be nearing an end, with Microsoft following Toshiba in dropping the HD-DVD spec. BluRay wins! This means that yet again, Sony has won another format war…


This has got to come as a blow to the XBox which has a solid and steady following now, but nothing compared to the PS2. Is it possible that the next gen console battle is far from over and that we are about to see a turn of events based off this recent decision by Microsoft?


-Ken Noland


Death to EA!

This entry was originally published at Ken Noland



There, I said it…


I am one of those people that truly believe that competition forms innovation, and right now EA doesn’t really have any competition. In fact, how could they? They own the rights to most of the popular sports titles and they crank new ones out every year and charge the same high prices just so you can get that slight bit more detail, or the updated roster for your favorite sports team. There’s no gameplay innovations, no desire to either.  Maybe I’m just a game snob, but seriously, how many times can you re-release the same game only with updated graphics?


EA has a long history of good business, but bad games.  If it wasn’t for Will Wright and his series of sim games, EA wouldn’t have a single edge in any other market aside from sports. Yeah, sure, they’ve also done the Command and Conquer series, and they also released the box set of the digitally distributed Half Life 2 series, but I can’t see very much from this gigantic publisher.


Okay, so now that I’ve got that out of the way, let’s talk a bit about the recent EA and Take-Two publisher takeover. EA discretely sent a letter to Take-Two announcing it’s plans to enter into negotiations for a purchase, at which point Take-Two denied EA, saying that this was not the right time and that EA significantly undervalued the company. EA got pissy and posted a letter of intent on their website, saying that all Take-Two stock holders needed to know about this. At which point Take-Two replied with another public letter… come on kids, grow up!


I don’t mind the rise of Take-Two at this moment. I believe that if Take-Two can put the scare into EA, then at long last we might have some innovation. With Take-Two’s new football game and basketball game coming out, EA might have to think about investing in some new features for the Madden series, which we all know has grown a bit stale lately.


Take-Two said that they would be interested in continuing talks with EA after April 30th, which happens to coincide with the release of the next Grand Theft Auto series. We’ll see more at that point, I’m sure of it!


-Ken Noland


Thursday, February 14, 2008

DirectSound Notify

This entry was originally published at Ken Noland



There are many times during the course of audio development that you want to do something when a particular sound has reached a point in playback. You could time things so that it appears that the sound is progressing with the events in the game, but then you could run into synchronization problems, especially with dynamic streaming environments where things are constantly loading and unloading and stalls, although undesirable, are very common. You want to time those events based off the audio playback and when a point is reached from within an audio signal, you want to trigger the event immediately.


I first built my system in DirectSound to have looping fixed sized sound buffers and I would fill those circular sound buffers with data as the sound progresses. This worked like a charm. Of course there were a lot of niche cases I had to deal with, like clearing trailing samples and monitoring when main thread stalls would occur so that I could remove the looping sound, but this article is not about that, this article is about how to generate events based off the playback of the sound, and do it efficiently!


DirectSound has an interface called IDirectSoundNotify8. This interface allows you to set markers in the sound and have those markers trigger events when they are reached. I thought I had found the answer to all my problems. I quickly started up a second thread and created the events. I then set the notifier to the offset when the update would come through and then I sat and I waited… and nothing came through. It turns out that you can only use the notify interface when the sound is stopped, which is very poor since I can’t do any dynamic event triggers.


I sat and I pondered a moment. There has to be a way of synchronizing the sound to dynamic event triggers, but how? Playback is not constant and so doing some sort time based trigger wouldn’t provide the accurate results I needed. I needed the event to be triggered on the exact sample that I provided, or at least within some sort of tolerance because of the nature of threaded applications and the speed of sound processing. But how?


It was then that I realized that there will have to be some give and take. I have to give up a little accuracy to gain the performance that I wanted. What I ended up doing was setting up a thread that checked the progress of the sound every 200 milliseconds. When it determined that there was a dynamic event ahead of it, it would analyze the average playback frequency, retrieved by monitoring the playback position and comparing it against the time progression, and do a rough approximation of the time, and then set the event trigger at that time. The would give me much better results and far more accurate synchronization because of the variable frequency of the playback and it would still be directly synced to the audio, but perhaps not on the exact sample, it would be close enough…


-Ken Noland


XACT and All It’s Glory

This entry was originally published at Ken Noland



Microsoft has put out some bad stuff in the past, but this one I noticed the most since it directly affected me and was in the area that I work the most. XACT was promised to be a cross platform audio system with built in authoring tools. It promised all sorts of bells and whistles that, as an audio programmer, I rejoiced at the thought of never having to write that code again. I was hopeful that this would lead to the end of my nightmares having to build caching algorithms and streaming rules for audio, but this turned out to be totally false.


When I first heard about XACT, it wasn’t through any forums or any knowledge base article, but it was because I wanted to look something up in the DX documentation and I noticed three new branches in the documentation tree for XACT. I got curious, so I read on in the hopes that maybe I had just stumbled upon something great. As I was reading, things kept sounding better and better. XACT is supposed to be a complete toolset that would allow the audio designer the flexibility of being able to take control of all things audio related. Awesome!


I put those articles aside, because of all the things mentioned in the XACT features, I had already implemented my own stuff so why switch to an unknown tech if you already have something that does it anyway. I watched for any further news about XACT, but I never saw any.


I have always been a big fan of Total Annihilation and the two smaller add-ons and the army of massive mods developed for the game. As such, I eagerly awaited the release of Supreme Commander. Like most people who waited for that game, I watched the trailers for it in awe, thinking that this will easy trump my favorite old RTS game. When it came out, I installed it and started playing right away.


Being an audio guy, I winced when I heard the first pop, then the second crack. The sound just continued to degrade from there and there was no end in sight. I carefully reduced my settings so that I can diagnose if there was a problem with my rig, after all, I am a developer and as such I have several custom things installed on my machine. I methodically went through and checked everything I could think of before diving into the internals of Supreme Commander, but I couldn’t find a thing wrong with my system.


It was at this point that I noticed something on the message boards. Turns out that other people are having the same problems. Some people, in fact a large amount of people, didn’t have sound at all! I decided I would help them out and see what I could diagnose on my end. I ran a simple profiler to determine what was going on only to be horrified that over thirty percent of my performance was going to XACT!


Thirty percent is a large number for an audio system. In a game like Supreme Commander where you have physics and graphics driving the game, the audio should take a back seat to everything else that is going on. It was at this moment that I realized something; their hard drive usage was off the charts!


I ran a tool from SysInternals called filemon. I targeted Supreme Commander to see where all the hard drive usage was going to, expecting to see a lot of texture caching and so forth, but was horrified when I saw that all the file reads where coming from the XACT wave banks. The strange thing was, it appeared as though XACT was requesting the same data over and over again, every frame. It didn’t make any sense to me, so I dug in a little deeper to see what the structure was for the wave banks.


It turns out that the hard drive read times where greater then the amount of time being spent per frame so audio would lag behind. When audio lags behind, it gets cut. Instead of softly attenuating samples on this event, XACT just leaves the samples set to 0. In audio programming, audio is perceived as the difference in samples and hence the reason why an audio file is constantly oscillating. If you zero out a buffer at the time of a peak oscillating value then you introduce a pop or a tick. Since the hard drive wasn’t able to keep up with the audio demands, audio files would pop and tick almost constantly.


Okay, so curiosity got the best of me. I started talking with some of the developers over at Gas Powered Games to determine if there was anything I could do. Turns out that they are aware of the problems with the audio system, but now that the game is released there is very little they can do about it because XACT uses a proprietary audio format with an unknown compression algorithm.


I told them I could crack it…


In order to crack it, I had to become familiar with the publishing tools they use. I opened up the XACT Authoring tool and began creating my own wave banks. Once again, to my disappointment many things that were promised in the XACT documentation where often times very difficult to find or simply didn’t exist.


Sure enough, I cracked it. It took me a little longer then 2 days to break the format, but I got it all now, right down to the modified ADPCM compression they are using. I created a tool called XACTXTRACT and published it on their forums. GPG was stunned!


I had laid the foundation to change their audio system without the need to download over a gig worth of new content. Did they change their audio system even though they knew the flaws within the XACT format? No… they continue to use it to this day! It’s really too bad since because of XACT and it’s proprietary format, average users don’t have the ability to add in their own sounds, and for a game taunted as the most modable game ever developed, that’s a very severe limitation!


I gave up on XACT completely, never looking back and never thinking about the horrific adventure I had while trying to fix a game that I thoroughly enjoyed. I gave up on Supreme Commander and Forged Alliance, disappointed that they would abandon so many of their fans because switching the audio system was too much of a risk.


Bah! Without risk, there is little to gain!


I was recently in Seattle with a friend of mine at a local bar. I grew up in Seattle, so I knew the neighborhood well and I looked forward to relaxing and drinking a few beers and just having a good time. A friend of his showed up and he introduced us. It didn’t take long before I found out that he was one of the QA guys working on XACT at Microsoft. I told him my story…


-Ken Noland


Friday, February 08, 2008

The Book

This entry was originally published at Ken Noland



There’s something strange about opening a book and seeing your name in the credits. Much like a video game credit, it has a similar effect. My first instinct was to grab the book and show it to all my friends, just like a video game credit. I did so, to a couple select friends and lent my other two copies out so that they could see it in person, as well as read the other articles written in there.


I’ll be honest, I’m not very happy with how the article came out. I could’ve done better, but perhaps with the time constraints that I have on me, with work and all, I did what I could.


It was a very strange editorial process. I sent my initial draft in, recieved some minor requests for adjustments, and then sent the final draft in. I never heard a word back from them. I waited and I watched my email for some sort of notification, or perhaps some peer articles that I could review, but nothing came through. I sat and I waited.


I went home a few days ago and my roommate pointed to a large package that was left for me. I opened it up and there were three copies of the book. I couldn’t believe it. It was really that easy!


The book is titled Game Programming Gems 7, published by Charles River Media and edited by Scott Jacobs. My ‘gem’ is titled ‘Real Time Audio Effects Applied’.


-Ken Noland


Monday, February 04, 2008

It has Begun

This entry was originally published at Ken Noland



So this is the first post on my new website. Welcome!


So I installed Wordpress, got the Gallery2 component running, downloaded and installed several templates and this is the template I’m going to run with for now. I already tweaked it a bit, but I’m going to leave the authors name and of course leave the “Powered by Wordpress” at the bottom to give those guys some pleasure if they ever end up on my site.


In the mean time, I am writing some articles that range from very basic programming to advanced technological papers. I don’t have anything that I’m comfortable posting quite yet, but as soon as they are finished I swear I will put them up.


I’m looking forward to this new website in the hopes that it can be a collaborative place to dump my thoughts and also a place where I can enlighten people as to the mystery of what I do and how I do it. I look forward to keeping this website up to date as possible and I will continue to improve it as time goes on.


Thanks

-Ken Noland


A Vector Class

This entry was originally published at Ken Noland



I just wrapped up the first article I’ve written for this website. It’s about how to create a vector/point class utilizing templates and operator overloads, as well as a slight trick at the end to allow for some sort of polymorphism on the templatized vector class. It also goes into detail as to how a compiler treats a compound statement utilizing operator overloads, and that was something I found missing from a lot of vector/point tutorials.


Keep in mind that this is the first article and as such it should be treated as a learning tool for me as to how to write these articles. Please feel free to comment and add suggestions. If, at any point, I’ve confused you during the article then please let me know and I will attempt to revise it so that it becomes a little more clear.


You can check out the article here


This is all building up to a complete article I am going to be writing about how to write a car simulation. I choose a car because it illustrates almost all of the basic functions required for game programmers. It involves physics, graphics, and simulation knowledge that when fully understood will assist any game developer in doing any number of the above topics.


Thanks,

-Ken Noland


Content Management Systems

This entry was originally published at Ken Noland



I’m not a website developer, but in the course of writing this website, as well as the website for Whatif Productions, I’ve found an area of website development that is seriously lacking in any formal open source tools. Content Management Systems!


When I think of a website, I see pages, pictures, text, and everything all wrapped into a nice little package and I should be able to manage it all from one nice little user interface. This would traditionally be known as a Content Management System(or CMS for short). When I do a search for the most popular open sourced content management systems out there, I find Joomla, Drupal and a host of other hack and slashed tools out there.


When I first settled on using Mambo(the predecessor to Joomla), I found myself in what appeared to be heaven. The administrative panel looked nice and shiny, with all sorts of tools and widgets to allow me to tweak all sorts of things, but as I dug deeper into the source to develop a simple website I kept running into problems after problems.


The first problem that I ran into was that I couldn’t develop a hierarchy for the website. Sure, I could split things into categories and then into sections, but that only allows me a fixed depth to the website. That’s not what I wanted, and that seams incredibly shortsighted for a website to be fixed with just that level of depth. I had to rush to build my companies website. I knew Mambo the most, so I went with it.


I briefly took a look at Joomla, the successor to Mambo, but once again, time constraints put me in a crunch mode and I had to get Mambo up and running quick. Joomla was only at 1.5 at the moment and still had all the limitation of Mambo so I had to pass simply because I would rather fight the demons I know then to confront the unknown.


I was fixed to this concept that everything had to be contained within categories, and then further subdivided into sections. Fine, I’ll go ahead and set that up! When I did that, I noticed that links where automatically generated from the categories to the sections and from the sections all the way to the individual content items. What I noticed then was the display parameters, which is the individual options for how that page is to be displayed, is pulled from the main menu! What this means is that in order for me to hide and/or display certain features from within a page, I had to include it in a menu and set the viewing parameters from the menu… huh?


Okay, so that made no sense to me whatsoever. A page viewing parameters should come from the individual page, not the menu. Sure, you should be able to override the display properties from the menu or whatever page is linking to it, but it should not be the default display properties. You should be able to set how that page is displayed from within the page itself, and then if you want to change how that page is displayed, you should be able to override it in the link via display property templates, or something like that.


Okay, I’ve said enough about Mambo. Joomla is no better since it is derived from the same source base. Drupal didn’t have the support we were looking for and so that wasn’t an option. Once again, I’m cornered with a half assed solution and I’ve got to get it working!


After fighting with it for a little over a month, I finally got it working with all the bells and whistles I wanted. It has Gallery2 integration, RSS support, administration from one simple user interface and the ability to synchronize between our development site and our live site. With some magic, I was even able to fix the dependency on the menu links to set the viewing parameters… but that was a fair bit of work.


So here’s what I propose…


When I think of a Content Management System, I think of something akin to an operating system. The basis of an operating system is to be able to handle files, and those files are then read by programs and the programs interpret the data and spit out the necessary stuff to the output device(your monitor). Video games have complicated structures to allow for content management, such as dedicated resource managers, memory managers, file managers, and so forth, all custom tailored to work from within an OS that contains… you guessed it… files! Now, taking the example of a video game engine combined with an operating system and applying that to a website development platform, things become very interesting very fast.


If you consider that the basis of a website contains text and images, and if you save those text and images in folders then you have a structural hierarchy. Now those text and images can be opened via ‘applications’. I’ll get back to applications in a little bit, but first I want to talk a bit about text and images.


Text also needs to conform to locality, which is basically the translated version of the root text. You have a default language, and that is your primary text id, but what if you wanted English and Russian version of the same text. It wouldn’t make much sense to add another text item specifically for the Russian version and setup a separate structure, so a text object also contains all of its own translations as well, and the same goes for images. Passing in the locality is just a parameter to the text object.


Say we’ve setup our text and images into a nice little structure, but what now? All we have is just text and images. This is where the applications come in. The most common type of application is going to be the ‘Page Viewer’.


The Page Viewer application takes a page file, opens it, applies the template to the contents of the page file, and then spits the results back out to the client. Easy enough, see?


So now we introduce two new types of file; a page and a template. Lets discuss templates for a little bit.


Templates define general areas that text and images go. In the example of my website, I have a header, a sidebar, a footer, and a main text area where you are currently reading from. The header contains my name and a brief sentence about this website, as well as a menu that you can navigate to and from various pages on this website. The sidebar contains tools and widgets that the end user can use to navigate around my website. The footer doesn’t really contain much, just a link to Wordpress and the template designers. Let’s discuss this using my website as the example


Since a template defines areas, then the top area would point to a common text object that would appear on every page, otherwise known as a template static text region. This would be able to be edited via editing the template. The menu would be another area that the template defines. The menu is a separate application that opens a menu file and spits out the resulting menu in a manor that the template can understand and then translate into HTML. The same holds true for the sidebar widgets, which the template requests those applications and then translates that to display it.


What about scalability? What if I wanted to browse the site using my cell phone? The Page Viewer would then need to select the appropriate template per each page object, and each template will contain a list of supported browsers and necessary extensions to run that template.


Template areas can be predefined with default stuff for the different areas, but the page file should be able to override those and populate the template with further information if necessary. The same holds true for the HTML headers (the title, and other various meta data that some search engines utilize), the template manages that data as well, but the page can override or append any other additional information in the headers, according to the template rules.


So the page viewer can only open page files and these page files are contained within the predefined file system. The page also opens a template file which then can point to any other type of file, but the main section of the page is the text contained within. Text can link to images and tables and further text objects, so we start to see where things become dependent. Dependency mapping is marked inside the file system so that things can not be arbitrarily moved and deleted without the appropriate action being done on the dependent object list.


Revisioning is also important. Being able to revise an object and also see any previous revisions can also be handled by the file system, which also maintains the previous dependencies. Once in a while, it will be good to clear out all revisions, which is another process that the file system will be able to handle and re-link dependency mapping, which is a function of the file system.


Access control rights, or who owns what object and what access other people have to that object is also defined in the file system.


Now let’s talk about forms. In this example, I am running a blog. The Page Viewer then has a link to the Blog Viewer application to fill the main section of the area, but that only covers the display of text, but not the feedback and comments section. The page viewer treats those inputs as Forms. Forms are directly tied into the application that instantiated them and thus allowing two way communication from the website to the individual browsing the website.


I haven’t really talked about administration up until this point because I wanted you to get accustomed to the idea that everything is controlled via applications. You’ll notice that all applications we’ve discussed up until this point are all ‘viewers’, but administration is handled via ‘editors’, a separate class of applications that allow you to edit the components of your website. Likewise, when you see a ‘viewer’, there’s also an associated ‘editor’ and access to those editors is controlled via the file system access control list.


Conclusion


So this concludes my ideal website content management system. I don’t know if I’ll ever have the time to build something like this, but anyone with a couple weeks worth of free time is welcome to explore trying to implement something like this. As a video game programmer, I’m not going to branch off and try to take over a separate industry, only make observations and I hope these observations assist someone out there.


Thanks,

-Ken Noland


Friday, February 01, 2008

Chester!

This entry was originally published at Ken Noland



Chester, the mascot of Whatif Productions, made an appearance at the office today


 

icon for podpress  Chester: Play Now | Play in Popup | Download



Courtesy of Lucas Lepicovsky!


Some nifty new features

This entry was originally published at Ken Noland



Woohoo… Cross posting from my website is working for my blogger and my livejournal account! I can now post, edit, and delete from all three places with one central manager that I control. Woohoo…



The blogspot account and my main page will remain professionally biased, whereas my livejournal will be a place for me to dump my personal thoughts and details about my personal life. In case you didn’t notice though, my livejournal is ‘friends only’.


There are some more features that I’ve enabled on this website that I’m not sure if I’m going to take advantage of. For instance, I have the ability to stream podcasts and regular videos now, but I don’t really know why… I just thought I should add that just in case I might need it it the future.


Enjoy!

-Ken Noland