Wednesday, January 26, 2011

Demo Day

Each semester, USC hosts a Demo Day where Computer Science Games students present their game projects to professionals in the industry. In December 2010, I presented The Bridge on behalf of my team. The media coverage has just been released, which you can check out here:

http://viterbi.usc.edu/news/news/2010/gamepipe-lab-hosts.htm



The picture of me in the article is nothing short of ridiculous. :P

Monday, January 24, 2011

Microsoft Word Makes Me Sad


I have a love/hate relationship with Microsoft Word. I trust it to get my work done securely and professionally, but my day-to-day experience with the product is often plain frustrating.

Take for example, this outline I began putting together in Microsoft Word 2008 for Mac


I have pasted a URL, and want to make it a hyperlink. How can I do that?



Ah yes, there it is, in this huge menu. Let's select the Hyperlink option.



Whoa, a huge popup with tons of information I don't want to read. Let's press ok and see if it works...



It looks like the URL became a hyperlink, but it also screwed up my bullet point formatting.

:(
 

Monday, December 13, 2010

Vector Math

I ran into a fun  problem while working on The Bridge today:



In my process of refactoring the ship engine, I added a rotational thruster to turn the ship. When the player issues a Turn Clockwise command, the Navigator AI will apply the rotational thruster to the ship until it reaches the desired velocity.

Here are the properties I worked with:
  • A target yaw, pitch, and roll to rotate to, in terms of angular velocity
  • Current angular velocity of the ship
  • Angular acceleration of the ship's engines

Each of these I represented as a Vector3 in XNA
  • Vector3 targetAngularVelocity;
  • Vector3 currentAngularVelocity;
  • ship.engines.angularThrust

I figured that the most logical way to approach this was to adjust angularThrust every frame in an Update loop. The challenge was figuring out what acceleration was appropriate, when only given currentAngularVelocity and targetAngularVelocity.

My first attempt involved finding a midpoint vector with a simple LERP:
ship.engines.angularThrust = Vector3.Lerp(currentAngularVelocity, targetAngularVelocity, strength) * time;
This works when going from not rotating at all, to rotating in some direction. However, it fails miserably if the ship is already moving in some capacity. I ended up spinning the player's ship phenomenally fast.



Clearly, a midpoint isn't good enough, I need something a bit more relative.

Thankfully, a simple Vector Math trick works nicely:
ship.engines.angularThrust = (targetAngularVelocity - currentAngularVelocity) * strength * time;
Subtracting targetAngularVelocity from currentAngularVelocity will give me a new Vector that points from currentAngularVelocity  to targetAngularVelocity . Then all I need to do is shrink the strength of the vector down to a reasonable acceleration, and I'm done.


And thanks to the miracles of Vector Math, this will work in any direction, under any circumstance. 


Sunday, November 07, 2010

Typical Day

I have a daily habit of scanning through kotaku.com and gizmodo.com. As I read through article headlines, I open the articles in new tabs for later reading. Here's a sample of what that looks like:


I find it a good way to keep up to speed with current trends in the game and gadget industries, and also find lots of cool pictures.

Sometimes I will watch a video as I read through web articles. Generally I'll watch at a TED conference or two since I find them pretty enriching. The window resizing features in Windows 7 are particularly useful here:



Have a favorite news website to procrastinate on? Leave a comment below.

Wednesday, October 27, 2010

The Bridge

This semester, I am the Technical Lead of a super-cool Science Fiction game called The Bridge.


In the game, you command starship entirely with voice control.

Here are some of the innovate things the game has going for it:

  • Speech Recognition as a seamless part of gameplay
    • The player can say things like:
      • "Weapons, fire missiles at enemy ship alpha"
      • "Navigator, engage defense orbit"
  • Dynamic Story Engine
    • Every actor in the game is an Entity
    • Entities have Relationships with other Entities
    • Relationships evolve throughout gameplay
    • Result: fully procedural storytelling
  • Emotional Voice Recognition
    • The player's tone is interpreted by the game
    • This affects crew loyalty towards the player



Of course, that's only the beginning.



For more information, check out the game's website:
commandthebridge.com



- Greg

Friday, September 17, 2010

Flash Sound Tutorial

I made a tutorial for using Sound Objects in Flash.





The tutorial covers a few tricks I use, including:
  • Object Dictionaries
  • Creating Asset Instances in the Flash IDE
  • Importing Sound Assets
  • Creating Sound Objects in ActionScript
  • Using Sound Objects
    • Play, Stop, and Change Volume
You can download the tutorial here:

The tutorial includes a Complete copy of the code, and a Skeleton copy for you to practice writing yourself. You will need Flash CS4 or later.



Surprisingly, creating a robust Sound Engine only requires about 60 lines of code.

Hope it's useful,
- Greg

Thursday, July 08, 2010

AStar Game

Recently, I learned how to implement the super-awesome pathfinding algorithm called A*. Given a start point and a goal, A* will find the shortest possible path to the goal while evaluating as few paths as necessary.

Not satisfied with leaving such a juicy algorithm to rot in a classroom, I set out to build a game.


I chose to create a Cat and Mouse game where the player tries to reach a goal while running away from evil baddies. Sound familiar? Well I've made it before:



Warp Chase was the first videogame I ever made. And by "made", I mean copy-pasted from a game programming book and added some levels. Oh shame. At the time, I did my best to add some personal spirit to the title, but didn't know enough concepts to program any of the gameplay that I had imagined.

Lucky for me, this kind of game lends itself perfectly to A*, since baddies need to be pretty movement-efficient to chase the player effectively. I set forth to fully realize the gameplay I couldn't quite grasp before.





Implementing A* was an interesting exercise in itself. I spent a few days experimenting and optimizing my implementation. Ultimately, I cut my processing time for a long A* search from 117 milliseconds to under 4. The biggest gains came from two places: First, I evaluated visited nodes by looking up values in a 2D array, rather than wastefully looking through each nodes list of visited previous nodes. Second, I implemented my own priority queue using a heap, which saved a lot of time on sorting.



From a gameplay standpoint,  the escape mechanic was fun for a while, but I quickly grew bored of it. A* was just too intelligent to waste on such shallow gameplay.

I wanted strategy.

While finishing the implementation for the Escape part of the game, I stumbled upon a very interesting bug. Effectively, the bug allowed the player to create walls that could trap unsuspecting baddies. Very interesting indeed.




A few experiments and 9 levels later, I found that the trap mechanic allowed me to make some modestly interesting puzzles. I won't spoil the levels here though. Go play the game!

http://kwarp.com/portfolio/astargame.html