Geeks With Blogs

News

Series

Add to Technorati Favorites


An Archived Managed World This blog has moved to http://www.managed-world.com/blog

[Crosspost from Managed World]

Late night inspiration! Sometimes I really love these kinds of moments. This one came to me as I was trying to get to sleep (and apparently my brain didn't want to let the problem go :)). One of the problems I discussed in an earlier update was that, for some reason, the Irrlicht .NET wrapper decided to implement all "interfaces" (ISceneManager, etc.) as classes, some of them not even containing default constructors. The heart burn this caused is that I'm not able to Mock and Unit Test my master TanksApplication class unless I go through all the trouble of taking all the Irrlicht "interfaces" and wrapping up my own interface-based facades around them. For this type of project, I didn't really want to go through all that hassle.

I guess something my brain saw during all my effort of getting Blender-exported .x files to work came to the forefront. Basically, I remember seeing when starting up the Irrlicht MeshViewer application that Irrlicht has actually implemented a "NullDriver" along with the other drivers (like Direct3D9, OpenGL, etc.). I tried it out in my application and it's pretty cool. It basically is a fully functional IrrlichtDevice but doesn't drive the graphics card. This will enable me to create a mock object that I can pass in and drive the TanksApplication with (by having the mock class be driven by the NullDriver and returning the actual Irrlicht classes rather than mocks themselves).

The "so-and-so" aspect of this is it's not necessarily a "true" mock object, but heck, it will work so that makes me happy right there. The other unfortunate side effect is that the unit tests in question will be tied to Irrlicht as well but that should be alright as making this application graphics-platform-independent is out of scope :).

I really get a kick out of some of these "a ha" moments :).

In other news, I have finished the unit tests around the GameEventParser class. All in all, I have increased code coverage from a dismal and depressing 15% to around 35% (still quite low, but a lot better than 15%). By the time I wrap the Console class up in unit tests (and the TanksApplication class after my late night realization above), I should be sitting above 50% which will put my mind more at ease with the state of the code base.

Now I'm back to trying to get to sleep (if my mind lets me), so I will chat with all y'all l8r (had to get at least one hackish expression in there ::grins::)

Peace out!

Posted on Tuesday, May 2, 2006 6:35 AM Game Development | Back to top


Comments on this post: Tanks - Update 4

# re: Tanks - Update 4
Requesting Gravatar...
Those moments are what make programming (and problem-solving in general) so much fun.

I haven't had one of those in a while though, :(
Left by Ben Scheirman on May 02, 2006 9:25 AM

Your comment:
 (will show your gravatar)


Copyright © Jason Olson | Powered by: GeeksWithBlogs.net