Monthly Archives: February 2014

Lose the edges

Mark Jarman, one of our artists, had the idea of changing our environment into a pipe instead of a room. The rotating mechanic would work a lot better with the pipe

So I added the pipe and everyone on our team felt that the game looked a LOT better. I also began messing with the networking stuff, since George was having a hard time figuring out how to make the bullets appear on both the client and the server ( since I had implemented the code, and it is time consuming to understand the code written by someone else).

I looked into the server client model, and the way Unity implements it, and also the netwoking code written by George to transmit the player data over the network. By reproducing some of that code, I managed to instantiate the bullets on both the client and the server. I changed some of the code for the projectiles, so that the script imparting force to them after their instantiation  was attached to the respective projectiles ( as opposed to being imparted by a script on the player). This ensured that the bullets would have a force applied to them on both sides of the network.

But one of the major problems that persisted was to have the blocks move randomly, but the same, for both the client and the server. I tried many variations, but could not get them to behave properly. I had to give in to hard coding their values, as we were going to pitch to an industry panel in the first week of March and had tons of other stuff to do

Put a “spin” on it

Shelwin decided that he would like to work on Re-Genesis, and our team was down to just George and myself. George was interested in the networking aspect of the game, and I was not responsible for everything else.

We had a simple dynamic environment to work with, now we had to make it better.

The room which I had been working with was deemed too small, and I had to make a bigger one, which would facilitate better multi-player combat. Luckily, I had coded the random block generation such that it would take the room parameters from another script, and all I had to do was to change the parameters in that script, and the dynamic environment was good to go!

We decided to have the entire room rotate, which would add another element of dynamism. The rotation was simple enough to implement. I made all the level objects a child of another object “Level”, and attached a script to it which would make it rotate.

transform.eulerAngles=new Vector3(transform.eulerAngles.x,transform.eulerAngles.y,transform.eulerAngles.z+Time.deltaTime*18);

My next task was to get a territory element in there. Each team was to have its own territory, and whenever a player dealt damage to the enemy, his territory would grow in size. Also, players would take damage if they entered the enemy territory. I wanted to have half the room appear blue, to represent team 1, and the rest to appear red, representing team 2

I was struggling to find a way to implement different materials for the territories, since the floors and walls were single objects. But Robert, one of our artists, came up with an ingenious solution. He gave me a texture which was half blue and half red, and I could alter the offset of the texture to make the territories grow or shrink!

 

 

Lets be more dynamic!

After a crazy game jam, it was time to get started on our prototypes.

We were going to use Unity3D for both prototypes, since all the engineers were familiar with it, and could churn out a good prototypes quickly.

I had my first task assigned to me: build a dynamic environment.  I was just going to have some blocks change their positions randomly around a room every few seconds.

I made an empty room and a block prefab with a script attached to it, which would make it move to random locations every few seconds. Here’s some of the code ( It probably wont make much sense on its own)

Clock+=Time.deltaTime;
if(Clock > Random.Range (2.0f, 6.0f))
{
startPos = transform.localPosition;
t=0;
Clock=0.0f;
destPos = new Vector3(Random.Range (-4.5f,4.5f),
Random.Range (1.00f, 5.0f),
Random.Range (-14.5f,14.5f));
//transform.position=destPos;
}
if(curPos!=destPos)
{
t += 0.1f;
curPos = Vector3.Lerp(startPos, destPos, t);
transform.localPosition = curPos;
}

}
So we had a very basic random environment. But how was the player going to make strategies if the environment was COMPLETELY random? So I build a projectile system by which the player could shoot simple round objects. These objects could freeze the platforms’ movement. Thus, the player could select a platform in a favorable position to him and freeze it, so that it wont move away in the next few seconds.

What if the opposition was using the platforms as cover or a means to get to an advantageous position? The player could shoot another type of projectile ( with the right click) which would unfreeze the platforms and foil his opponents schemes!

//To spawn the projectile

if(Input.GetMouseButtonDown(0))
{

if(!m_TeleBall)
{
m_TeleBall=(GameObject)Instantiate(obj_TeleBall,transform.position+transform.forward,Quaternion.identity);
m_TeleBall.transform.tag=”Materialize”;
//m_TeleBall.rigidbody.velocity=rigidbody.velocity;
m_TeleBall.rigidbody.AddForce(transform.forward*1500);
}

}
if(Input.GetMouseButtonDown(1))
{
if(!m_TeleBall)
{
m_TeleBall=(GameObject)Instantiate(obj_TeleBall,transform.position+transform.forward,Quaternion.identity);
m_TeleBall.transform.tag=”De-Materialize”;
//m_TeleBall.rigidbody.velocity=rigidbody.velocity;
m_TeleBall.rigidbody.AddForce(transform.forward*1500);
}
}

 

//To Freeze and Unfreeze

void OnCollisionEnter(Collision i_Object)
{
if(i_Object.transform.tag==”Materialize”)
{
scr_randomGeneration RandomMovement=(scr_randomGeneration)(GetComponent(typeof(scr_randomGeneration)));
RandomMovement.enabled=false;
}
if(i_Object.transform.tag==”De-Materialize”)
{
scr_randomGeneration RandomMovement=(scr_randomGeneration)(GetComponent(typeof(scr_randomGeneration)));
RandomMovement.enabled=true;
}
}

 

Global Game Jam 2014!

WHAT AN EXPERIENCE! WOW…..

This weekend was one of the best of my life. I teamed up with a few other members of my cohort and took part in the global game jam 2014. We were gonna make a game in 48 hours! We would receive the theme for the game right before the jam started. The assembly of jammers waited with anticipation as we watched the keynote speakers trying to inspire us to make experimental games, and then we were given the theme for this year-“We do not see things as they are, we see things as we are”. The theme may seem odd, but that’s how gamejam themes are. They try to be vague, so that people do not take them too literally. They are meant to be starting points to drift away from for our thoughts.

Our team got together and began discussing what the theme meant, and what games might fit the theme. Some really cool ideas were suggested, but we felt that we were taking the theme too literally. The theme reminded Tony of the movie “They Live”, and how the world in the movie is not what it appears to be. Average signboards sporting advertisements were shown to be displaying much sinister messages when looked through a set of special glasses. We combined this theme of subliminal advertising with the music video

where the protagonists change the signboards to deliver their message of rebellion. And thus “Meganight Rebellion” was born. The game was to be a two player game where one guy drove a vehicle around town and the other hacked the signboards to reveal their true meaning. The game was meant to be played with a tilted keyboard, so that the driver was using the keys ‘s’, ‘d’, ‘e’, ‘x’ and the hacker would use the other keys on the keyboard. The initial levels of the game would require the hacker to use the numpad ( the set of keys furthest from the driving controls) and as the difficulty increased, the keys required to hack the billboards would get closer to the driving controls, and the two players would effectively become hindrances to each other. We decided to use Unity3D to make the game.

I was tasked with generating the text which the hacker would have to type in. Three difficulties of text would be generated. The easy level would consist of only the numpad keys. The meduim level would have keys from the numpad as well as keys to the right of the ‘j’ key. The hard level would have all keys on the keyboard minus the ones used by the driver for driving. I defined three arrays of characters, each corresponding to a different difficulty, and containing the characters permissible for that difficulty. The game would generate three characters from the required array.

The next part was to take in input from the user and compare it with the generated text. Two correct answers would hack the billboard, and the user could try hacking as long as the driver kept the car in the vicinity of the billboard. To make this a difficult task, the game also involved a cop car which would chase you around, gaining speed whenever you hacked a billboard.

The player needed to be made aware of the presence of the cop, and so I wrote code which alternated the headlights of the cop car between red and blue, and the alternation would speed up as the cop came closer to you, giving the player a visual indication that he needed to speed up.

This entire development took us around 36 hours. We slept around eight hours on the first night, and one hour on the second night. We were extremely proud of the final product- a fun, compelling game.

God I love games 😀