Post-mortem

This is the last semester and our game is published to steam Greenlight.

This semester I finished the car crash scene and night 2 scene. I also did some trivial stuff such as climbable ladder and pause screen.

Most of the time I was fixing bugs. Most bugs are text display. We support both keyboard + mouse and gamepad, so we need to show different hints to the players. For example, when playing with keyboard and mouse, we show player “Press F to open the door”. When player is using a gamepad, we need to show “Press X to open the door”. This seems an easy task but actually it could cause a lot of bugs.

Another pain is oculus rift. Even if it works fine in the editor doesn’t mean it can also works well with build version.

GDC 2015

Last year I bought expo pass which means I missed almost all the technical talks. This year I bought tutorial pass so I can listen to most talks I’m interested in.

After these days, I felt the independent developers are more willing to share their experiences. The big companies only give a brief talk about their technology and most time indie developers will give you the detail about how do they do things.

I also met some students from other universities so I had a chance to compare our program with theirs. The ETC program from Carnegie Mellon University is all about project. They don’t have much class and almost all their time is spend on projects and they do have lots of projects. But from what I heard, they are more willing to spend time on their own projects than those university projects. The University of Southern California is more like us. They have different classes and they also have to finish a project. The New York University is very different from others. Their program is for designers and they will learn art and programming as well.  I cannot tell which program is better but if your goal is to become an indie game developer, NYU might be a better choice because they teach you how to design your own game.

Game Engineering 2 Assignment 13

Objectives:

1. Learn how to draw line.

2. Create a demo scene to show the engine.

Debug Line

Direct3D has a build-in primitive type “D3DPT_LINELIST”. When calling DrawPrimitive using this type, Direct3D will consider the vertices stored in vertex buffer are a list of isolated line segments.

Before calling DrawPrimitive, I need to modify the shaders:

  • Vertex Shader: since I am passing world coordinates, I don’t need do a model-to-world transformation.
  • Fragment Shader: the only thing I need to do is to output vertex color I stored in vertex buffer.

Architecture

engine

Most of my code resides in Engine or Game folder. Everything in a scene is an object which is inherited from interface IObject. Each object can have one controller that control the behavior of the object. All the concrete controllers are inherited  from IController and located in game folder. If you are familiar with Unity, you can think a controller is like the script we created in Unity.

I have a ContentManager class that manages all the resources (mesh, shader, texture, etc.)  So for every resource there will be only one copy in the memory.

Technical Detail

Previously I used ID3DXConstantTable to set shader constants. Now I’ve changed my shader code to use registers. This allows me to set all constants in one call.

Here is a shader I used in my game:

shader-r

You can see I bind g_transform_worldToView to register c0, g_transform_viewToScreen to register c4, g_transform_modelToWorld to register c8. Every register can hold 4 floats and each of my constant is a 4×4 matrix so it will take 4 registers to store one matrix.

In my code I created a struct to hold all constants:

vs_constant

Now when I want to draw my object, I set constants like this:

set-constant

When I draw debug line I only need first 2 constants, in that case I just need to change the number from 12 to 8.

Demo

Here is a screenshot of my demo:

final_game

W, S to control the aim of the cannon.

Space to fire a bullet.

The number on the top right is the life of the box, when it comes to zero and player wins.

Fire has a 3s of cool down time.

Download Executable