EAE 6320-001 GameEngII Game Engine Project, Game Dev Adventures!

Assignment 3: Graphics Platform Independence, User Input

NancyNewren_ExampleGame 03

This game has TWO sprites with different effects! Aww, the awesomeness!

(Simple one-click download. Once downloaded, unzip, play the executable, enjoy!)

About the Project

In this project I made the graphics functions platform independent by creating a cView class. This class handled initializing, cleaning up, clearing, and presenting. Then all platform dependent code and variables went into cView.[platform].cpp files.

Thus the call for clearing the back buffer code now looks like this:

//When rendering

I used a color struct to pass colors, and used this to create the pretty gray background (as opposed to black).

sColor lightGray(0.8f, 0.8f, 0.8f);  //alpha is set to 1.0f when left blank
UpdateClearColor(lightGray);        //The UpdateClearColor can be called at anytime to update the clear color

To create a sprite I allowed the user to just send in a center position, width and height — as opposed to several vertices (Simplified):

eae6320::Graphics::VertexFormats::sSpriteVertex center1(0.0f, 0.5f);
sprite1.Initialize(center1, 0.5f, 0.5f);

To create an effect the user need only pass the name of the shader file to the effect:

eae6320::Graphics::sEffect effect1("shader1");

I also added a second sprite and effect so that I could draw in another sprite with different shader data.

Hmm… Interesting Error

We all got stumped on an interesting linker error I was getting early on when making the graphics code platform independent. I have no idea what caused it and it certainly didn’t feel interesting at the time as it sucked up a bunch of my time. I had actually given up on it for the night — I put in macros to the graphics.cpp and moved on to the rest of the game assignment — when finally after finishing the rest of the requirements I caught some problem solving determination, inspiration hit, and finally hit upon the solution: I did function renaming, code manipulation, and the last thing I did was I moved the included  Graphics.h header to be included before the <Engine/Results/cResult.h> header in my cView class. Once I swapped their positions it worked! I cleaned up the code, and then to test things, I moved it back and guess what: still worked! I couldn’t recreate the linker error. The problem was perhaps a couple things, and it’s possible I’ll never know where or what, but it does go to show you that with three friends, determination, and a cool head you can solve a problem, even if you don’t know the exact cause!

Getting it Done

I was initially stuck on deciding how to implement the platform independent graphics.cpp, but once I decided how it should be done the rest just kind of pounded out itself. That’s also about the time Arpit, Zeno, and I congregated and the work went faster, until it got really late, and then it slowed, but it was fun.

Thanks to Zeno and Arpit for helping all night. We helped each other through the entire project and there is no way I would have completed this on time without their help: there was a lot of help going around and everyone helped each other. Zeno is very knowledgeable: he really helped me with structures, architecture, and lots of random issues and C++ nitty gritty questions (It’s great discussing those c++ ideas with him). Arpit is very good at debugging: he helped me solve my shader errors and kept a cool head as I panicked. 🙂 Chen was helpful too: he stopped in for a bit and tried to help me resolve the aforementioned linker error. With everything they all had me try on that problem, it really helped me rule out what wasn’t wrong so that hours later I was finally able to fix it. I have some pretty cool peers.

I love what I do and I love that I get to work with such talented, intelligent, creative, and willingly helpful people. That’s the games industry! From my work at EA, in the EAE program, and in the serious game industry: I haven’t found a better group of incredibly competent, highly skilled people. I love my game dev peeps. They’re the best!

I feel tempted to do a hashtag: #OneLuckyGirl