Sunday, February 21, 2010

No Singletons!!!!!!!!!!

I was skimming the blog C0DE517E, and I ran across an interesting post on why singletons are bad. I love singletons, and I try to use them all over the place. Well... at least I did...

There were two Google Tech Talks I found from the blog and I wanted to share the insight I learned from them with you.

The first one I watched was “The Clean Code Talks - 'Global State and Singletons'”. It really kind of blew my mind. The video actually plays right along with what you are thinking. If you don't already agree with the idea of no singletons, then I strongly suggest you watch this video:



I took away several different things, but I thought I would post the most important one here. You should only put things into a constructor for which that object is directly dependent, but conversely, always put all things that object is directly dependent on in the constructor. This means that your class should usually not new any object and should never access any singletons inside the constructor. Your object should not hide dependencies as this makes them hard to understand.

The speaker seems be talking from a testing perspective, but I can see how these things can help keep your code understandable and more stable. Basically he seems to throw everything I've done in my current graphics engine into the garbage, but I feel like I've learned quite a bit. I'm always trying to clean my code and make it more understandable, and to my detriment, I'm maybe even a little OCD about this.

You may still have some questions or not fully understand after watching the above video, so I found another video that really helps to explain in more detail how to clean your code. It is done by the same speaker, Misko Hevery. Here is “The Clean Code Talks - 'Don't Look For Things!'”:


Thursday, February 18, 2010

My Sophomore Game

I was reminded recently by talking to one of my instructors that I really need to update this page.  My goal here to show off stuff that employers can look at, so I'll dig back into history and pull out Muzika!  Muzika was my sophomore game.  Muzika was an arcade-style rhythm game.  Me and my teammates played Rock Band together quite often and wanted to replicate the fun we had.  Our team wasn't all fun and games though, we did lose and gain several team members throughout production.

We originally started working on the game over the Summer.  We had wanted to get a head start over everybody else, and for that reason we created our team probably before anybody else, well into the Spring of 2008.  We worked over the summer hammering out multiple concepts until we arrived on a game similar to Geometry Wars.

At the end of the Summer we were ready to start working on the game, but then the turmoil started.  One of our members was accepted into the Masters program at DigiPen, so we had to acquire a new teammate.  We decided that it would be best to change our game concept because it was still hadn't started coding, and we believed that if everybody had input into the idea they would be more motivated.  This was fine until our new teammate decided to change his degree.  I am glad however that he did pursue his real goals.

Finally we gained Tony Feist to save the day!  With inspiration from Tony, we came up with our new game concept that was a cross between Guitar Hero and Audio Surf.  My responsibilities on the new game team were to program the graphics engine.  This included programming the rendering, particles, UI, and text.  This was really my introduction to DirectX and shaders.  I would also like to take a moment to point out that the game was coded from scratch in C++.

We presented our Alpha for Music Off, later changed to Muzika, in December of 2008.  Here are some screen shots:


We started our second semester and learned that we had lost Tony, our inspiration.  Due to unfortunate circumstances, he wasn't able to continue game class.  We then had to refactor our game idea to meet our abilities.  The team was down, but we finally decided on a game that just tried to mimic Guitar Hero and Rock Band.  While we knew it wouldn't be possible to match these games, we still knew that our refactored goal would be much easier to obtain.  Later we acquired our artist, Jennifer Gilliland, who really helped to give our game its amazing look and feel.  We pushed on until the end of the second semester playtesting and polishing our game.

I feel like we learned a lot from the team troubles.  Even with any conflicts, I am quite proud of what we achieved.

Final Game Credits:
Keith Leung: Producer, Game Architect, Input, Tester, and Note Char Designer
Joanna Leung: Designer, Game Logic, Sound, and Tools
Jennifer Gilliland: Artist
Michael Alling: Art Director, Graphics

Here are the results:
Enjoy!




You can download the game here:
Muzika Download Page