Saturday, April 28, 2012

Semester Recap and Summer Plans

So the semester is over. It was a grueling semester, but we're done. I celebrated the end of the semester by getting all four wisdom teeth removed. So here I am, immediately post-op writing a blog post, because hey, why not. Aside from the fact that the bottom of my face is completely numb (on a side note, lips feel reeeealllly weird when they're numb), I feel fine. So listen, as I slowly sip my congee and type this out.


Winter 2012 Semester Recap

So this semester was a pretty interesting semester. It was definitely the most intense semester we had so far, thanks to the Intermediate Computer Graphics and Game Design and Production I courses that we had. Both of those required a lot of work and effort on the student's part, which often turned out destroying a lot of the time that we had to work on other things oh my God some congee just fell out of my mouth.

The classes themselves were pretty straightforward, we had graphics, game design, sound and audio, accounting and finance. First, let me say that I hate business classes. Like I hate them so much. I know our program has a business component, and I understand that, but I really cannot stand those classes. Going to them makes me miserable, doing the work there makes me miserable, all I want to do is stay in my room and program man >_>

You've helped me a lot though. But I'd be ok if I never saw you again.

The other classes were more interesting since they were actual game dev stuff. Graphics was probably my favorite course this semester because as a programmer, I really enjoyed learning and programming shaders. One of my goals this summer is to look at GLSL and learn it so I can work with both Cg and GLSL. Should be lots of fun. The experience system was pretty awesome too looking back, it was kinda fun competing with people getting experience, and after I was done, I could kinda just sit back, relax and watch people scramble to "get their shaders done".

Game Design was an interesting class because it was not really what I expected of the class. I thought there was going to be a lot of report writing during the class, like writing game design documents or something. But apparently I was completely wrong and made a lot of board games instead. They took up a lot of time every week, but they were interesting assignments, that's for sure. My favorite assignment had to still be the Shakespeare game. Yea, we totally made a Batman game instead, but that's why it's awesome haha.

Batman is practically Shakespeare anyways.

Sound and Audio was a cool class too, the content itself was kind of dry though. Playing around with some of the fmod stuff was really cool, since again, I'm a programmer and I like programming things. Incorporating some of the sound elements int the GDW game was also pretty fun since having sounds played at the proper time really does make the game feel a lot more complete.

The biggest thing this semester though was GDW. I learned a lot about UOIT Game Dev this semester, mostly being that the classes don't really matter that much. At the end of the day, no one cares what you got in a class. No one cares what you've "learned" in the class. What matters is taking what you learn in class (and outside of class) and applying those concepts to your GDW game to make it better.

I'm actually really happy with how our game turned out this semester.

We put a lot of time into GDW this semester. People that know me would probably know that I'm not really a late sleeper, I'm a fan of sleeping earlier and waking up earlier, not sleeping later and waking up later. Generally, I sleep at 11 - 12 and wake up at like 8 to work on things.

However, I pulled my first all nighter this semester. The day before Game Con, a lot needed to be done, so there I was, working throughout the entire night, tanking the entire day afterwards and then passing out at like 10:30 or something that night. It was an interesting experience, one that I hope I never have to experience again.

They put me to sleep today during the surgery. I don't remember falling asleep. Or waking up. (Wikipedia)

It kinda hit me that the GDW is really what matters. When you show your game off at events like Level Up and Game Con, no one cares about your classes or that 1337sauce straight As you managed to pull off. They care about the quality of the game, and they rate it in a scale of terrible to awesome. A lot of people we should our game to liked our game, and considering the time, effort and misery we spent to make it, it made it all feel worth it.

Even in industry, what you have made is what they care about.

Obviously school is still important, but I've learned that I need to stop caring about my marks as much. I'm still going to go for good marks, but I need to learn to just accept slightly lower marks. Bs aren't bad. Although B could stand for Bad. Whatever, I'll accept it. Eventually. Actually no, I'm only allowing one B in any semester. Screw that, As are where it's at. But we'll see.

The definition isn't good enough.

Honestly, we'll be in third year next year. That's our last year of GDW. I want a good GDW group that could make the best game ever so that when I show that game to people, they'll be blown away. I feel that we have people in this program that have the capacity to do that, and as a result I have officially left my GDW group and am currently in talks of forming another group.

This group should in theory do a lot better and therefore result in an even better game. I'm very hopeful that it works out and it does happen, since that would actually be great.

Summer Plans

So what do I have planned for the summer? I'm actually pretty busy and I'll be doing a lot over the summer. In May, I'll be in and out of the school as I'll be working under Dr. Kapralos working on one of his projects. He wants me to make a heartbeat monitor that he could build into their hospital serious games engine, so I'll be working on that.

I'll also be working on another project under Dr. Hung. Dr. Martin Vargus has some technology called Navdriver which Dr. Hung wants me to integrate into his Maxit systems. That one would be interesting to work on since it'll require integrating a piece of Java based web tech into a C++ platform.

And frequent readers of my blog should also know that I'm a tutor. I'm still tutoring over the summer, so I'll be doing that too. Kinda feel like I over committed a tiny bit, but hey, I'll deal with it.

However if you over commit you might lose your army and then the game. (GamezBlog)

But probably the biggest thing I'm going to be doing this summer is going to Hong Kong from June to mid August. So I'll be doing all the stuff I mentioned above in May while I'm here, and then when I'm in Hong Kong I'll be doing a few online tutoring sessions and then working full-time at Beaconwall, the company owned by Dr. Hung.

He told me that I'd probably be writing algorithms to analyze images and video, but I'm still not 100% sure as to what I'll be doing. Especially since recently he wanted me to integrate Navdriver into the Maxit system. Really don't know. I'll find out eventually though, but I'm more looking forward to being able to live in Hong Kong for two and a half months, that should be fun.

Lots of things to do and buy! (National Geographic)

Oh, I'll also be working on my own personal projects over the summer too. There's a lot of stuff I want to get done and try, and we'll see how much I can actually do with the time. But yea, I have a lot of stuff planned this

Well, I think that's all I wanted to write about for this post. I'll probably write another one a week or so before I leave for Hong Kong, unless if something incredibly epic happens between now and then. But I'll be going back to writing blogs on a regular basis once I get to Hong Kong, so stay hyped for that.

Till next time.

Sunday, April 8, 2012

Intuitive Controls are Intuitive

Game Design and Production - INFR 2330

So I don't exactly remember which class it was, but we had a class relatively recently where we talked about intuitive controls. I didn't really give it too too much thought during the actual class itself because I was thinking to myself: "Well yea, obvious controls are obvious". However one day we showed our game to Dr. Nacke for feedback and we didn't really have anything that told the player what the controls were, yet he still managed to pick up the game and he told us that our controls were good because they were intuitive.

At that point I was still like, "Yea, because what else would they be? Movement should be WASD or the Arrow Keys and having attacks be 1 - 5 makes sense". The point never really hit me until last night when I was trying to improve on the controls for our game using a PS3 controller.

Best controller btw. (Wikipedia)

Setting up the control scheme for the controller actually bugged me because I couldn't get it exactly right. I had an idea in my head as to how the game should be controlled, but I couldn't replicate it perfectly with our game because our game just doesn't support the functionality the games that I'm used to playing on the PS3 does.

That's when it got me thinking about intuitive controls for games. What gave me the idea that a certain key is better for a certain action than the others? Like is X just more magic than the square button? Why should that be used as the main button? Or why does the right control stick move the camera? Why do people immediately use the joystick over the D pad? There were a ton of questions that I thought of at that moment.

Sooooooo many questions. (RacerX)

Thinking about these questions reminded me of last summer when I played Final Fantasy XII and Final Fantasy VII. Final Fantasy XII's controls threw me off completely because in the PS3 games I'm used to now, the right analog stick moves the camera one direction when you move the stick one direction. I actually don't even remember which direction it moves you because I'm so used to it I don't really pay attention anymore.

However in FFXII, the camera actually moved the other way when you moved the right analog stick. It completely threw me off because I was so used to playing games like Infamous where I would use the right analog stick all the time to move, and when I tried to do it in FFXII, I had to have some sort of readjusting period to get used to it. And when I finally got used to it, I beat the game and moved back to Infamous 2. It was almost painful getting used to the new camera controls again.

Also I wasn't able to just enter combat and AFK since Infamous didn't play itself. (Wikipedia)

Then I thought of my experience playing FFVII. I bought the game on PSN so I played it with my PS3 controller. Again, the playing experience was completely weird for me since I just finished playing Infamous 2 so I was back to being used to modern, open world controls. I remember loading up FFVII for the first time and getting stuck on the menu because I couldn't figure out how to move the cursor or select things.

After a few minutes of derping around, I noticed that I was using the analog stick and trying to move. I decided to give the good ol' D pad a try and bam, the cursor started to move and I could select things again. Now I just had to figure out how to select things and after smashing every button on the controller, I figured out that O was now the select button and X was the cancel button, which is completely opposite from the modern controls.

OhGodI'mTryingButICan't (Final Fantasy Wikia)

Eventually I figured out you could swap the X and O buttons using the controls menu, but that only applied in game so every time I loaded up the game I would spend a few moments fumbling around the menu until I remembered that I had to hit O instead of X. And of course it always threw me off since I couldn't move with the analog stick which I was so used to using.

It kinda hits me now that I was really playing games from three generations. The PS1, PS2 and PS3 eras. The controls for each era seemed to be slightly different. I mean, back when FFXII first came out, I don't remember me having issues with the camera. I didn't play FFVII on the Playstation back when it came out, but I'm pretty sure people didn't have issues playing that game either since apparently it's so good (Overrated IMO).

Except for the part where Cloud crossdresses, that was lulz. (Thelifestream)

I mean, the Playstation controller really didn't change that much over the years, yet gradually there seemed to be a shift in terms of what the norms were for controls. It seems that there really is no set control scheme, but rather what people are more used to playing with.

Another example of that would be StarCraft Brood War. BW was notoriously hard to play since most of the   main keybinds were on the left side of the keyboard, and that is the most intuitive side to put your hand on anyways when your right hand is on the mouse. Yet at the same time you had things like O for Overlord, M for Marine and P for Pylon.

1a2a3a4a5a6a7a8a9a0a (Team Liquid)

I played Brood War back when it came out, and yea, I was totally a clicker, but still, I don't remember me thinking "Oh man, these control schemes are so hard!". Then StarCraft II came out and Blizzard made the game easier to control, they made it so all the keybinds were on the left side where they should be, and things like O for Overlord and M for Marine didn't exist anymore, they were V for Overlord and A for Marine.

A lot of BW diehards complain that SC2 is too easy to play, and honestly, it's only "easy" because BW was hard to play. Going back to BW from SC2 is painful. Absolutely painful. Did BW have a good control scheme? I honestly don't think so. Did it work? Yea, it did. If it didn't eSports wouldn't exist.

Last night's finals were tainted btw. And you know it. (GomTV)

So what am I getting at? I don't think there really are any "correct" control schemes. I mean, if you can play a game, then the controls work; they're "correct". However there's a difference between correct and comfortable control schemes. And honestly, what people are comfortable with aren't always the most optimal controls either, it's really just what people are used to.

Who knows, maybe a few years from now Square would be confirm and Triangle would be cancel button. It would be weird to think about now, but hey, a few years from now it'll be the norm and it'll feel, well, intuitive.

Monday, April 2, 2012

Edge Detection

Intermediate Computer Graphics - INFR 2350

So in a lot of non-photorealistic shaders, one of the things they do is they implement an edge detection algorithm to well, give things an edge. For example, the toon shader that (hopefully) everyone in the class has done requires an edge to make it look proper and cartoony.

Like all the other aspects of programming, there are many ways to do edge detection. The ghettoist way to do it would be to just render all the geometry twice. The first set of geometry would be the main geometry, untouched and normal. The second set would be slightly larger, say, 3% or so. Made completely black and then front face culled.

That's what I did for this toon shader.

That way is pretty hacky, but it works. It works because obviously if its the same object but scaled a bit, it'll fit the edges of the object. Then if it's black and then front face culled, all you see would be the absolute edges of the secondary object which would make the original object look like it's front face culled.

It's not bad to be honest, but there are obviously lots of shortcomings when using this algorithm. The first is that you have to render geometry twice. Which is fine for low poly scenes, but scenes with tens, if not hundreds of thousands of polies would quickly make this algorithm unfeasible.

Also another downfall of this algorithm is the fact that it doesn't capture inner edges that well. It only does the outer edges and the inner edges are really sketchy.

A mountain like this has like a trillion polies. Rendering it twice would suck.

Another way to do it would be to base it off the normals. Since the normals tell you what direction each face is facing, you can use those to figure out if they are an edge or not. The way you would do that would be to quite simply figure out the direction vector from your camera to your object, and then based on that, if a normal's direction is near perpendicular or something, that would be an edge.

You can also calculate edges based on depth too. If an object is placed on a scene with a simple background, then obviously all the objects have different depth values as well. If you were to sample an area and there is a drop off in depth, then you could assume that there is an edge there as well.

Shaaaaaaaaaaaaaaaaark. (Wikipedia)

An another algorithm to do it is using a Sobel filter. I personally like this one since I don't have to deal with depth information or normals. It's pretty straightforward too. Like the depth-based edge detection, you sample the image and see if there is a dropoff in colour. So instead of basing it off of depth, you base it off of colour.

Naturally there are issues with this too since if the colours of the object and the environment are too similar, the edge detection fails. Or for example if the colours of your object were too distinct, then theres a possibility that you would get random edges on your character that you may or may not want.

Notice the character's armband isn't properly edged.

It works reasonably well though. As you can see from above things are properly outlined in our GDW game. It's not 100% perfect, but it works well enough.

One thing that the Sobel filter has on the depth-based one though is the fact that if you had a textured quad, the depth based one would fail since the quad has a solid depth. Whereas if the colours were distinct enough, then you would still get edges on it. Notice how our quad trees are edged in the above picture. The depth-based one wouldn't do that.