Game Opinion: DLC

Hello!

Kevin recently told me that he wrote a blog relating to on-disk DLC and why that is a bad thing.  I on the other hand think that it is a good thing in many cases.

But first lets go over how the game production works.

DLC Production

Publishers are not releasing DLC on the disk for genuine bad reasons to take the consumers money and run away with it.  Instead they have data that proves that after every passing week, players are less interesting in buying DLC for the game title.

On Disk DLC

So while they have a huge team working on the core game they normally have a team on the side working to create DLC so that it is ready for launch.

In fact having a team working on DLC while the core game is being made can only make the quality of the DLC better.  Since many people don’t understand how games are developed, they don’t understand completely what “On-disk DLC” means.  If I were to create a character as a DLC item, I would have to redo all the character and squad selection menus and user interfaces for that character to be available in the main game.  So the core team developing  the game must prepare for these changes.

Also there are tonnes of games out there to be played.  Once we complete our games we normally move onto the next game.  We rarely ever hear about DLC, stop playing our current game and go play that DLC.  Instead we say, “oh, that looks interesting, once I am done with this game I might check that DLC out.”

Aside from that, the shelf life for software titles is very short.  It is better to have the option of DLC if you are an early adopter so you can buy that item while the disk is still in your console.  If you are the type of person who buys a game early on, beats it and then trades it in to get the most of your money back then early DLC is geared toward you.  EA is notorious for locking out online content for people who buy used copies of their games, forcing them to buy an online pass.

Games also go through a period of certification where once content is released for a console it must be verified.  During this period the development team has little to nothing to do.  Also if games are focused on a certain release date to maximise profit then their development team would have completed the game early and would also have nothing else to do.  During this idle period they are normally commissioned to build DLC while their core title is awaiting certification from the console manufacturer.

Despicable Money Grab

Aside from great content being built that is worth your money to purchase and deliberate publisher tricks for you to but other useless items to get a cheap in-game item.

This is like buying a happy meal to get a gun in Mass Effect.  Or buying a new mousepad to unlock a character.

When Assassins Creed Brotherhood came out they had a great Facebook game that you could play before the release of the core game to unlock items in the real game.  This was a free social game that had a lot of in game lore and content that was a nice lead into the full game.

When publishers start putting in game items with useless other counterparts is when DLC becomes a useless money grab.

Summary

Overall at its core this is discussion is if we either have the DLC on day 1 to play it, or we wait 3-6 months later and end up not playing it at all.  In any case, the price of video games have been $60 for several years now.  The quality of the games released has significantly increased over the years yet the price has remained the same.  If many consumers can afford paying $60 for a AAA title, then $15 extra for some worthwhile content is not a huge deal.

Fallout and Oblivion had amazing DLC that really extended the game and Shivering Isles was more of an expansion then DLC.

I personally don’t have a problem downloading content for a game I really like.  With Mass Effect 2, there were several pieces of DLC that released once I finished playing the game that I never got around to playing.

Game Opinion: Game Stories

Hello!

Overview

Today we are going to look at 3 types of stories and three games that show case these types of stories very well in my opinion. (Beware of Spoilers)

  1. Skyrim – fragmented player centric story
  2. Mass Effect – player choice driven
  3. Assassins Creed – linear story

Skyrim

While I personally have not beaten this game, I have spent several hundred hours combined playing Morrowind, Oblivion, Fallout 3 and Fallout: New Vegas.  Those games have similar types of story mechanics.

The fantasy games like Morrowind, Oblivion and Skyrim give little to no information about the player to leave it ambiguous enough for the player to fill it with their imagination.  Ambiguousness is key in these types of stories because the player can be anything from a warrior to a mage and a lizard man to a furry cat like race.

Fallout on the other hand does provide some history as to who the person was.  Fallout 3 you play as the hero from birth up until maturity.  Once you reach maturity to leave the safety of your underground vault to explore the Washington wasteland.  This game is more about taking a character given to you and moulding it the way you want to.  This is similar to Fable’s story progression.  You are a hero and you can either be bad or good.  Fallout uses a karma system to do this.  However the karma system didn’t have a huge impact on gameplay.  In Fable your entire persona would be modified depending on your choices.

The story in these games are fragmented and sporadically placed.  You always have a main quest objective, but whenever the player is exploring they have a chance of starting a new quest line.  That is the greatest thing about this style of telling a story.  Its more immersive because the player is in charge of completing tasks.  In other RPG’s there are little quest statements that pop up and you must read and accept that quest.

Bethesda has made their quest system very dynamic and open.  Sometimes you hear about a quest just by listening to an NPC conversation.  If someone asks you to go pick up some useless item for them and you don’t want to, you can literally kill that NPC and end that quest line.  There is a lot of freedom given to the player in this type of story telling.

Mass Effect

Mass effect is known for its speech choice interactions.  The player is in a social interaction with an NPC and they choose what to say.  The game categorises the players choice in a karma system but they have Paragon and Renegade in place of positive and negative.  Paragon would be the good intentions that are fairly selfless and morally correct.  Renegade are more selfish and immoral choices.

The game does offer some grey areas that are not paragon or renegade choices.  Later versions of the game have special scenes where the player is in a quick time event where they must quickly decide to do a paragon or renegade action.

The quick time events are a good way of advancing the story since they have the players first initial response that is most genuine.  If someone is really annoying you, and you are trying to a nice person and do paragon actions yet you flick the right trigger to slap them in the face, it brings out your true emotions.

Mass Effect doesn’t give the player a huge role in determining the story, but the player does get to pick what path to take to reach the end of the game.  Over the trilogy the choices the player makes have greater consequences.  Some choices only effected the way some NPC’s viewed your character later choices affect the lives of hundreds of people and the extinction of some races.  Even some of your crew members lives are at risk if the player picks a wrong choice.

This type of story telling is good when the game has a good story and world that the game designer wants to immerse the player in without using a completely open world.  Many players who play open world games spend more time playing around in the sandbox then caring about the story.

Assassins Creed

This game offers a really interesting storyline in the first game that looses its meaning after the 3 sequels.  They integrate their story in real world events questioning the way we look at the things around us.  The plot becomes somewhat controversial not using the standard good vs evil approach.  Instead they use the Assassins vs Templars approach.  The Assassins fight for free will and oppose a ridged system of development for humankind.  Templars believe that order is the only way for our species to realise its ultimate potential.  The series is all about two shadow organisations fighting over centuries.

Assassins Creed is really good at setting up a epic story that has a lot of depth and creates several questions in the players head as to what is going on.

Granted that the first game had very linear and unchanging gameplay but they had a story with great depth and was epic enough to build an entire franchise out of it.

Thank you for reading
– Moose

Shaders 103 – Lighting

Hello!

By now you should know what shaders are, and how they work.  You should also know how to integrate them into your code.  Since I have spent a lot of time putting lighting and what not into our game, I have become a bit of an expert with it.  So today I am going to go over how to do some fragment based lighting.

Changes from OpenGL and Movement Matrices

While I didn’t do the lighting in our game last semester, you can’t take old OpenGL code with lighting and a whole bunch of glTranslate and glRotate calls and expect it to work.

The first thing we are going to have to do is build a whole bunch of matrix functions that build a perspective, look at, rotation, translation, multiplication, invert and transform matrices.  When you download the CG API some of the sample code does have these functions build in, but they expect you to know what they do and how they work.

Here is how we will now be rendering objects instead of using the ‘gl’ draw calls.

/*** Render brass solid sphere ***/

setBrassMaterial();

/* modelView = rotateMatrix * translateMatrix */
makeRotateMatrix(70, 1, 1, 1, rotateMatrix);
makeTranslateMatrix(2, 0, 0, translateMatrix);
multMatrix(modelMatrix, translateMatrix, rotateMatrix);

/* invModelMatrix = inverse(modelMatrix) */
invertMatrix(invModelMatrix, modelMatrix);

/* Transform world-space eye and light positions to sphere's object-space. */
transform(objSpaceEyePosition, invModelMatrix, eyePosition);
cgSetParameter3fv(myCgFragmentParam_eyePosition, objSpaceEyePosition);
transform(objSpaceLightPosition, invModelMatrix, lightPosition);
cgSetParameter3fv(myCgFragmentParam_lightPosition, objSpaceLightPosition);

/* modelViewMatrix = viewMatrix * modelMatrix */
multMatrix(modelViewMatrix, viewMatrix, modelMatrix);

/* modelViewProj = projectionMatrix * modelViewMatrix */
multMatrix(modelViewProjMatrix, myProjectionMatrix, modelViewMatrix);

/* Set matrix parameter with row-major matrix. */
cgSetMatrixParameterfr(myCgVertexParam_modelViewProj, modelViewProjMatrix);
cgUpdateProgramParameters(myCgVertexProgram);
cgUpdateProgramParameters(myCgFragmentProgram);
glutSolidSphere(2.0, 40, 40);

Now this may seem like a lot, but it is necessary for working with shaders.

The beginning where we call the setBrassMaterial() function is where we set the objects parameters.   We will get to that a bit later.  For now think of it as your glColor call.

The first part where we create the matrix using a simple rotation and translation matrix is fairly simple.  You would just pass on those parameters as if you were doing a normal glRotate or glTranslate call.  You can replace these with variables so you can move these.  For now this object is stationary so we do not need it to move

However the next part is where you  multiply them to get your modelMatrix and invert it to get your final matrix.  This is so we can calculate lighting with respect to the sphere object.  We then update our eye and light Cg parameters that we will see later.

The last bit of code creates the modelView matrix and actually draws the sphere.

Using Materials

The book uses this method of creating functions that set the emissive, ambient, diffuse, specular and shininess values.  Like this:

static void setBrassMaterial(void)
{

const float brassEmissive[3] = {0.0, 0.0, 0.0},
brassAmbient[3] = {0.33, 0.22, 0.03},
brassDiffuse[3] = {0.78, 0.57, 0.11},
brassSpecular[3] = {0.99, 0.91, 0.81},
brassShininess = 27.8;

cgSetParameter3fv(myCgFragmentParam_Ke, brassEmissive);
checkForCgError("setting Ke parameter");
cgSetParameter3fv(myCgFragmentParam_Ka, brassAmbient);
checkForCgError("setting Ka parameter");
cgSetParameter3fv(myCgFragmentParam_Kd, brassDiffuse);
checkForCgError("setting Kd parameter");
cgSetParameter3fv(myCgFragmentParam_Ks, brassSpecular);
checkForCgError("setting Ks parameter");
cgSetParameter1f(myCgFragmentParam_shininess, brassShininess);
checkForCgError("setting shininess parameter");

}

So this function just sets the colour of each of the light parameters that we want.  Using this we can make several material functions for different objects and control them independently in whatever way we want.  You can make a character, enemy and level material.  Right before you load your character, you can make their lighting bright so that they stand out.  For enemies, you can give them a bit of a red highlight to show the player that they pose a threat.

What to Initialise

Now we are in our initCg() function let us break it down into a vertex and fragment area.

Vertex Initialisation

myCgVertexProfile = cgGLGetLatestProfile(CG_GL_VERTEX);
cgGLSetOptimalOptions(myCgVertexProfile);
checkForCgError("selecting vertex profile");

myCgVertexProgram =
cgCreateProgramFromFile(
myCgContext,              /* Cg runtime context */
CG_SOURCE,                /* Program in human-readable form */
myVertexProgramFileName,  /* Name of file containing program */
myCgVertexProfile,        /* Profile: OpenGL ARB vertex program */
myVertexProgramName,      /* Entry function name */
NULL);                    /* No extra compiler options */
checkForCgError("creating vertex program from file");
cgGLLoadProgram(myCgVertexProgram);
checkForCgError("loading vertex program");

#define GET_VERTEX_PARAM(name) \
myCgVertexParam_##name = \
cgGetNamedParameter(myCgVertexProgram, #name); \
checkForCgError("could not get " #name " parameter");

GET_VERTEX_PARAM(modelViewProj);

This is a fairly simple vertex initialisation.  The main point is to see that we are passing the modelViewProj matrix.  If you go back up to our draw code you can see where we update myCgVertexParam_modelViewProj parameter.

Vertex Shader Code

void v_fragmentLighting(
float4 position : POSITION,
float3 normal   : NORMAL,

out float4 oPosition : POSITION,
out float3 objectPos : TEXCOORD0,
out float3 oNormal   : TEXCOORD1,

uniform float4x4 modelViewProj)
{
oPosition = mul(modelViewProj, position);
objectPos = position.xyz;
oNormal = normal;
}

You can still see that this vertex shader is still simple.  We take our model view matrix and multiply that by our position and output both our position and our object position.

Fragment Initialisation

#define GET_FRAGMENT_PARAM(name) \
myCgFragmentParam_##name = \
cgGetNamedParameter(myCgFragmentProgram, #name); \
checkForCgError("could not get " #name " parameter");

GET_FRAGMENT_PARAM(globalAmbient);
GET_FRAGMENT_PARAM(lightColor);
GET_FRAGMENT_PARAM(lightPosition);
GET_FRAGMENT_PARAM(eyePosition);
GET_FRAGMENT_PARAM(Ke);
GET_FRAGMENT_PARAM(Ka);
GET_FRAGMENT_PARAM(Kd);
GET_FRAGMENT_PARAM(Ks);
GET_FRAGMENT_PARAM(shininess);

/* Set light source color parameters once. */
cgSetParameter3fv(myCgFragmentParam_globalAmbient, myGlobalAmbient);
cgSetParameter3fv(myCgFragmentParam_lightColor, myLightColor);

This not the full code for the initialisation.  This smidgen of code contains the new parameters that we will be passing into our fragment shader to compute our lighting.

Fragment Shader Code

void basicLight(
float4 position : TEXCOORD0,
float3 normal   : TEXCOORD1,

out float4 color : COLOR,

uniform float3 globalAmbient,
uniform float3 lightColor,
uniform float3 lightPosition,
uniform float3 eyePosition,
uniform float3 Ke,
uniform float3 Ka,
uniform float3 Kd,
uniform float3 Ks,
uniform float shininess)
{
float3 P = position.xyz;
float3 N = normalize(normal);

// Compute emissive term
float3 emissive = Ke;

// Compute ambient term
float3 ambient = Ka * globalAmbient;

// Compute the diffuse term
float3 L = normalize(lightPosition - P);
float diffuseLight = max(dot(L, N), 0);
float3 diffuse = Kd * lightColor * diffuseLight;

// Compute the specular term
float3 V = normalize(eyePosition - P);
float3 H = normalize(L + V);
float specularLight = pow(max(dot(H, N), 0), shininess);
if (diffuseLight <= 0) specularLight = 0;
float3 specular = Ks * lightColor * specularLight;

color.xyz = emissive + ambient + diffuse + specular;
color.w = 1;
}

This code takes in our parameters that we pass in our C++ code to compute emissive, ambient, diffuse and specular lighting.  Emissive and ambient are fairly easy to compute, however diffuse and specular require some more work.

Emissive Light

Emissive is the light that is emitted or given off by a surface.  This can be used to stimulate glowing
Equation: emissive = Ke
Ke is the materials emissive color

Ambient Light

Ambient or ambience is light that has bounced around from different objects.  This can be used to make your environments better.  You can have a grey ambient for smoggy cities or a nice bright yellow ambient for forests and nature environments.
Equation: ambient = Ka * globalAmbient
Ka is the material’s ambient reflectance
globalAmbient is the color of the incoming ambient light

Diffuse Light 1

Diffuse light is reflected off a surface equally in all directions.  Even if an object has small nooks and crannies, the light will bounce of its rough texture
Equation: diffuse = Kd * lightColor * max(N dot L, 0)
Kd is the material’s diffuse color
lightColor is the color of the incoming diffuse light
N is the normalised surface normal
L is the normalised vector toward the light source
P is the point being shaded

Diffuse Lighting 2
Specular Light 1

Specular lighting is light scattered from a surface around the mirror direction.  It is only seen on very shiny and metallic materials.  Unlike the above types of light, Specular depends on where the viewer is looking at for it to work.  It also takes into account how shiny a surface is.
Equation:  specular = Ks * lightColor * facing * (max(N dot H, 0))^shininess
Kd is the materials specular color
lightColor is the color of the incoming specular light
N is the normalized surface normal
V is the normalized vector toward the viewpoint
L is the normalized vector  toward the light source
H is the normalized vector that is halfway between V and L
P is the point being shaded
facing is 1 is N dot L is greater then 0 and 0 otherwise

Specular Light 2

Then you add all the lights together and that is lighting in a nutshell.

Fragment Lighting

Thank your for reading,
– Moose

Common to Extraordinary

Hello,

Before we begin, I am going to try to build this game using a few of the 14 forms of fun as a bit of a template.

  • Beauty
  • Immersion
  • Intellectual Problem Solving
  • Competition
  • Social Interaction
  • Comedy
  • Thrill of Danger
  • Physical Activity
  • Love
  • Creation
  • Power
  • Discovery
  • Advancement and Completion
  • Application of an Ability

Among these the ones we will be focusing on

  • Immersion
  • Intellectual Problem Solving
  • Social Interaction
  • Thrill of Danger
  • Advancement and Completion

Pick a Profession

You play as a class.  A class of high school students.

Inciting Moment

While in the middle of a weekly school assembly word breaks out that a couple armed gunmen have entered the school.  Immediately everyone goes into shock and enters their school lock down procedure.

Each class is assigned to a teacher and they must stick with that teacher ad follow their orders.

The gunmen have set up patrols around the school and booby traps.  They also have set up short range EMP’s.  Your task is to try and find a way out to call for help.  The first one who makes it to an exit wins.

The Game

The game begins when you pick a teacher to follow.  Each teacher has their own strengths and weaknesses along with a special ability.

Once you pick a teacher you traverse through a board game in the shape of a floorplan of your school.

Board Example 1
Board Example 2

Players will start in the gymnasium and will try to traverse through the school on a per turn basis using cards like Munchkin.

The board will be broken up into segments and players will be able to pick and travel in any direction they want.  There will be different exits placed in equal intervals across the board.

Teachers

Each teacher will have an attack, cunning and Intelligence skill level.  Attack determines how strong they are at taking out the gunmen, cunning their skill to deceive the gunmen and intelligence determines their ability to outsmart the gunmen.  Each skill is on a scale from 1 to 5.

Some teachers will be able to physically overpower the gunmen, others will try to sneak and entrap them and the intelligent ones will create items to take out the gunmen.

Some of the teachers the player can pick are:

  • The Cute Substitute Teacher
  • The Physics Teacher
  • The Chemistry Teacher
  • The English Teacher
  • The Home Economics Teacher
  • The Principal
  • The Gym Teacher
  • The Comp Sci Teacher
  • The Dance Teacher

Teacher Stats – A/C/I

Cute Substitute Teacher - 1/5/2

The substitute teacher’s special ability is to use her sex appeal once every 3 turns to get out of a battle.

The Physics Teacher - 2/2/4

The physics teacher’s special ability is to loose all his intelligence to gain maximum attack once every 3 turns.

The Chemistry Teacher - 1/2/5

The chemistry teacher can create special bombs to disorientate and distract enemies once every 3 turns.

4874142-teacher-behind-the-desk--vector-illustration.jpg (400×362)
The English Teacher - 1/3/3

The English teacher can confuse the enemy with words once every three turns

The Home Economics Teacher - 3/2/2

The Home Ec teacher has the ability to increase her attack to maximum by equipping her cutlery once every 3 turns.

The Principal - 4/3/2

The Principal has the ability to re-allocate his stats once every three turns.

The Gym Teacher - 5/2/1

The gym teacher has the power to move two places once every 3 turns

The Computer Science Teacher - 2/2/5

The computer science teacher can hack into the security system to set off the fire alarm to disorientate an attacker once every 3 turns.

The Dance Teacher - 3/4/1

The dance teacher can re-allocate her stats once every 3 turns.

Deck of Cards

There will be three decks of cards.

One is a loot deck with upgrades and items for the teachers to equip to increase their stats and buff themselves.  The player can only draw from this card when he lands on a space that indicates there is loot, a chance card lets him pick up from the deck or if they defeat a gunmen.

The other is a chance deck.  Every time a player moves into a spot on the board they must draw from this deck.  This deck contains everything from de-buffs, gunmen, movement cards and more.

The last deck is an exit deck.  Once the player reaches an exit on the board, they must fulfil a final challenge as stated on the card.  This can be anything from defeating a boss gunmen to completing a challenge.

Loot Deck

Some of the items in the loot deck will be: (all items temporarily increase a stat)

  • Reading glasses: Increase your Intelligence by 1
  • Fresh Apple: Increase your Attack by 1
  • Body Spray: Increase your Cunning by 1
  • Gym Socks: Throw these at a gunman to evade him and move on
  • Coordinated Assault: Work with your class to take down a level 3 and under gunmen

Chance Deck

Some of the chance deck items will be:

  • Gunman Level 1
  • Gunman Level 2
  • Gunman Level 3
  • Gunman Level 4
  • Routine Check: A group of gunmen arrive, you and your class run to the nearest class and wait 2 turns for them to leave
  • Scout Alert: You must send half your class to check ahead to move two spaces next turn.  Your stats are halved next turn.

Exit Deck

Some of the final challenges are:

  • Gunman Level 5
  • Booby Trap:  There is a bomb at this exit, it went off when you tried to open the door.  You loose one of each stat and must find a new exit.
  • Freedom: You lucked out, this exit is free.  Go call the cops!

Combat

When you draw any of the gunmen cards, the combat turns will go as follows

  1. Depending on their level you would need to have one skill high enough to beat that gunman
  2. If you cannot beat that gunman you must use an item
  3. If you have no items you may use an ability
  4. If your ability is on a cool down the gunman escorts you and your class to a classroom where you are grounded for 2 turns.  All your cards are confiscated.

 

Galvados: The Pillar of the Roman Empire

Galvados: Roman Warrior

Time Period and Place

During the Ancient Roman era in 1st Century B.C. during the reign of Julius Caeser, Galvados lived.  Galvados went from a slave in the gladiator arena to a decorated bronze knight of the Roman Republic.  Galvados rose to fame during the Gladiator War (Third Serville War) where he fought against the slaves and Spartacus.

Interview Questions

What is your Name? Gender? Race? Religion? Age?

Lentulus Batiatus my lanista named me Galvados after I saved his life.  I am a Thracian born in the land of Thrace on 90 (B.C.).  I lost faith in the gods after I killed one of them.

You seem like a man of few words, am I right?

*Grunts*.

Were you a slave? Which God did you kill?

My tribe was ambushed by Glaber and I was sold to Batiatus after I killed 40 Romans in the arena.  I ended the life of Spartacus.

Spartacus was not a god to many people, was he not a fellow Thracian and a brother in the Arena?  Why did you not fight alongside your gladiator brethren during the war?

Spartacus was a god to the slaves.  He tried to train skimpy slaves to wield sticks while fighting against Romans covered in iron.  I had won my freedom in the arena and Crassus offered to train me as a centurion to later become a Legatus.  I fought in the front lines while leading my men to push Spartacus toward the mountains in Petelia.

Last events of the war in 71 BC
What year is it now? What are your plans now that the war is over?

It is 50 (B.C.) and I have been asked to watch guard over Gaius Julius Caesar.

What about your parents and how you were growing up, did you struggle and if so in what way?

*Grunts then laughs*.  You really know nothing of Thracians do you.

Well then, how would someone stereotype you at a glance?

My bronze armour.

Where did you get the armour? It seems custom made.

I told Crassus that I wanted to fight alongside my men.  He did not want me falling in battle and ordered several Blacksmiths to create this suit of armour.  The large two handed sword was forged a by a master blacksmith and he named it Nerio after the goddess of war.

What about the Helmet? I have been told that you never take it off.  You are even wearing it now.

I lost my identity the day I became a slave.  The man you see in front of you now is a Roman warrior.  My face was that of a slave.

You seem lonely, do you have a significant other? Best friends?

Glaber took my wife as his house slave when he invaded my tribe.  He killed her when I was still in the arena after I threw a spear at him as he sat in the imperial box watching my fight.  I killed him during an ambush by Spartacus and his men on Mount Vesuvius.  Spartacus let me leave unharmed.  You could say that Spartacus was my only friend.

I am interested in you relationship with Spartacus.  He was your friend and a brother in battle.  You say you ended his life, but his body was never found?

Spartacus and his men are dead.  We are members of the same barbaric tribe that is near its extinction.  The relationship we have is the same as you and other people of your race.  Is this an interview about me or Spartacus?

You, I am sorry.  What is your economic situation?

Money is not something I value.  I worked under the richest man in Rome (Crassus).  As long as my armour does not rust and my sword is sharp I will be a happy man.

What was your relationship with Crassus?  How has his death affected you these past 3 years?

Crassus saw my skill as a man-slayer after I almost killed my doctore (gladiator teacher).  He saw to it that I had my freedom and I was looked after.  After his death I guarded his sons until the Republic asked me to help Julius Caesar.

Crassus ruled with an Iron fist, he revived decimation and punished his troops.  He ordered the crucifixion of over 6,000 slaves to teach Rome from ever rebelling again.  Other people saw him as a tyrant, what do you say now?

I am not other people.

What about the decimation, having troops kill their own comrades?

We won the war, even when we were outnumbered by the slaves.

Where does your allegiance lie? Can you be trusted by your friends? What are your vices?

Right now I fight for the Roman Republic.  The men under my command can trust me.  Friends and women just make men weak.

You seem like you live for battle, do you enjoy killing other men?  What gives you contentment?

I enjoy the thrill of fighting.  Slashing a man’s chest to see his intestines bleed out is gratifying.  I miss the roar of the fans in the arena when you decapitate your enemy.

I guess that means that you do not fear death?

I fear I will not die a noble death.  If a man is able to best me in combat, he is worthy to take my life.

What is one secret about you that no one knows about you?

*Grunts*.  This interview is over.

Biography

  • Given Name: Galvados.  Meaning: Protector.  Comes from the word galvanization
  • Birth Name: Aspios.  Meaning noble, power, grace, beauty, strength and freedom.
  • Born: Thracian/Thrace
  • Current Location: Rome
  • Age: 40
  • Height: 6′ 0″
  • Weight: 240lbs with armour 300lbs with sword 325lbs
  • Religion: None
  • Hair Colour: Brown
  • Skin Colour: Light Brown
  • Eye Colour: Unknown
  • Language: Latin, Greek and Thracian Language

Strengths

  • Super human strength
  • Sword mastery
  • Champion of gladiator combat
  • Expert hand to hand combat skills
  • Insane endurance
  • Dominant personality during leadership
  • Powerful military leader
  • Intimidating presence

Weaknesses

  • Intimidating presence
  • Unknown identity
  • Not good with women and children
  • Barbaric personality
  • Armour makes him slower
  • Trouble with relationships and human contact
  • Blood thirsty
  • Years of war and battle will take a toll on his body and his mind
  • Fairly emotionless outside of battle

Personal History/Story Arc

Galvados was born in a barbaric tribe known as the Thracians.  A man’s strength in battle proved his worth as a human.  Weaker men were considered women and left to do feminine tasks.  Galvados became a great warrior by helping his fellow men protect the tribe against other barbarians.  He falls madly in love with a beautiful Thracian woman named Naevia.  She becomes his world shortly after their marriage.  Galvados was once an amiable man who cared about his tribe and its defence.  Only few knew him as ‘Aspios’, his birth name.

Map of Ancient Rome

During a large scale battle with another barbaric tribes, the Romans ambush the town absent of its warriors and drag the slaves over the Mediterranean Sea to Rome.  When Galvados accompanied by Spartacus and other Tracians arrive to their town they are ambushed by Gaius Claudius Glaber and his small army.  Tied up and placed on a boat headed straight for the Arena, Galvados and Spartacus’ lives were about to change.  Galvados and Spartacus were both concerned about their wives and grew a brotherly bond at this point.  They tried to fight their Roman captors and escape several times, but were only met with punishment by a whip.

When they arrived in Rome they were sent to the Arena to test their skills in combat.  Spartacus and Galvados fought side by side and took out a mix of 40 Roman warriors.  Glaber demanded they be executed but Batiatus wanted to purchase these slaves.  It is well known to many Romans that Thracians are barbaric individuals that hold honour in battle and answer to no one.  Training a Thracian is a near impossible task, yet Batiatus just purchased two of them.

While in Batiatus’ ludus (gladiator school), Galvados and Spartacus were trained by the doctore Oenomaus.  At the time the current undefeated champion was Crixus, he was one of Batiatus’ top gladiators.  Spartacus was a difficult man, and constantly fought with his captors and the other men.  Galvados on the other hand was eager to learn and fight.  He had heard of Gannicus, one of Batiatus old gladiators who was granted his freedom.  Galvados was told if he became the champion, he would be given his freedom so he could look for his wife.

Spartacus was in a similar predicament however, Batiatus told him that he would look for Spartacus’ wife in return for his obedience.  Batiatus on the other hand had found Spartacus’ wife and ordered her dead.  In one of Galvados’ previous battles, he saw Glaber watching and threw a spear towards him, missing by an inch.  Enraged Glaber killed  Galvados’ wife and sent the head to Batiatus.

One of the slaves in the house attempted to kill Batiatus, Galvados reacted quickly and saved Batiatus’ life.  Batiatus rewarded Galvados by naming him Galvados instead of referring to him as the Thracian.

When the time came, Galvados had bested Crixus in combat and his next match was one with his good friend and teacher Oenomaus.  Before the battle Spartacus had found out that Batiatus had killed his wife and wanted revenge.  Spartacus was planning a rebellion and wanted Galvados to help them.  Galvados refused and went on to fight his last battle.  During that battle Galvados bested Oenomaus and Batiatus pleaded to the Arena Master to spare Oenomaus’ life.

Marcus Licinius Crassus (General and Politician) was in the VIP crowd and saw Galvados match.  He granted his freedom and gave him a job.  Back at the ludus, Spartacus had found the head of Galvados’ wife and that Batiatus was hiding it from him.

At this point Spartacus had started his rebellion and later killed Batiatus.  Galvados was in Rome being trained as a Centurion and was being taught how to lead an army from Crassus.

A year passed and Spartacus was looting and pillaging while creating an army of slaves.  Galvados was sent by Crassus to eliminate Spartacus.  He was sent to work with a small unit to Vesuvius where Spartacus was hiding.  He was told to fight alongside Glaber’s men.  Spartacus had anticipated them and ambushed them.  Only Glaber and Galvados were spared.  Spartacus told Galvados about how Glaber killed his wife.  Galvados ripped Glaber apart and spread his body parts around Vesuvius.

Without anything to live for Galvados told Spartacus to end his life.  Spartacus convinced him to join their cause.  Galvados told Spartacus that he would not be able to win this war, and the only thing he could do was escape and save as many lives.  They then planned to retreat in a mountain pass where they would escape through a series of tunnels where a boat awaits to take them away from Rome.  Galvados volunteered to go back to the Roman army to help their plan.  Galvados returned to the Roman army with the news of Glaber’s death and the position of Spartacus’ troops.  He lead the attack killing many slaves and innocent men.

Galvados was slowly going mad.  First his enslavement, then the death of his wife and now the endless murder of many people.  The war was coming to an end and Galvados was becoming more and more robotic.  Crassus let him lead the battle ordering him to bring Spartacus’ head to him as a test of his loyalty.

During the battle, Galvados had cornered Spartacus and what was left of his men in the mountains.  Spartacus and his men began to escape as planned.  Galvados asked Spartacus to end his life in one final battle.  Spartacus refused.  Galvados mentioned that Crassus would probably kill him for not bringing the head of Spartacus.  Spartacus then began to carve out his flesh ripping out his slave mark along with his Thracian tattoo.  He dropped his bloodied skin on the lap of Galvados and left.

Galvados became a hero and the slayer of a God.  He received several accolades and gained to the rank of Legatus.

Defining Moments

  1. When Galvados became a slave he had forsaken his old identity.  He put on a helmet and became a ruthless gladiator.  He went from becoming a patriotic Thracian to a bloodthirsty monster who needed to kill for his freedom.  The only thing driving his rage was the idea that he would find and save his wife.
  2. Once Galvados entered Vesuvius with Glaber and he was ambushed by Spartacus was his last major defining moment.   He had always hated Glaber and once he found out he had killed his wife, Galvados went into an unstoppable rage.  At this point life was meaningless to him, yet Spartacus did not want him to die.  Galvados became a shell of his former self after this point.  He simply followed orders, like a robot.

Game Idea: Unnamed RPG

Overview

So I spent the last two weeks going over how I think RPG’s should be made in order to create a great user experience.  I talked about the difference between JRPG and WRPG and why I thought WRPGs are better.  To summarise, I think that WRPGs have better combat systems and more immersive  worlds as a result.  JRPGs have been focused on stories and the only great JRPGs that sell well in North America are the ones that try to copy some WRPG mechanics (Dark/Demon Souls, Monster Hunter and so on).

I have a game idea focused around a theme and a world that I have been keeping at the back of my head for a while.  Now that I have a blog and have some knowledge of Game Design behind me I think it would be a good time to start working on making this game a reality.

Game Idea

My goal for this game is to create a unique user experience.  The only time I find that I have a great RPG experience is when I play Bethesda RPGs like Fallout 3, Morrowind, Oblivion and Skyrim.  Why is this?  Their worlds are so large and offer so much freedom and randomness that as a player you actually feel like you are sculpting your own adventure.

Imagine a game like Dungeons & Dragons (Tabletop RPG).  While I have never played a game, the basics of the game are as follows:

  • Each player controls a single player
  • Players work together in a party of adventurers where each member has their own speciality (warrior, mage, healer, etc.)
  • Each player directs the actions of his or her character and its interactions with the other characters in the game.  This is done using verbal impersonation of the characters by the players, while also employing a variety of social and other useful cognitive skills, such as logic, basic mathematics and imagination.
  • Items required to play the game are the rulebooks, a character sheet for each player and a number of polyhedral dice.
You essentially sculpt your character to whoever you want them to be, then allow them to roam around in a world as you see fit.

While I obviously don’t have the time and resources to create a full 3D world as expansive as the Elder Scrolls and Falllout games, I do feel that this is a great idea, but not really a feasible one.  It is greatly out of scope for one person and is a bad way to start designing a game.  Games made by indie studios  should start designing their games through a unique mechanic or dynamic as opposed to a theme.

Since I am horrible at naming things I have yet to name the game or the setting.

Lore

The planet Earth has been around for about 4.54 billion years and humanity has been said to have originated about 200,000 years ago while reaching our behavioural modernity around 50,000 years ago.  Imagine a fantasy world where humans are not the only intelligent species around.  For the sake of this game, imagine a large province.

This province is populated by several races, some intelligent and some… not.  It has varying terrain like mountains, thick forests, dessert plateaus, large plains, swampy mangroves and tropical jungles.

  • Humans (60 year lifespan average)(Live in large cities around the plains):  The baby race.  Said to have evolved from monkey’s, humans still have similar characteristics to their primal counterparts.   The have only been around for a few thousand years but they are a nuisance to every other race.  They have short lifespans however their growth in one lifetime is huge.  They are very intelligent, being able to create massive structures and tools using the planet as their resource.  Humans have the physical capability to become great warriors and rouges.  Their intellect allows them to create objects that allow them to manipulate matter giving them artificial magical powers.
  • Dwarfs (200 years+)(Live in the Mountains): Dwarfs are very durable creatures.  It is said they had evolved from moles.  Dwarfs are very short creatures and great at operating in minimal sunlight.  They have great eyesight and smell.  Dwarfs are best known for their metal work.  They live and operate near mountainous terrain allowing them to gain easy access to minerals.  Dwarfs create large and intricate tunnels around the land to trade with other races.  They are rarely seen outside the mountains in the daylight.  Dwarfs make formidable warriors because of their metalwork and powerful bodies.
  • Light Elves (Over a 1000 years/Immortal)(Live in a floating city that hovers over the province): Light elves are the most unfriendly of the humanoid races.  They are a very powerful and mystical race that are able to channel energies unknown to other races.  This allows them to create unbelievable inventions and create different forms of matter.  Light elves have been rumoured to have evolved from butterflies which is why each light elf can fly.  Light elves are very independent creatures that despise humans and other races.  Light elves make powerful mages and healers because of  their mystical powers
  • Dark Elves (100 years+)(Forest): Dark elves are a race created by a cross breed between light elves and humans.  They were banished from the Light Elf world and settled in the forest where they created a small community.  They have a mix of the mystical Elf power but their human blood makes them mortal.  Due to the cross breed they have also lost the ability to fly, but in return they gain immense strength.

Those are the humanoid races.  Next come the more beast like races.

  • Orcs (200+ years)(Dessert): Orcs are huge red beasts that terrorise the province.  They live in a giant Pit in the dessert in the harshest conditions.  They are very primal in nature and only elect a leader by his power.  They venture into the jungles to scout for food. They are a mix of Alligators and Rhinos.
  • Trolls (100+ years)(Swamps):  Trolls are an aquatic race.  They are a more intelligent race then the Orcs, however they are still very primal.  They live in an underwater city surrounded by swampy mangroves.  Trolls look like a mix of Salamanders and Toads.
  • Goblins (50+ years)(Jungles): Goblins are tiny Orcs.  What they lack in strength they make up for in numbers.  Goblins outnumber every race put together and more. They lack a community and a leader, instead they live in packs atop the jungle trees.  Goblins are tiny and scrawny versions of Orcs.
Aside from those races, the world will be populated by other fantasy creatures that the player will be fighting with or teaming up with in the story.

The other main creature that will be in the game are dragons.  Unlike other games, dragons will not be some evil beings that must be slain.   Instead, these dragons are guardians.  Not much is known about these dragons and the only race that knows much informations about them are the Light Elves.  Dragons are elemental guardians that keep the balance of nature flowing.

  • Fire dragon: In charge of the land and swims in the molten lava underneath the earth.  It maintains the flow of lava to while preventing earthquakes and volcanic eruptions.
  • Wind dragon: Lives in the sky maintaining the weather.  It controls the flow of wind preventing whirlwinds and weather storms.
  • Water dragon: Maintains the sea current and prevents flash floods.
  • Earth dragon: Lives in the surface maintaining the forests and mountains.  The Earth dragon keeps the mountains full of minerals and the ecosystem healthy.
  • Light and Dark dragon.  These are ethereal dragons that watch over the province.  They are similar to the Yin/Yang where one is positive and the other is negative.  The Light dragon believes in the goodness of creatures while the Dark dragon believes that every creature is evil.
The purpose of the dragons is to maintain the balance.  When a creature upsets the balance the dragons fight and argue creating bad weather and all sorts of disasters.  Once the dragons fighting is over, they take action.  This normally means the full destruction of the race that is causing the imbalance.  Many years ago there were different races and creatures, and they were ultimately defeated by a genocide from the dragons.

Theme/Conflict

The mains underlying theme of the game should be global warming.  What I am going for with this game is to create a controversial plot that is different depending on how you play it.  The player will be able to start the game while playing with any race and he is influenced by the NPC’s to create a decision.  Rather then the Paragon and Renegade system in Mass Effect or the Fallout Karma system.  This system doesn’t have a bad or good scale.  Your actions are biased by the race you play.

  • Human: If you start out as a human, you will see that humans have no regard for the planet.  They have a military monarchy that governs their society.  There are also several guilds in the town that work independently from the royal military.  There are mercenaries, wizards, priests, and thief guilds.  Once your human character is built, you will have a choice to join an independent guild where you are free to do as you please under the teachings on that guild, or to join the royal army.  The royal army is a strict place where you will grow to be a powerful warrior with a lot of power but you will be focused on the betterment and growth of humanity.
  • Dwarf: Dwarves are hard workers.  As a Dwarf you have a choice to either become a noble blacksmith, miner or to join the Dwarven army.  Dwarves believe in nature and only taking what they need.  While their community has a similar monarchy like the humans, they are much more friendly to other races.  They do not wish to dominate, but to trade and be friendly with the other races.
  • Light Elves: To other races they are snobby and evil.  However they are only being protective of their planet.  They believe in taking and using the minimal amount of resources, and everything must be recycled and reused.  They see the other races as wasteful and greedy.  Elves are a very religious society and because of it they have insane magical powers.  They specialise in all forms of magic from destruction to healing.
  • Dark Elves:  They are a nomadic race that move around the forest living in-tune with nature.  Whatever they take they give back and try to follow the same standards as the Light Elves.  They do not wish to advance and evolve with technology like the Humans, but instead they wish to live their lives.  Dark Elves love to party, sing and dance.  They are a very timid and passive race.  However each Dark Elf has immense potential to be great warriors and mages.
  • Orcs: Their goal is to prove their power.  They will fight anyone and anything.  They are a very barbaric race where a mans battle strength is his life.  The women Orcs handle all the day-to-day jobs while the men go out to prove their strength and bring food.
  • Trolls:  Trolls value power, however they are a more organised race.  They don’t have much conflict with other races, as long as they don’t enter their territory.  Trolls are a very independent race that lack the intelligence to advance as quick as the humanoid race, but are not as barbaric as the orcs
  • Goblins: They are treated as the Orc’s “bitch” workers.  They work for the Orcs doing crappy tasks in exchange for protection and scraps of food.  The other goblins live in the forest constantly fighting with the Dark Elves.

Story

I am sure that I am confusing the reader as to what the game is.  For now I have set up the setting and the races as well as their personalities.  The point of the game is to play as one of these races experiencing different viewpoints in the same story.  The story will have similar ‘choke points’ but the outcome will vary leading to a different fallout.

The main story is that you play as one of the many races in this province.  You begin to work your way up to someone of value.  By completing sidequests and building your player character to a decent warrior.  Later on you find out that the Humans are advancing and trying to take over some more territory.  They begin to create alliances with other races to negotiate a peaceful outcome.  Depending on the players actions, they will either maintain a good relationship with the humans, or cause a war.

The war is interrupted by the entrance of several angry dragons.  These dragons are angry at the races for abusing the natural resources at a rate faster then it can grow back.  Depending on the outcome, your race with side with the dragons or fight them.

Once that choke point is completed the race will either be fighting with the dragons for the destruction of the incompetent race or be fighting for their survival.

This game is essentially a giant war game where you build allegiances or enemies.  As a player you can also defect from your race to join the other side.  If you are a Human in the mercenary guild and you have become its master, you are in total control over that guild.  If the Royal army declares war on the Light Elves you may side with the Elves and fight alongside them.

I feel that this makes the game more unique offering several different outcomes every time the player plays the game.  In the end the player can live in peace with the other races, but be in constant fear of the dragons, or the player can kill the dragons and survive without ethereal judgement but at the cost of random disasters.

Gameplay

I would like the game to play out like an action RPG similar to the ‘Tales of’ games.  When you see an enemy you either fight them in real time with a party of 3 other characters or get teleported to a battlefield where you fight a mix of enemies.

Final Notes

I have not focused to much on the gameplay because I feel that if I were to build this game I would not have the resources to create all the art assets myself.  Instead I would create a 2D sprite game to test out how the story and decisions work while playing around with the battle system.

Thank you for reading
– Moose.

Shaders 102 – Code Integration

Overview

Today I am going to talk about how to integrate shaders into your code.  Starting with the layout of a shader program and how to integrate it in your code.

Basic Shader Code

Here is a vertex shader:

//vertex shader from chapter 3 of the Cg textbook

struct C3E2v_Output {
float4 position : POSITION;
float3 color : COLOR;
float2 texCoord : TEXCOORD0;
};

C3E2v_Output C3E2v_varying(
float2 position : POSITION,
float4 color : COLOR,
float2 texCoord : TEXCOORD0)
{
C3E2v_Output OUT;

OUT.position = float4(position,0,1);
OUT.color = color;
OUT.texCoord = texCoord;

return OUT;
}

Breakdown

The program first begins with an output structure as follows:

struct C3E2v_Output {
float4 position : POSITION;
float3 color : COLOR;
float2 texCoord : TEXCOORD0;
};

Since we know that this is the vertex shader, and it has to pass values to the rest of the graphics pipeline, this is structure is just some of the values that our shader will be using.  By defining an output structure we can manipulate the items inside it.  Basically this is like a variable declaration for a function where we would be outputting position, color and texture coordinates.

Last week we talked about how Cg has vectors and matrices integrated into their variable declaration.

  • float4 position : is essentially =[x,y,z,w] where w=1.  If this was written in C++ it would be float position[4]={x,y,z,w}
  • float3 color : is similar to the vector above, but this is used to represent our colour channels =[r,g,b]
  • float2 texCoord : is our U and V coordinates in our texture = [u,v]
While this program does not showcase the matrix declaration of Cg, here are some examples
  • float4x4 matrix1 : this is a four by four matrix with 16 elements
  • half3x2 matrix2 : this is a three by two matrix with 6 elements
  • fixed2x4 matrix3 : this is a two by four matrix with 8 elements
If you wanted to declare a matrix with some values, you would do it like this:
float2x3 = {1.0, 2.0,
            3.0, 4.0,
           5.0, 6.0}

 


Next we have our entry function:

C3E2v_Output C3E2v_varying(
float2 position : POSITION,
float4 color : COLOR,
float2 texCoord : TEXCOORD0)

This is what defines our fragment or vertex program.  This is similar to the main function in C/C++.  What this is telling us, is that our shader is taking in position, colour and texture coordinates.  We know that our structure above has the same parameters as our input, so we know that we are going to be manipulating these parameters and then outputting them.

Last we have our function body:

C3E2v_Output OUT;

OUT.position = float4(position,0,1);
OUT.color = color;
OUT.texCoord = texCoord;

return OUT;

First we start of by creating our structure object called OUT.  This code really doesn’t do much but set values in the structure equal to the inputs and output them to the next stage in the pipeline.  The interesting piece of code is the OUT.position = float4(position,0,1) part.  This takes the incoming position with only two incoming parameters (x,y) and converts it into a float4 by giving the last two variables a 0 and 1 value to get (x,y,0,1).

3D Graphics Application Integration

Creating Variables

So knowing how that code works is great, however implementing Cg code in your C++ code is where I normally spend most of my time working with shaders.  The actual shader code is fairly easy to work with, but integrating it in your Graphics Application is where the real pain is.  The Cg book doesn’t really cover this explicitly, however it does have examples in the API in your /Program Files/NVIDIA Corporation/Cg/examples/ folder.

To start there are a number of things you have to declare, I normally do these as global variables:

static CGcontext myCgContext;
static CGprofile myCgVertexProfile,
                 myCgFragmentProfile;
static CGprogram myCgVertexProgram,
                 myCgFragmentProgram;
static CGparameter myCgVertexParam_constantColor;

static const char *myProgramName = "Varying Parameter",
*myVertexProgramFileName = "C3E2v_varying.cg",
*myVertexProgramName = "C3E2v_varying",
*myFragmentProgramFileName = "C2E2f_passthru.cg",
*myFragmentProgramName = "C2E2f_passthru";

Obviously the names of these do not have to be the same as what I have written, but the idea is to teach you what each one is.

The first part of creating the CGcontext is the part I know the least about.  I believe it is the part where you initialise the shader program.  So just be sure to ALWAYS do this.

The next part is creating your vertex and fragment profile.  This is another thing to always do.

The next two parts are where you are given a lot of freedom.  The CGparameter will vary from program to program.  These are essentially parameters that you take in your graphics application and send to your shader.  constantColor is just a variable that we can send to our shader to replace the colour of every pixel or vertex.  Later on I will post on how we can send in parameters like diffuse light color, light position, attenuation parameters and much more.

The last part is the program names.  This is where you define your main function for each shader and the name of their file name.  Common names for each are fragment_passthru or vertex_passthru.

Initialise Shaders

The next step is where you physically create the shader program.  Somewhere in your glut loop you should create a initCg() void function where you place all your initialisations.  The book places everything in main, which I find to be stupid, so don’t do that.  It creates a lot of hard to read clutter.

myCgContext = cgCreateContext();
checkForCgError("creating context");
cgGLSetDebugMode(CG_FALSE);
cgSetParameterSettingMode(myCgContext, CG_DEFERRED_PARAMETER_SETTING);

myCgVertexProfile = cgGLGetLatestProfile(CG_GL_VERTEX);
cgGLSetOptimalOptions(myCgVertexProfile);
checkForCgError("selecting vertex profile");

myCgVertexProgram =
cgCreateProgramFromFile(
myCgContext,              // Cg runtime context
CG_SOURCE,                // Program in human-readable form
myVertexProgramFileName,  // Name of file containing program
myCgVertexProfile,        // Profile: OpenGL ARB vertex program
myVertexProgramName,      // Entry function name
NULL);                    // No extra compiler options;
checkForCgError("creating vertex program from file");
cgGLLoadProgram(myCgVertexProgram);
checkForCgError("loading verex program");

This code is fairly simple.  The beginning part creates the CgContext.  Then we create our vertex profile.  Lastly we tell the program where our Cg file is and the name of our entry function.  You would do something similar for the fragment shader.

The checkForCgError help your debug.  If anything goes wrong in the shader at that point, your cgError function will output an error code.

The other thing you can place in your initCg function is a GET_PARAM statement where you can pass variables to your shader program.

#define GET_PARAM(name) \
myCgVertexParam_##name = \
cgGetNamedParameter(myCgVertexProgram, #name); \
checkForCgError("could not get " #name " parameter");

GET_PARAM(modelViewProj);
GET_PARAM(globalAmbient);
GET_PARAM(eyePosition);

#define GET_PARAM2(varname, cgname) \
myCgVertexParam_##varname = \
cgGetNamedParameter(myCgVertexProgram, cgname); \
checkForCgError("could not get " cgname " parameter");

GET_PARAM2(material_Ke, "material.Ke");
GET_PARAM2(material_Ka, "material.Ka");
GET_PARAM2(material_Kd, "material.Kd");
GET_PARAM2(material_Ks, "material.Ks");
GET_PARAM2(material_shininess, "material.shininess");

The is an example of sending parameters directly to your entry function and to other structures you can make.  The first batch of code sends the modelViewProj matrix, GlobalAmbient colour and the eyePosition of the camera.  These would be items you list in your entry function input parameters.

The other batch of code is an example of you sending parameters to a structure called Material.  Material has emmissive, ambient, diffuse and specular lighting along with a shininess parameter.  This is helpful for creating virtual objects that reflect light differently so things can look like rubber or plastic.

 Enabling and Disabling

The last and simplest thing to do is to enable and disable your shaders during your OpenGL draw loop.

When you are drawing your objects, you need to bind your fragment and vertex shaders by:

//Enable Shaders
cgGLBindProgram(myCgVertexProgram);
checkForCgError("binding vertex program");
cgGLEnableProfile(myCgVertexProfile);
checkForCgError("enabling vertex profile");

cgGLBindProgram(myCgFragmentProgram);
checkForCgError("binding fragment program");
cgGLEnableProfile(myCgFragmentProfile);
checkForCgError("enabling fragment profile");

Once that is done you would go on with the rest of your draw calls and at the end of your draw loop you would disable them by:

// Disable Shaders
cgGLDisableProfile(myCgVertexProfile);
checkForCgError("disabling vertex profile");

cgGLDisableProfile(myCgFragmentProfile);
checkForCgError("disabling fragment profile");

Summary

That is pretty much a very basic description of how shaders are integrated into your C++ graphics application.

Thank you for reading,
– Moose

Shaders 101 – Intro

Hello!

Overview

I have read up to chapter 5 in the CG textbook (almost halfway done) and I thought it would be good to do a general summary of what I have learned so far.  Granted I might be misinformed or have fragmented knowledge about some aspects, but I hope I will be corrected in the comments.

What are Shaders and How Do They Work?

First of we are talking about the programming language Cg created by NVIDIA.  The point of shaders and the Cg language is to help you communicate via code with your graphics card to control the shape, appearance and motion of objects drawn.  Essentially it allows you to control the graphics pipeline, like a boss.  Cg programs control how vertices and fragments (potential pixels) are processed.  This means that our Cg programs are executed inside of our graphics cards.

Shaders are a powerful rendering tool for developers because they allows us to utilise our graphics cards.  Since our CPU’s are more suited toward general purpose operating system and application needs, it is better to use the GPU that is tailor built for graphics rendering.  GPU’s are built to effectively process and rasterize millions of vertices and billions of fragments per second.  The great thing about CG is that it gives you the advantages of a high level language (readability and ease of use) while giving you the performance of a low level assembly code.  Cg does not provide pointers and memory allocation tools.  However it supports vectors and matrices and many other math operations that make graphics calculations easier.

Cg is not meant to be used as a full fledged programming language.  We still need to build our 3D applications in C++ (or any language) then use our shader language (CG, HLSL, GLSL, RenderMan etc.) to optimise our graphics using the GPU.

The Graphics Pipeline

Graphics Pipeline: From the CG Textbook

In order to understand how shaders work, we have to have a general understanding on how the graphics pipeline (stages operating in parallel) work.  First your 3D application sends several geometric primitives (polygons, lines and points) to your GPU.  Each vertex has a position in 3D space along with its colour, texture coordinate and a normal vector.

Vertex Transformation

This is the first processing stage of the pipeline.  First several mathematical operations are performed on each vertex.  These operations can be:

  • Transformations (vertex space to screen space) for the rasterizer
  • Generating texture coordinates for texturing and lighting to determine its colour

Primitive Assembly and Rasterization

Once the vertices are processed, they are sent to this stage of the pipeline.  First the primitive assembly step assembles each vertex into geometric primitives.  This will result in a sequence of triangles, lines or points.

Geometric Primitives

After assembling the primitives will need to be clipped.  Since we are limited to a screen we cannot view the entire screen.  So according to our view frustum we clip and discard polygons (culling).  Once our screen is clipped our next step is to rasterize.  This is the process of determining what pixels are covered by a geometric primitive.

Rasterisation

The last important item in this process is for the user to understand the difference between pixels and fragments.  A pixel represents a location on the frame buffer that has colour, depth and other information.  A fragment is the data needed to generate and update those pixels.

Fragment Texturing and Coluring

Now that we have all our fragments the next set of operations determine its final colour.  This stage performs texturing and other math operations that influence the final colour of each fragment.

Raster Operations

This is the last stage of the graphics pipeline.  It is also one of the more complex stages.  Once the completed fragments come out of the previous stage the graphics API perform several operations on the incoming data.  Some of them are:

  • Pixel ownership test
  • Scissor test
  • Alpha test
  • Stencil test
  • Depth test
  • Blending
  • Dithering
  • Logic operations
This is pretty much the above process in a nutshell.
Pipeline In a Nutshell

Programmable Graphics Pipeline

So what was the point of talking about the pipeline?  Now that we know how the fixed pipeline works and how normal graphics API’s send information to be processed we can see where are shaders are executed and what they do.

Programmable Graphics Pipeline

The two important parts of this diagram are the programmable vertex processor that runs our Cg vertex programs and the programmable fragment processor that runs our Cg fragment programs.  The biggest difference between each one is the fact the the fragment processor allows for texturing.

Summary

Now that we know how the graphics pipeline works we can create programs to manipulate the pipeline however we want.  Next week we shall take a look at how to make programs for Cg and how they work in your 3D application.

Thank you for reading,
-Moose

Game Opinion: User Experience RPG Cultivation

Hello!

Overview

Today I will be giving my opinion on how I think RPG’s should be developed.

Rant

Last week I blogged about the differences between Japanese and Western culture and how that reflects in the games we create.  I said that Japanese developers are more focused on creating a story for the user to play and experience.  For example, playing as Tidus in Final Fantasy X, becoming the master of the Keyblade as Sora in Kingdom Hearts or playing as Yuri Lowell in Tales of Vesperia.  Japanese games normally have wide and expansive story lines and well built characters.  The gameplay (in my opinion) comes secondary to the world.  When I play a JRPG I feel like the gameplay is simply the glue in between each story point.  Cheap glue.

Western RPG’s on the other hand give the player more control over everything.  Instead of building a world for you, they build a world around you.  In Skyrim you are the Dragonborn, a beacon of hope and power destined to save their land.  In Mass Effect you play as Commander Shepard an alliance Spectre and the slayer of the Reapers.  Western games give very little back story to the player character to allow the players to be whoever they want.  They drop the player into a very large world and give them hints about what they should be doing and an end goal.  How the player reaches that end goal is different for every user.

What is a more rewarding user experience?  Being given the freedom and unlimited potential to achieve your goal or to be tested to see if you have the skill to reach someone else’s goal?

I personally think the best games are the ones that give the player lots of control over how they want to reach their goal.  This makes the use experience feel genuine and unique.  In many JRPG’s the games are fairly linear.  Given only one path to follow eventually gets boring.  WRPG’s give the player more decisions to make offering more of a challenge.  Players that are given better challenges have a better chance of getting into “the flow.”

I think the most important part in any RPG is the amount of decisions that are given to a player.  If someone would like to play a role, they should be given a large amount of choices that allow them to make a decision that they want to make.  Even though as game designers we have to give the player some limitations, by offering many choices the player assumes they are an unlimited amount of outcomes.

However, the issue with WRPG’s is that they fragment their story and world.  This can be seen as both a good and bad thing.  Good for players new to the genre or other players that would like to go around and have fun with their unlimited freedom.  It is bad because the plot of the game becomes fairly shallow in many games.  You rarely play WPRG’s with a very compelling storyline with the freedom of a Bethesda game.   I do not think the point of many of these games is to immerse you in their story, but to immerse you in their world.

In the end rather then defining these games as JRPG or WRPG we should define as their own genre like action or FPS.  While they both are “role playing” games, they are different sub-genres.  We should refer to them as story based RPGs and player based RPGs.

We call Mass Effect an RPG, yet it’s gameplay shows it to be a shooter.  Similarly, even though Call of Duty has a levelling system we do not refer to it as a RPG but as an FPS.  What does this tell us?  In Mass Effect, the player is given more control over the way the story plays out and the levelling system has a lot of depth and choice to it.  You can be a soldier specializing in guns or a Vangaurd specialising in biotic abilities.  In Call of Duty the only choice the player makes is on their weapon/perk load-out.  This proves that while many games may share similar dynamics and mechanics, their end aesthetic is what defines their genre.

Summary

Overall while JPRGs and WRPGs are both effective tools are portraying different types of games, I strongly believe that WRPGs are better user experiences.  If WRPGs had stories with more depth and cinematic and enjoyable experiences that are fully user determined, they would be perfect RPGs.

Thank you for reading,
-Moose

Technology: New Controller Design

Hello!

I have recently come across an interesting article that showcases this new input device (controller) with another red ‘tactor’ in the middle of each joystick that can vibrate and move independently of the controller.

A new direction for game controllers: Prototypes tug at thumb tips to enhance video gaming

The cool thing about the controller is that it brings a new level of interaction for console games.  Normally the only indication a user can get from the controller is a small vibration.  This is normally used to emulate car crashes and explosions.  This new vibrating tactor allows for more ways of physical interaction with the player.

  • First you can see the user moving both the white pad and the red tactor like a normal joystick
  • You can also see the internal tactor moving independently giving an interesting user response
  • They begin showing examples of in-game applications where the tactor is useful

When moving in prone we we the tactor begin to swivel and move similar to the way we snake crawl when moving in prone.

When bouncing we see the tactor jump up and down.

I just thought that this was fairly interesting and worth sharing.