Tuesday, February 7

Lighting and Such

A little behind on this one but here goes nothing.  I'm going to do a quick overview of lighting to make sure I know what heck I'm talking about!

Ambient:  An omni-directional light that covers everything around it.  No area has more intensity than others as it is uniform wherever the light hits.  It is based on the diffused lighting parameter multiplied by constant value to determine how much light there is.

Diffuse: Light gets more focused with diffuse, as it can be shone in a certain direction.  There are several rules that help define the properties of diffuse lighting: the illumination falling on a surface and being reflected perpendicularly is relative to the inverse square of the distance between that particular object and where the light is coming from.  The illuminance will always be proportional to cosine of the angle with the normal of whatever object the light is hitting (basically defines the reflection).  When diffuse light travels through an absorbing medium (air, water, etc), then its intensity decreases at an exponential rate from the light source.  

The intensity for diffuse is defined as the intensity of the light source x the constant factor of the light x the angle between the light and a surface normal, which can also be calculated as the dot product between them.  Additionally diffuse lighting can have an attenuation effect by diving by a couple extra parameters in the equation.  This can change the fall-off rate of the light and will change how it looks dramatically.


Specular: This type of lighting is a bit different in that it is dependant on the viewers angle.  The specular highlights will change depending on where the viewer sees the object from.  Specular lighting's equation is fairly similar though; it is the intensity of the light source x a constant factor x cos of the angle between the reflection and the viewer.  Since the angle is between the reflection and the viewer, moving will change how you see the specular highlights.  Certain models like Blinn and Phong's are just specific versions of this kind of lighting, where it will have a certain look based on the equation.

Just combine all these together with the actual emissive light and you get a final result.
 

Sunday, February 5

The Morality of Morals



I'm going to take the side of Yahtzee the game reviewer from Zero Punctuation and comment on the rather thorny game mechanic of choosing good vs. evil.  Yahtzee believes this mechanic in most games is forced rather than being a choice, arguing that it is mandatory to go full good or full evil to unlock the greatest benefits from each.  This means that the player must choose all one side if they want to experience more of the game.  His review on Star Wars: The Old Republic shows his opinion on the matter. (3:30-4:05)




Being a gamer I can agree with his sentiments.  For example, I wanted to experience both sides of the good and evil dynamic in Mass Effect 1 and 2, but they were both lengthy games and upon beating them I didn't feel like going through it all again just to see whats different on the other side.  Or in The Old Republic where some of the items are only available to Light 5 or Dark 5 characters.  It takes a lot of time to max out one of these and once there you are unable to get any items requiring the opposite side.


I see two main solutions to this dilemma which would help players not feel so fenced into one direction.  The first is to reduce the effects of good/evil choice to aesthetic outcomes.  Oblivion comes to mind as it doesn't truly have a morality system.  You are open to do as you choose, and murdering a whole village won't impact the main story line or limit what you can do in the future (except for the whole being attacked on sight thing).  Oblivion makes morality a choice where the player can really pick when and where to do benevolent/dastardly deeds.

Go to jail, pay fine, or run?


The second solution involves reducing the black and white nature of moral choices in games.  Often they are polar opposites and the player might feel as if their choice isn't represented by the two end of the spectrum.  The ending of Fable 2 pulled this off spectacularly, as it was one of the most involving and difficult choices I've ever been faced with in a video game.  After defeating the final boss in Fable 2 you are granted one wish and must choose between three morally grey choices.  (2:33-3:25)




  You must choose between reviving all those who died during the story line,  your family (and your dog) in the game, or gaining an immense amount of wealth.  I chose to save all those who had died, and in the end I felt good about myself but it came with a hollow feeling.  The beloved dog I had grown attached to during the game was gone forever and it just wasn't the same without him.  This powerful emotional tie really made the choice difficult and there was no sense of choosing a certain option just to gain good or evil points: it really mattered.


While the first option is certainly easier to implement, I believe that moral choices in games should follow Fable 2's system to create real and meaningful decision-making.  The difficult choice in Fable 2 had a profound impact and I have certainly not forgotten it.  I believe moral choice systems in games can add a lot the experience if they give the player a reason other than unlocking the best equipment and weapons, and are an excellent game mechanic if done properly.

Tuesday, January 31

This is Madness...This is Matrices!!



So I've been looking through the CG examples to get my head around some of it.  The 2D stuff was fairly simple, just take in the vertices and does whatever, then outputs no problem.  But then hit the 3D example program and was blasted in the face by more matrices than I knew what to do with.  

So I consulted the bible of CG (Nvidia Tutorials) and went down the rabbit hole.  Chapter 4 in the tutorial is where I needed to be.  To reinforce what I've learned I'm going to attempt and explain what exactly the chapter talks about.  It begins with some easy stuff about coordinate systems and the pipeline, then gets into the heart of the matter.

We begin at object/model space, which is the coordinate system for the object itself.  Each vertex in the 3D object can (of course) be placed somewhere in the object space, with a vector to store all the translation/rotation info.  Although not always shown, the w value is always there if you can't see it.  It is more handy to use the 4-value vector because it makes all the 4x4 matrices much easier later (I'll get to it!)


Speaking of which, to get the object in world space you must combine all the rotations and translations into a homogeneous 4x4 matrix.  Each object in the world have its own matrix to define where it is and its orientation etc.  This way everything is relevant to the other objects in the world.  These transformations can be concatenated to define the precise location of each object.  Now with everything there, we need to look at it.


Eye space is the next stage, and it involves where we will be looking at the world from.  In eye space, the camera or 'eye' will be at the origin and everything else will be relative to it in this coordinate system.  To transform the world into eye space, the view transform must be done.  This usually involves some sort of translation to offset all the other objects compared to the camera.  Once you figure out where you want the camera, you multiply its homogenous 4x4 matrix by the model one to get the modelview matrix.

fig4_3.jpg
Creating the modelview matrix.
Now that we have a camera which can see things, we must define what exactly it can see.  This next part is called the clip space, and will ultimately determine what shows up on the screen.  In CG shaders, the vertex shader will always take in vertices and output into clip space.  To get the clip space, the next step is to multiply the projection matrix by the modelview.

This results in the projmodelview matrix and is what makes up where the fragments are.  In OpenGL the clip space will divide by the w to get each of x, y, z between -1 and 1.  This means that the vectors are now normalized in the clip space.  The final fragments are then sent through to be rasterized by the GPU, which then is displayed on the screen.

Hopefully I got this more or less.  Now to do the hard part and actually figure how all this code works..

Sunday, January 29

Of Airplanes and Dinosaurs


Today I'm going to go over our two new board games and review the game atoms, as well as explain a concept I wanted to add to them.  The WWII game we came up with is called Flight Path and involves 2-4 players trying to reach an aircraft carrier at the other end of the map.  The pick-up mechanic game is called Rescue Racers where the goal is to rescue civilians via helicopter from the dinosaur invasion.

In Flight Path each player controls a WWII era airplane which is in need of repairs.  The players can choose from the Saetta, Spitfire, Komet, and Mustang models, and their objective is to reach the Campania class escort carrier near the shore.  The players start spread out at one end of the map, while the carrier occupies two spaces at the opposite end.  The first two players to get there will be repaired and win the game.

Campania class escort carrier.

Each turn every player can move up to two spaces on the map.  A 90 degree turn will use up one of these two movements.  Players are limited to 90 degree turns and a max of two movements per turn.  Additionally, certain tiles will limit movement.  It takes both movements to get through one cloud tile on the map, while mountain tiles are impassable to all players and must be flown around.

The main mechanic of the game is managing your fuel resource.  Each player starts with, and can have a maximum of 6 fuel.  Each turn they use up one unit of fuel.  Scattered around the map are refuelling stations which will put a player to maximum fuel again.  These fuel-stations are one-time use and players will have to keep finding more to stay in the air.

Strategy in Flight Path results from choosing where to fly your plane in an attempt to cut other players off.  If a player can't manage to reach a fuel station and crash-lands, they must wait two full turns before they can begin moving again.  There are several different maps planned, some with choke points and others with limited fuel stations to keep the game intense.


A little interlude here for game atoms; I believe that progression is a big part of games, but maybe not quite a game atom.  It is on a higher level but encompasses a lot of the game atoms within itself.  All games involve a progression of start to finish, or setup to resolution.  It keeps the game going or keeps the player motivated, and can be thought of as a resource similar to time.  It could be linked to addiction in an MMO sense, as players have the strong urge to continually level up and progress to equip better weapons and armour.  More simply it can be thought of as: a game progresses until culmination when a winner is declared.
Warning: Progression in an MMO may reduce social skills progression by 100%.




 Games without progression would be endless.  It would be like Clue where you never find who did it, or Dungeons & Dragons where your character just sits around town all day.  Linear or open-ended, progression is the catalyst to which players strive to improve and continue.  Progression creates a sense of purpose and clarity of intent, a direction so to speak.  Without progression, why bother playing?


Moving on to the pick-up game; Rescue Racers features 2-4 players saving terrified people from scary dinosaurs.  The game map is similarly laid out in square tiles but this time the players are in helicopters and must rescue the people from rooftops in a city environment.  The game ends when all the humans are rescued, and the player with the most is declared the winner (and a hero!).
There goes the neighbourhood...
Each player rolls a die on their turn and MUST move the number of spaces they roll.  The player may make one change in direction during their move but ONLY one.  This means at most a player can fly in an L-shape in a single turn (I'll explain why this came about later).  Landing on a civilian means that you pick them up; at most a player can carry two civilians.  To score, the player must return their carried civilians back to their respective helipad at the edge of the map (where they started). Additionally, movement through skyscrapers and buildings is prohibited, and they must be avoided.

The competitive aspect comes from the ability to steal another player's civilians.  This happens when a player lands directly on another player's piece.  If they have room they steal the player's cargo and move two spaces directly in any direction from the opponent they landed on.  Some players may choose to go around rescuing while others may hang around their opponents helipads and attempt to steal all their passengers.

During play-testing our group came across a major flaw in the movement system.  Originally you could move to any space each step of your turn.  So if you wanted to move two spaces but rolled a six, you could bounce back and forth until you landed on it.  This created a phenomena where Tom and I kept rolling a 2, 4, or 6 and repeatedly stole each others passengers.  This combined with the bouncing two spaces mechanic created a situation where we stole back the passengers with a 50% success rate.

After a few turns of this it really became frustrating and the game quickly turned into a steal-fest; not very fun.  With this flaw in mind, we decided that the player could only change direction once per turn and after that the chance to steal from a player drastically dropped.  Oh it still happened, but it was a fair mechanic and we had a lot of fun with it.

While both these games feature a flying aspect, their goals and mechanics are quite differentiated.  Each has its own pace and a distinguishing flair to it, and both are a ton of fun.  On that note, I've got a couple more blogs to write so adieu for now!

Sunday, January 22

Board Games

Our group for the board game design came up with a really fun idea.  Our race to the end game (tentative title: 'You First!') is unique in that the objective is to race and be last.  The idea is that 4 students are being sent to the office but only the first three to get there will get in trouble.  The last one will sneak away while the principal is distracted.  This means that you really don't want to get there first!

Each player takes their turn by rolling a die and moving however many spaces is rolled.  There are normal tiles and special tiles along the path.  The special tiles have different effects depending on which colour the player lands on.  When landing on yellow the player must move two spaces back (this is good!) and if that puts the player on another special tile its effect will be activated as well.  A green tile will make the player's next roll lowered by one; this can be good or bad depending on their next roll.

Pink tiles are the real game changers and make You First! intense.  When landing on a pink tile, the player switches their piece with the player who is nearest to the principal's office.  This can change the game dramatically if the two are far apart.  If the player closest to the end lands on a pink tile, he switches with the closest player behind him.  The way the board is set up, it requires a fair amount of luck to get past the final two yellow tiles.

In the match our group played, we all ended up switching back and forth with each other on the last row of tiles and it was really nerve-wracking.  Eventually someone made it to the end (and lost) but for a while it was a real nail-biter.  I really liked how the game could change in an instant and the end was designed to create suspense.  While there is no direct element of strategy involved, the game can still inspire a lot of competition between players, especially near the end.  We are considering changing the pink tile to allow the player to switch with anyone of their choice.  Alternately another special tile type could be added to accommodate this feature.

The territorial dominance game we created is called Hexatron.  It is played on the hexagonal tile paper and whoever scores the highest wins.  The back story is that each player controls their energy being and the objective is to go around to the all hexagon nodes and collect 'energy' from them.  Once a node has been travelled on, players can no longer move on it.  Each node will give a point and special nodes will add extra points or even double the player's points.

Each player rolls a die on their turn and is able to move up to three spaces depending on their roll.  This adds an element of chance as well as strategy to the game.  The strategy comes from deciding where to move as well as when to move certain places.  For example a player could start moving to another player's starting corner early in an attempt to cut them off and restrict their movement.  This could severely reduce the other player's chances to get a decent score.  The match ends when all the spaces are taken or no players can make another move.

I'll add pictures of the polished and prototype game boards asap, and go over them in a bit more detail.

Saturday, January 21

Cel Shading

I'm going to talk a little bit about cel shading today because a couple of my favourite games were in fact cel shaded.  I'll go through 2 examples of cel shading done really well and why I think this style of graphics added a lot to the games.  The two I will be referring to are both for the Gamecube, namely Cel Damage and LOZ: Wind Waker.

Cel Damage, released in 2001 had rather groundbreaking effects for its time.  It was a vehicle deathmatch type game, where you drove around collecting power-ups and weapons, and then ultimately using them to blow everyone else up.  The game featured 10 characters, 13 maps, and a ton of wacky weapons including shrink rays, giant baseballs bats and harpoon guns.

While not received very well with critics, I personally played this game to 100% several times; its just so much fun.  It was unique in that the physics engine was not based on reality at all.  It was a custom engine built to make all the animations seem cartoon-like in nature.  The most notable effect is some characters' vehicles would actually bend noticeably when turning sharply.  This type of warping along with the vehicles being frozen, lit on fire, and thrashed around made the game seem really alive.



For me the cel shading really made the cartoon world exciting.  All the ecentric effects combined with the hilarious weapons and interesting characters created a unique atmosphere for Cel Damage.  As you can see in the video, the cel graphics are very simple yet effective at conveying the range of effects in the game.  If this game was done with normal graphics, it may have suffered from a poor frame rate and still not looked very good because of the amount of things going on at once.  The cel shading gave it life and was certainly used to complement the game's style.

The second and more controversial game is The Legend of Zelda: Wind Waker, also for Gamecube.  There was a huge ripple of everything from disappointment to doubt to outrage when Nintendo unveiled their new art style for Wind Waker.  Launched in 2003, cel shaded graphics were still new for this time and people were having trouble accepting that a mainstream Zelda game would be using them.  Everything changed once people actually got their hands on the game demo.

People soon realized that the cel-shaded graphics opened up a world of possibilities for the game.  Link was more expressive than ever, the world was a beautiful tapestry of colour and light.  The visual effects that at first seemed almost childish drew people into a level of immersion never experienced before with a Zelda game.  The Wind Waker went on to being one of the top selling games for Gamecube ever, and is my favourite Zelda game of all time.



Every detail of the game world, from the turbulent ocean to impressive bosses was given a certain spark of life by the cel shading.  Like Cel Damage, the visuals are technically simple, but open up so much possibility for creativity and the artists did an amazing job of creating a cohesive game world.

Maybe one of the best things about cel-shading is that because its based on expressing colour and artistic style, these games still don't feel outdated to this day.  They are just as vibrant and and whimsical as when they first came out.  I really enjoy this graphics style and hope more developers see its awesome potential!

 

Friday, January 13

The [dreaded] Intermediate Graphics

Well I can't say I'm overly...eager to get started on this course, but I am excited for it.  Anyone who denies how awesome shaders make games look must be crazy, because the intro lecture really opened up a world of ideas for me.

Like many others (I presume), I was under the impression that the way to make graphics better in games was to pump in more polygons with ever more advanced consoles and graphics card capabilities.  The idea that you could make a simple object look amazing with shaders was a new concept to me, and it really got me thinking about the games I play.

With and without normal mapping. (http://tinyurl.com/87a7ydm)

With this in mind, I hopped back on Skyrim for a little bit and was amazed at what I never noticed before.  A majority of the detail for humans and monsters came from the bump mapping itself and not from having a million polygons.  I also began to scrutinize the ways the lighting and environmental details worked.  With a little examination I could see tons of different shaders busy at work making the game look really pretty.

A scary (but quite nice) looking dragon in Skyrim. (http://tinyurl.com/74e5jjw)

Of course seeing shaders in action and actually implementing them aren't quite the same thing.  The homework list is up as of this post and I can't say it didn't originally scare me.  Well, it still does...but I'm working on a game plan here.  This weekend I'm going to get a solid framework done for the homework questions and brush up on all the OOP and Graphics/Animation concepts.

From there I'm going to delve into the Cg textbook and hopefully get some homework questions done before they are worth nothing.  Or at least survive the mosh-pit of the line-up that this counter system will create.  I don't quite agree with the system, mainly in regards to handing in the questions.  What if it becomes an all-out sprint to get to the classroom, and me being too busy working hard for exercise, the other five students get there ahead of me.  Will I get 0 exp because they handed in their question 30 seconds before me?  I think the work put in should reflect on the marks gotten, not how fast one can run to class.

Otherwise, I'm ready to dig my heels in and get working on the questions.  Programming isn't my strong point but I know I can pull it off, I always have before.  This concludes my first blog for Intermediate Graphics, hopefully I remain sane throughout the rest of the course. :)

Thursday, January 12

A Life Story of Sorts

I'm not sure where to start on this, so I'll just begin.  Maybe it will even turn into a rant.  I've always enjoyed designing; I like to view myself as being on the creative side, with a fairly strong mathematical side backing it up.  I believe that words, conveyed with passion and meaning, can be more powerful than even pictures and sound.  Not to say that photos and videos aren't interesting, but when is the last time you were captivated by an engaging picture for hours on end?

Now lets take the potential of words and use them to create.  It really doesn't matter what; it could be a poem, a story, a description of a chair.  The idea is that words combined with inspired thought can become truly anything.  This is the essence of design: take an idea, and make it happen.  A single spark of thought can become an entire world like Middle Earth or Narnia.  Now lets get to the best part: designing games.

But wait!  Before I delve into it, lets get a little background going.  Somewhere in Grade 6 is where it all really started for me.  We had an assignment in English class to make up a story of whatever we wanted.  This was the birth of my character Zenith (formerly Blade).  He was strong, fast, and quickly learned Earth's ways, becoming a special unit in the military.  I used my own ideas combined with inspiration from various books and movies to make a totally awesome short story of Zenith.  I got a good mark, passed English, etc.  

Zenith drawing, courtesy of my long-time friend Kim.
The magic was that I enjoyed it so much, I continued on with the story and had a short trilogy before I knew it.  It was a work in progress over several years and looking back on the first story, I could see how much my writing had improved.  Despite this, the spirit of Zenith's saga remained just as powerful as when I first began to think him up.  Now lets fast-forward a few years, lets say to January 9th, 2012.

INFR2330U.  Game Design & Production 1.  I've been excited about this class ever since I saw it on the academic calendar roughly a year ago.  I found Dr. Nacke to be a very interesting individual and I personally quite enjoy his teaching style.  I can't explain in words how refreshing it was to not be sitting in a big lecture room, struggling to listen to a professor drone on for three hours straight.

But enough said, lets get to the games!  Our group of four played Infernal Contraption.  Its a zany card game where the objective is to be the last player remaining with the card in their 'parts pile'.  Each player is dealt an equal number of cards at the beginning, and the last player standing wins.  

The way to achieve victory is in how the player builds their 'machine'.  The machine is comprised of the cards a player places down; there are power sources, contraptions, consumables, upgrades, and a singular power core.  The cards must be linked together with the proper connections (colour-coded) to add to the machine.

The game play comes from adding contraptions to the machines.  Each turn, the player will 'activate' each contraption in their machine, each with its own effect, such as taking one card from the opponent's parts pile and putting it in their own.  Upgrades and consumable help with these endeavours, while power sources help convert different connection colours to useful ones for the player.

A fairly simple machine in Infernal Contraption.  1-5 are in the 'main line' while the vertically stacked cards are called 'sockets'.  Note each card is connected by the matching colours (purple is universal).

There is a steep learning curve to the game, but once figured out, we were rolling through and having a lot of fun.  As the game went on it became apparent that both which cards played, and their placement, had a big effect and certain strategies began to form.  My own strategy was to place lots of 'siphoning' contraptions, to keep my parts pile supply up.

That's it for now, I'm looking forward to really getting into the design course.  Every topic on the lecture list looks awesome, so I'm eager to get going.