Score multiplier system

Today I was able to implement a score multiplier system. We thought this would be essential for some variation for high scores if we want to include leaderboards.

scoremultiply

Early implementation of HUD multiplier feedback

My next step for this is to set it up so that when the multiplier is not active (when it has a value of 1) it will be hidden.

Code (added to exisiting score manager code):

void Update()
    {
        if (PlayerDie.PlayerAlive == true && pauseGame.paused == false)
        {
            score = score + (scorescale * scoreMultiplier * Time.time); //score growth rate increases over time

            //will add code to make score scale reset to 0 every time damage is taken.

            TextScore = scoreScreen.GetComponent();
            TextScore.text = Mathf.Floor(score).ToString();

            Multiplier = scoreMultiplier;
            //for public inspector feedback on multiplier

            MultiplyScore.text = Mathf.Abs(scoreMultiplier).ToString("0.#");

            ScoreMultiply();
            //run score multiply control system
        }
    }

void ScoreMultiply()
    {
        if (scoreMultiplier > 1f && ResetOK == false)
        {
            ResetOK = true;
            StartCoroutine (MultiplyReset());
        }
    }

    IEnumerator MultiplyReset() //resets the multiplier to 0 after shooting no enemies for a certain amount of time

    {
        yield return new WaitForSeconds(MultiplierResetTime);
        scoreMultiplier = 1f;
        ResetOK = false;
    }

Bug issue fix

WTF

Things got glitchy while trying to find the source of the lag

After isolating individual assets and running tests I was able to figure out the problem was on the main character model. At first I thought it was an issue with the model itself but I was curious about this as it would not lag when the game was initially run.

Apparently similar people have had problems with any asset that had the particle renderer component after the Unity 5.3 upgrade, so after removing this the lag problem was fixed.

Glitch effect test using After Effects

I got the Twitch plugin for Adobe After Effects and decided to apply it to the pixel version of our title as a test.

I plan to do this to png snapshots of certain assets, and then attach an animated png sequence of the end result as an overlay for certain enemies to show that they are more glitchy and volatile.

Doing this test made me realise that it visually works quite well for the title screen, but it may not make sense to apply it as Project Ikarus is supposed to be the antivirus program of the game world. It very much fits with the theme of our game so I’ll get some outside opinions on this soon.

Frame rate issues, Low-poly water

Upon entering the Project Beta phase of our game, the Unity programs on the machines we use to work on the game were upgraded from 5.2 to 5.3. This caused some problems, the most apparent being the sudden drop in framerate.

I tried to identify the source of the crippling lag and found that our previous water shader was causing some framerate drops, but it didn’t seem to be the source of the problem. I had found a low poly water shader online from a reddit user called Trolltunga, which I was able to use in place, however I was having some rendering issues which forced me to make a duplicate camera for the water.

New water

This look seemed to fit the aesthetic of our game more as it in supposed to be inside a computer world, having low-poly water brought up ideas such as the water being a sea of data. However implementing this brought up a problem with the shooting mechanic. The raycast script uses the main camera position to calculate where the enemies are and it could not differentiate between the main and secondary cameras resulting in a glitchy, uncontrollable reticle that would stay offscreen most of the time.

Initially I had planned to dedicate this week to incorporating lives, obstacles and score multipliers, but instead I’ll have to focus on fixing up all of the bugs in the game.

Project Ikarus Logo

We recieved feedback that our original logo didn’t read too well, meaning that it was hard to tell what it said for some people at first glance.

ikarus

Original logo

I did some research into the typography of classic arcade games such as Mega Man and Metroid and found a design trend which I decided to emulate for a simlar effect.

title_perler

1f565a3bd8

 

Capture.PNG

I came across the Vermin Vibes 1989 font (by Andrew McCluskey) which seemed to fit well with our theme as the hard edges and bold text emphasise a digital theme and encourage action.

I took this font into photoshop, applied the results of my research and came up with the following:

Project Ikarus v2

Project Ikarus – New logo

We decided to change the name to Project Ikarus because it read a lot better in this style instead of just Ikarus on it’s own, plus the word project is relevant to our game’s digital concept.

Project Ikarus.png

Pixel version of project ikarus

This is unlikely to make it to the alpha build of the game due to a lack of time, as I need to animate it and replace the current in-game animation. It will likely be one of my first tasks for the beta build.

Title Screen

I took Malakai’s Ikarus logo and made my own pixel version in paint.net.

Ikarus_Logo

Original Ikarus logo

I did this because I would like to specialise in pixel-related games after this project, if possible.

I then exported each  layer individually and animated an opening sequence in flash.

I exported each frame of the intro by exporting the animation as a PNG sequence, which I then took into unity and set up a loop using the animation controller.

INT02

Animation controller

ikarus_title_by_squirrelkidd-d9j4vov

Flash Animated version

I also added a code to take the player to the next scene when any key is pressed:

	public bool gameLoaded = false;
	public float startTime = 2f;
	public static bool LoadingLvl = false;
	public bool LoadConfirm = false;

	void Start () 
	{
		Invoke("CanPressStart",startTime);
		LoadingLvl = false;
	}
	
	void Update () 
	{
	if (gameLoaded == true)
	{
			if (Input.anyKeyDown && LoadConfirm == false)
			{
				AudioSource audio = GetComponent();
				
				Debug.Log ("Loading level");
				LoadingLvl = true;
				LoadConfirm = true;
				//play sound
				audio.Play();
				Invoke("LoadLevel",2);
			}
	}
	}
	
	void CanPressStart ()
	{
		gameLoaded = true;
	}
	
	void LoadLevel ()
	{
		Application.LoadLevel("Debug");
	}
}

 

 

Shooting update

I updated the player shooting script to destroy enemies on click. This is currently the most effective form of shooting so we’ll stick with this for now and try to improve it later on aesthetically.

e7b8aad87c

Enemy being destroyed

It works by creating a bullet inside the enemy at its current location, instantly destroying it. I was able to do this by modifying my previous shooting code, and adding this to it:

if (Physics.Raycast(ray, out hit) && Input.GetMouseButtonDown(0))
			{
				Debug.Log (hit.collider.gameObject);
				enemy = hit.collider.gameObject;
				Invoke("Fire",fireTime);	
				Rigidbody newBullet = Instantiate(bullet,transform.position,transform.rotation) as Rigidbody;
				newBullet.AddForce(transform.forward*velocity,ForceMode.VelocityChange);
				newBullet.transform.position = Vector3.Lerp(newBullet.transform.position, enemy.transform.position, velocity);	//destroy enemy on click

			}

Enemy movement path system

I decided to remake the way the enemies move in this as enemies play a bigger part in this version of Ikarus compared to the previous version. While it would be nice to have complex movement paths it could over complicate things for now.

ss (2015-04-16 at 06.55.21)

Ikarus (previous version) global enemy movement system

I did some experiments with rotating track points using a tracking script that gives each enemy a different value to move towards.

EMP01

Experimenting with ways to create movement paths

I eventually found that the most successful way to do this was to have a point behind the player that the enemies are trying to reach, so I created this script that mirrors the player’s movement (minus the rotation as that caused some serious problems, enemies could essentially all be controlled through aiming). I couldn’t do this via attaching it to the player as it would count as killing the player when the enemies reached this point.

ET01

Gameobject (cube) that enemies move toward, which is attached to the player. They are instantly destroyed on contact to reduce lag. (4 Dec 2015)

Code (Move towards cube):

	public GameObject target;

	void Update () 
	{
		{
		target = GameObject.FindWithTag("EnemyTarget");
		transform.LookAt(target.transform);
	        }
	}

This goes on each enemy.

Code (Mirror player’s XY position):

	public Transform playerme;

	public Vector3 posFollow = new Vector3(0,0,0);

	void Start () 
	{
	
	}
	
	void Update () 
	{
		this.transform.position = playerme.position;
		this.transform.position = this.transform.position + posFollow;
	}

This goes on the cube behind the player.

I started making simple enemy specific movement paths by making the enemies have invisible rotating parent objects.

ss (2015-11-28 at 02.53.49)

Enemy (placeholder) and rotating parent object.

While experimenting with alternative approaches to water I discovered that the cloth component I was using also worked with the enemies.

ss (2015-11-28 at 02.53.31)

I set constraints on the main body of the virus and left the limbs unconstrained so that they could flop about like tentacles, giving the virus an alien-like feel to it.

ss (2015-12-07 at 02.32.06)

The result was a spider-like virus that seemed completely alien. The rotating movement path helped to keep the limbs constantly moving. This was well recieved by the team and from outside feedback so we may keep this enemy for the final build of our game, or build upon it while keeping this characterstic.

Pause/Death UI, Sound

I was able to script a pause and death user interface menu into the game.

The difference between the pause and death menus is that the death menu does not come up with the option to resume. On both menus the user is able to see the cursor, contrary to the cursor being invisible during gameplay. All music and gameplay is also stopped, this was done by enabling the line of code ‘Time.timescale = 0′.

ss (2015-11-29 at 09.41.16).jpg

I found some royalty-free music on Kevin McCleod’s website that fit in well with the theme of the game. They can serve as placeholder tracks for now but I think they could even work for the final product, depending on our other options. The pitches of the tracks are adjusted in-game to fit better, Unity is slightly slower and Rhinocerous is slightly faster.

Title

Gameplay

I was able to make the music slow down to a stop on death by creating this code:

public float pitchSpeed = 1.19f;
	
	void Update () 
	{
		AudioSource audio = GetComponent();
		
		audio.pitch = pitchSpeed;
	
		if (PlayerDie.PlayerAlive == false)
		{
			pitchSpeed = (pitchSpeed * 0.9f);
				if (audio.pitch <= 0)
				{
				audio.pitch = 0;
				}
		}
		
		if (pauseGame.paused == true)
		{
			audio.pitch = 0;
		}
		
		if (pauseGame.paused == false && PlayerDie.PlayerAlive == true)
		{
		audio.pitch = 1.19f;
		}
	}

This works well because it put emphasis on halting the players momentum. Suddenly stopping the music wouldn’t sound very professional so this is most likely the best way we can accomplish a sudden stop in the audio that is easy on the ears.

Unity bug: Missing (Mono Script)

Due to a unity error that kept popping up when I was backing up my files, my UI scripts disappeared, and I wasn’t able to add them since the only way they can be added is via Add Component > UI, meaning that I need to re-add all components of the code. This is frustrating because I lose any variables that I declared in the inspector.

Bug......

Bug...

Result of the bug. Some UI elements with the same problem disappeared completely, sucha s the reticle.

EDIT: (02/12/15)

I was able to find a fix to this problem by deleting the library folder in the project, then re-opening it so that it reimports all of the assets. Apparently it’s a metadata caused by switching computers.