Tuesday, March 26, 2013

Reconsidering UDK

This week we are going to Game Developer's conference which is held in San Francisco every year. As our team Hack n Hide won't be working on The co-signers for a week we are re-considering UDK for our game.
         This discussion on switching to UDK started when our professors told us that the dates of the Alpha and Beta version of the game are flexible. We programmers had a meeting with Bob in which we talked about the challenges we will face if we try to switch engine at this point of time. We have always been wanting to use some other engine for the game but because Unity3D suited our needs the best we settled for Unity for our final game. But I personally think that the game will suffer graphically if we continue to go with Unity. Unity doesn't provide good graphics capability and the way this Engine works might give us hard time with maintaining the FPS to 60 at later phases. 

Pros of using Unity:


  • Unified asset pipeline. No need to spend time on resource subsystem at all, no buggy import routines to write and fix: just drop a file into folder, and it works.
  • Integrated level editor. No need to spend time on level tools: just get straight to business.
  • Great tweaking and debugging support: all your gameplay variables are shown right as you play, and can be changed on the fly too - and all this without writing a single line of code. Pause the game anytime, or step through code one statement at a time.
  • Quite comprehesive library of ready-made components. Rendering, sound, physics, controls - a lot of "boilerplate" code is already written.
  • Mono as a script host. While one can argue about merits of C# as a language, Mono's base class library offers a wealth of functions. Collections, I/O, multithreading, and insanely expressive LINQ all speed up development considerably.
Cons of using Unity:
  • Doesn't give you a feeling of making the game from scratch.
  • A bad mark on all the Engineers (Industry looks for candidates having UDK or Cry experience)
  • Graphically poor if Shaders are not written.


 So, now is the right time to research and meet the industry people at GDC and talk to them about the impacts of using Unity for your thesis game.


Friday, March 22, 2013

Graphics Assignment 9

The first part of this assignment was Environment mapping. Creating a new effect which uses cubemap as a texture to produce a good environment map is what I have done in this part of assignment. Basically, I have two meshes, a sphere and a plane both of which use the same material.

Calculating Environment Map:

First, calculate the reflection direction. For that reflection direction which is a Vector3 get the rgb value of the cubemap. That rgb value will have the value of the cube map depending upon the view direction. For instance, looking in +z direction should show the reflection of the +z side of the cube map on the floor beneath.
Using Fresnel effect and Schlik's approximation: The fresnel effect is used to get the amount of reflection and refraction of light by surface. I am using fresnel effect to get more reflection as the angle of view gets more perpendicular to the normal of the surface of reflection. 
Then Lerping the value between the reflected rgb color and the diffuse color for some constant will interpolate the value between these values to give out diffuse color.
Using that diffuse color as a part of the o_color, like before, should show the effect.


Wobbling Effect:

Passing the projected position to the fragment shader will give the 2D image of the screen co-ordinates of the meshes.
Converting that 2D image from -1 and 1 co-ordinates to Directx' co-ordinate system of 0 and 1 and also inverse of the y-axis of the image.
Creating a distortion with a sin modification and adding it to the the above step will give out a distortion per pixel.
Sampling the opaque buffer texture for that distorted co-ordinate gives out the cool wobbly effect.

Pix showing the opaque buffer texture:

Thursday, March 14, 2013

Spring Break means more Brainstorming!


I have been playing Co-signers for a long time with Vaibhav. Over this spring break we are brainstorming over new game ideas and trying to include cool mechanics and weapons. As it is the spring break I have a lot of time to complete my classwork backlog and play cool games, that includes Co-signers.
 
  While playing the game I couldn't resist but compare the thief side to Erie. Erie is so beautiful and that mechanic of spraying the wall to draw cool stuff and to remember directions is my personal favorite mechanic. I want The Co-signers to go similar lines and include some cool mechanics and gadgets for the Pointman. To start with maybe we can add cookies to the pointman side. The pointman can place a cookie near a guard which will attract the guard and by eating it the guard will go to sleep for 1 minute or so. Another thought is that the Pointman should have some control over the hacker like, after pointman should give the hacker some puzzles to solve. Or the hacker can't unlock the nodes further because he is asked for password at a node which only the pointman can give after reaching a certain room or making a guard sleep and then steal from him.

 I couldn't think much on the hacker side. It's because a 2D interface is new to me and designing a game based on that is novel to me. But the hacker side can get more gadgets or tools too on his side. Like, power to lock doors to safe the Pointman from the guards.

 I am not a designer but I can design and I love to think about the design of games.

Friday, March 8, 2013

Graphics Assignment 8

This week's assignment was on Normal maps. Basically the idea behind this concept is that we take the normal per vertex of the normal texture and multiply it with TBN ( Tangent, Binormal and normal) matrix in the fragment shader. TBN is a 3x3 matrix in that specific order that is, Tangent's xyz coordinate as first row, Binnormal's xyz as the second row and the Normal's xyz as the third row. We take the Tangents and Binormals per vertex of the mesh from Maya while exporting. 
  
  The tangent and binormal in model space are passed to the vertex shader. Tangent and Binormal in world space are calculated by multiplying with ModelToWorldTransformation, the similar way we did for calculating normals. Now, the TBN in world space are passed on to fragment shader. In fragment shader, another sampler is used to sample for the normal Map. That sample is multiplied with TBN matrix which gives out normal of the texture in world space. So, I am converting texture normal in the texture space to texture normal in the world space, which gives me the cool effect of bumpyness without having to deal with the complex geometry of the model.

Changes in MayaExporter:

  I now include tangents and bitangents in the text file while exporting the model from Maya.
  
 I have changed the Maya's right hand convention to left hand as Directx is left hand-

  •   By changing the z coordinates of the position, normal, tangent and binormal
  •   By negating the binormal xyz
  •   By changing the order of  indices, that is, the winding order
  •   By changing the V coordinate of the UV's to V=1-V
Mesh Movement: WASD QE
Light Movement: IJKL
Camera Movement: NUM8,4,2,6



The Co-signers

I am now working on The co-signers with team Hack and Hide. Choosing between Co-signers and Viynl was a difficult bet. I loved both the games equally well.

Things I love about Co-signers:

I find the idea of asymmetric game play novel.
The use of different consoles.
A pretty huge game and insanely challenging.
Good theme of students clearing their debts.

Things I love about Viynl:

It's a music game. I love it.
Probable use of different languages and platforms.

It was an impulsive decision of choosing Co-signers over Vinyl. I had to choose one and the last point on which my decision was based was "Which game would be more challenging?".

Friday, March 1, 2013

Graphics Assignment 7

This week I started re-structuring my code as John-Paul said it's hard coded and not completely data-driven. I have created a cScene class in which I have set light and camera, which was previously in cRenderer. Now nothing is hard-coded and when the entities data is changed in the text file, the project works without having to change any code. 

  As I prefer to continue on my own assignment instead of taking my classmate's assignment and working over it, the next part of the back log was sorting the materials and effects, a part of 5th assignment part B.  I used a simple sorting algorithm which sorts the effects first and then sorts the list of entity for same material. 

  For the 7th assignment I have implemented three different types of alpha blending. The first one is partial alpha blending in which I set the  SRC to SRCALPHA and DEST to DESTALPHA. For additive SRC to ONE and DEST to ONE. For, binary alpha, as required, I have turned off the alpha blending.

  I have sorted the opaque entities before loading them in mesh or effect lists. On every draw call I update only the entities with translucent material according to it's distance from the camera for proper alpha blending.

   I have also added  Q,E keys to change the camera position in Z-axis for testing the alpha blending.

 One problem that I couldn't quite solve was the flickering of the two cylinders. I am not sure but it may be because of the cylinder being high poly and as I am sorting it every frame for alpha blending to be proper, it takes the time to render.

  I tried to debug the project in PIX but it's giving me errors in both release and debug build. When I try to debug the release build, the Pix stops working. In debug build it shows the window and the meshes and everything but on exiting it doesn't produce the single frame capture log.

Original Code

Updated code