Tuesday, September 23, 2014

Swarming

New Feature: the player has a swarm that acts as a shield and can also be used to attack the enemy. I've been tasked to program this swarm behavior that has two states: protect and attack. In protect, the swarm will move around the player acting as a shield. The swarm is still vunerable to fire from both the enemy and the player, so if the player wished to fire at the enemy they risk the chance of destroying their shield. Attack is where each member of the swarm will latch onto the nearest enemy and attack them.

To implement this, I needed to brush up my boid skills. Boids are the simulation of a group of objects that act as a swarm or flock. They follow three simple rules: seperation, alignment, and cohesion. Seperation assures that each member of the swarm doesn't collide with another. Alignment is that they steer towards their target (which can be a leader or the average heading of the nearest flocks). Cohesion is where they steer to move towards the average position of the swarm. For this algorithm, the swarm doesn't act alone, they base their movements off a target creating a leader-follower paradigm. Boids are incredibly difficult to get right, and require fine-tuning to get right. Each rule produces a vector of where they must move, the sum of the vectors will produce their true trajectory. When creating the boids for this game, I ran into problems getting the boids to act in a fluid manner.

The big problem I ran into is when the swarm gets close to the player, then they should circle around the player acting as a shield. In order to get the trajectory to circle around the player, I figured it would just be the tangent of the cirlce they would make. The tangent is just the perpendicular line of the radius vector. The radius vector is easily obtained by the taking the difference between the two objects position vectors and rotating it 90 degrees to get the tangent. When I ran the code, the swarm would form a circle around the player, but they wouldn't move. Only playing with the degrees of rotation did I find that by rotating the radius vector by 45 degrees, they would move in an elliptical manner around the player which makes sense. This gets me the results I'm after, but I'm still confused why rotating 90 degrees doesn't get me the result I wanted. However, for prototype, its good enough and that's what I'll take. I need to move on to creating enemy classes (which I'll cover next week).

Tuesday, September 16, 2014

Human Body Defense Prototype

I've been assigned to the team, Human Body Defense, a top-down shooter where you must destroy various diseases to heal the body. Our prototype will focus on the main mechanic, using your enemies abilities to adapt to your environment. This means that when you destroy an enemy, you gain some of their ability such as partial immunity to their attacks as well as their weapon to upgrade your own. Thus far, we've programmed a player and an enemy that can shoot at each other, move around and die. Since A.I. is my favorite thing, I took the responsibility of implementing basic enemy behavior. Mostly stalking behavior and correcting course change every 1/2 second while firing every second. The enemy also stalks the player meaning that it will follow the player up until a min distance plus some epsilon. If it is within that min distance, then the enemy will retreat back while firing at the player. Obviously this isn't very exciting, but it does show the concept of an enemy that will attack the player, and when it dies it will drop its weapon for the player to take and adapt to.

Monday, September 8, 2014

Phone Screen with Naughty Dog

I had the opportunity to interview with Naughty Dog for a Game Programming position, and it was completely different than  what I thought it would be. I had two technical interviews for internships at EA and Amazon, and it consisted of the standard questions: "Tell me about yourself", talking about game projects I made, and technical questions about data structures, algorithms, and c++ technical questions. That's what I was studying for when preparing for this interview, specifically talking points about myself, abilities, and my experiences at EA Tiburon. When the phone interview came up, I did not realize that a technical phone screen was completely different from a technical phone interview. After a quick introduction, he went straight into the technical questions. This threw me off a bit as I was expecting the "tell me about yourself" question first.

Even though being thrown off, I was thinking that I would still be fine by not trying to sell myself and stick to the technical which is my strength. A question about dot product comes up which I knew, then he asked an alternative equation for dot product. That is where I started to freeze up, I didn't know. Then he asked me how to find the angle between two vectors, again I struggled to find an answer until I could say that it included dot product. This is where I started to tense up and stress out. The rest of the linear algebra questions only went down hill. When asked how to find the normal vector given three points, I completely forgotten about cross product and was able to google the answer by given the equation. When pressed what the name the matrix was, I couldn't answer. I'd forgotten cross product, one of the simplest concepts of linear algebra. I was only able to have some relief when he started asking about data structures which I felt good on.

It has been a little less than a year since I last needed to do linear algebra, and it didn't cross my mind to refresh my knowledge of it. Linear Algebra was my favorite subject in math, and I consider myself really good at it. After the interview, I was able to look up the concepts and could then answer the questions. My failure to refresh myself on basic linear algebra concepts cost me the opportunity to prove my knowledge of linear algebra and be able to, possibly, continue on the interview process at Naughty Dog. While I haven't heard anything yet about my application and the next steps, I have little hope that I will continue through. All I can do is continue to put applications in to other game studios and when I get the opportunity to interview again, I know what to expect with a phone screen and to add linear algebra to a list of subjects to study and refresh myself.

Monday, September 1, 2014

German Expressionism

I'm finally taking the capstone class for EAE program, where I have to create a video game with a group that will be published. Right now, I'm coming up with pitches. Part of my problem with this is that the ideas that I have for games are not appropriate for this class because of size and time. While the time is only two semesters, about 8 months, the actual time to work on the game will be closer to 5-6 months. This is due to planning and getting approval for the game to publish will take up a few of those months. I'm very interested in making large scale, RPG games that would take a AAA studio several years to make. Trying to scale down has not been easy.

Starting out thinking of pitches, my ideas have not been very good. I've been coming up with stock platformers and caper games, even going as far to rip ideas straight from movies because I'm so unoriginal. Then I started to think about old German expressionist films from the 1920's. Films like Nosferatu, Metropolis, and The Cabinet of Dr. Caligari. All these films have a distinct style of Chiaroscuro, color scheme, and a very distorted view of reality that ventures into dreamlike.

 Still from The Cabinet of Dr. Caligari (source: http://www.filmsquish.com/guts/files/images/caligari12.jpg)

That me me wonder what video games that might make use of the visual style. Turns out, the style is rarely used in AAA games and seldom in indie games. I would think that the german expressionism would be more used in indie games, or student games, as film students overuse the style to show an imitation of creativity. The closest I could find was Limbo. 

Still from Limbo (source: http://i.telegraph.co.uk/multimedia/archive/01683/limbo-game1_1683129c.jpg)

Limbo certainly shares an artistic style with Dr. Calibari and the other black and white expressionist films due to its lighting and color scheme. While the game certainly has a dreamlike state, it doesn't match Calibari's use of distorted perspectives and shapes. The emphasis on a distorted reality isn't the decisive factor if a film is an expressionist film; Nosferatu relied more heavily on lighting than a distored reality.

Many games are more inspired with film noir, which itself was inspired by German expressionism, which features the use of Chiaroscuro in a more sedated reality. Contrast is a game which seems to be inspired by the early film noir of the '30s and '40s, but when looking at the style, would be more reminiscent of Nosferatu. 

still from Nosferatu (source: http://www.derek-turner.com/wp-content/uploads/2013/10/nosferatu-4.jpeg)
still from Contrast (source: http://4.images.gametrailers.com/image_root/vid_thumbs/2013/11_nov_2013/nov_11/gt_contrast_review_em_11-13_6am.jpg?)

In many respects, Contrast could be considered an expressionist film. The game is set in an alternate reality 1920's where Albert Einstein's theory of relativity is used as justification for an extremely distorted reality where the user can shift into the shadow they project and move around in that plane of existence. 

still from Contrast (source: http://cdn.destructoid.com//ul/265659-C1.jpg)

When playing the game, the game feels more similar to a film noir, like M, than by a German expressionist film, like Nosferatu. This is the problem with art styles; there are so many interpretations that it cannot easily be defined nor categorized. There are films that have elements of the style, but could not be considered that style, just like many film noirs can't be considered German expressionism. 

That is why I want to make a game that is truly based on German expressionism than film noir. I want a game that has heavy use of light and shadow, and has a heavily distorted view of reality. One of the games that I will be pitching will be based on that style. A game of hyperbolic emotion with little to no reality. A game where the player has to go through many points in time to right a lifetime of evil. Each time point will be a heavily distorted view of the reality that actually was, and how the main character saw the world. The hub where the player can traverse to the different time points would be like an M.C. Escher drawing with distorted perspectives. 

source: https://thefalloutgirl.files.wordpress.com/2011/10/escher-big.jpg

It'll probably turn out that I'm the only one passionate about this idea, and it won't make it past the first selection process; however, I do want to make a German expressionist game and I will have both an art style and an idea in my back pocket to when I could potentially make the game. A concrete idea is more than what most people have, even if it does suck.