07/03/16 Update: Debug mode + Gameplay

Over the past couple of weeks I was able to implement these features:

 

Heads Up Display

I made some HUD components to make the game information clearer to see.

HUD_L

Score + multiplier component

HUD_R

Lives component

HUD_vign

Visor component

We were on the fence about keeping the visor component in as it implies that the player is in first person when they are actually playing in third-person, but it had good synergy with the chromatic aberration effect so we decided to keep it in.

First person HUD GUI_scoreGameShot

Chromatic Aberration impact effect

I took the chromatic aberration effect further and made it so the amount of chromatic aberration spikes briefly when the player is hit, then decreases back to the value I previously set, which when used in conjunction with the visor HUD component creates a burst/pulse effect on the edge of the screen similar to a screen shake. This is useful for giving visual feedback on the player’s current status and it gives the illusion of an impact.

hurt gif.gif

(Hard to see blinking hurt animation because of GIF framerate)

Bullet system rework

My previous solution to our shooting problem was to spawn the bullets inside of enemies, causing them to die when clicked. I’ve been able to code a way for bullets to fly directly towards individual enemies allowing for  a cleaner looking shooting system. The major issue that seems to have popped up through feedback is that it gets harder to click directly on the enemies as time progresses due to it being such a specific thing. I think a lock-on mechanic would fix this problem easily, however  we may not have enough time to implement a thorough system.

shooting gif

 

Stage system

I have implemented a stage system that increases the stage in intervals of 8000 points. This is a temporary interval as our score acquisition rate increases with time meaning that jump from stage 1 to stage 2 is much longer than the jump from stage 4 to stage 5. It will take a lot of trial and error and testing to get more accurate numbers or it might even require an alternate stage progression method. The current stage is displayed at the top of the screen.

stage switch gif

Global Speed

There is now a global speed variable that is applied to all moving assets of the game such as enemies and obstacles, making the game feel faster depending on the current stage number.

Enemies increase in frequency as stage progresses

As the stage number increases so does the enemy spawn rate, making it harder as the player progresses. I intend on changing this from simply spawning more of the same enemy to spawning more difficult variations of our enemies or even new ones.

Debug Mode

Pressing escape in-game brings up the debug menu on the top of the screen.

This gives us the following options:

  • F1-F5: Skip to stage
  • F6: Have a bad time (Insta-kill player for testing purposes)
  • F7: God mode (Invincibility state. Turned off when debug menu is closed)

debug mode

High score system

The high score is now shown on the pause/game over menu. This is only stored while the game is open, meaning the value is lost once the game is closed. My next goal in this area is to store the high score to a local file allowing it to remain consistent between game loading. As a stretch goal we could have a leader board system implemented.

 

Life system implementation

I was able to add a life system into the game today. It works by making the player go invisible on enemy collision to imply invincibility frames until the life count has  decremented to the point that the player gets a game over.

Key lines of code:

public int playerLives = 3;

void Start ()
    {
	Debug.Log("Lives:"+playerLives);
        rend = GetComponent();
        rend.enabled = true;
    }

void OnTriggerEnter(Collider col)
	{
		if (col.gameObject.tag == "Enemy" && GodMode == false)
		{   
            if (playerLives <= 1)             {                 Destroy(gameObject);                 PlayerDie.PlayerAlive = false;                 Debug.Log("Death via enemy");             }             if (playerLives >= 2)
            {
                // Health = Health - 100f;
                playerLives--;
                Debug.Log("Player lost a life");
                Debug.Log("Lives:"+playerLives);
                StartCoroutine(blinkTime());
            }

 IEnumerator blinkTime()
    {
        rend.enabled = false;
        yield return new WaitForSeconds(1f);
        rend.enabled = true;
    }

Lives system

I did some research on ways to implement the lives into the HUD and found these examples:

Starfox

Starfox (SNES)

Starfox uses a “Lives x (number of lives)” format which I thought would be quite useful for our game, but decided against it as it implies that the player respawns on the spot which we wanted to avoid. We wanted something that properly showed that the player was getting damaged.

Super street fighter 2

Super Street Fighter 2 – Ryu Portrait

We looked at games that gave feedback of procedural damage to the player and decided that this was a good direction to go in, so I plan to use a similar format for our game. I’ll design a mugshot sprite of the main character with alternative damaged versions.

KHCoM

Kingdom Hearts: Chain of Memories Health HUD

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.

Icarus: Cylindrical texture, Score, Animations, Bloom Shader

I created a cylinder and mapped this seamless space texture onto it. I also added a bloom effect to the main camera which worked well with this texture as it made the highlights glow slightly.

Original bloom shader test

Second bloom shader test. Update 2 (More textures)

The tiling for the space texture was stretched when I mapped it originally and this created an interesting looking effect which we decided to keep.

We had to do this instead of a skybox because we wanted something that would work with the SpeedUpOverTime function.

I created 2 GUIText objects, one that would be fed a modified SpeedUpOverTime value displaying it (Score*) and one that just said ‘Score:’

One the game runs, it changes to this

This is the script I create to manage the score, as the original speed value rises too quickly.

Score script (ScoreManager):

public class ScoreManager : MonoBehaviour {

	public float score = 1f;

	public float scorescale = 0.2f;

	public Text TextScore;


	public GameObject scoreScreen;
	// Use this for initialization
	void Start () 
	{
		score = 1f;
	}
	
	// Update is called once per frame
	void Update () 
	{
		if (PlayerDie.PlayerAlive == true)
		{
			score = score+(scorescale*Time.time);


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

		}
	}
}

I did most of the animating in unity using the Animation Editor.

Intro animation for the ship to fly into the scene

I also animated the yellow obstacle to make it rotate as it comes towards you.

Malakai gave me a pickup object for me to animate.

I animated the rings to rotate and the middle one to bob up and down.

Animated the middle ring to bob up and down while spinning before proceeding to animate the top and bottom rings

Icarus: Sound Effects

For the sound effects and music I used FL Studio to add various effects such as delay and pitch modifying to create my own sounds out of samples. And create seamless loops.

Game over sound:

Looping static modified to fade out

Adding delay to a sample after changing the pitch. This is the retry/menu select sound after clicking

Icarus: Desynchronised

Video (Low quality)

For the game over screen I created a sequence in after effects. It transitions the screen through a series of bars to a static background with the text ‘Desynchronised’, which slowly fuzzes away and becomes distorted and red as the retry and menu words appear. Though these are not actual buttons, I made them work as such by putting a gameobject behind them that can only be clicked on once the player has globally been confirmed as dead in the game.

The gameobject with the mesh renderer enabled for placement

Clicking on a retry or menu reloads the scene or sends the player to the menu, respectively. It also resets the player’s status and reloads the game scene meaning it can be played again without leaving remnants of the previous gameplay.

Retry code (RestartOnClick):

using UnityEngine;
using System.Collections;

public class RestartOnClick : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	void OnMouseDown()
	{
	        // this object was clicked - do something
		audio.Play();
		Invoke("Load", 1);
		PlayerDie.PlayerAlive = true;
	}   

	void Load()
	{
		Application.LoadLevel ("Debug");  
	}
}

Icarus: Accidental asteroid concept + Movement barriers

Upon adding textures to objects and illuminated shaders to the enemies and obstacles for testing purposes, we realized our game was moving more towards a spacey theme with neon elements similar to geometry wars. Then when I was testing out a custom effect using the instantiate command I accidentally spawned all of these:

Textures + materials disabled

I thought, what if these were asteroids, would it be fun to look at or just make everything a lot more cluttered and detract from the experience.

In the end we decided against it but Musa modelled an asteroid for this reason so the possibility still remains.
I also was able to create a movement barrier for the ship and reticle, keeping the player constrained within the camera.

Image from finalized build (Edited back into post)

I did this by disabling the respective directions’ input by flipping the value, for instance pressing right makes the player move on the x axis by a value of 1, but once they reach the barrier and try to continue moving in the direction the code flips it to make the input conflict with itself resulting in an x axis movement value of 0, meaning the player will not move. The same was done for the reticle.

I used an individual script for each side and called it in the movement script. Here is an example of the script I used for the barrier on the right.

StopRight script:

using UnityEngine;
using System.Collections;

public class StopRight : MonoBehaviour 
{
	public static bool stopPlayerRight = false;
	
	// Use this for initialization
	void Start () 
	{
		stopPlayerRight = false;
	}
	
	// Update is called once per frame
	void Update () {
		
	}
	
	void OnTriggerEnter(Collider col)
	{
		if(col.gameObject.tag == "Player")
		stopPlayerRight = true;
	}
	
	void OnTriggerExit(Collider col)
	{
		if(col.gameObject.tag == "Player")
		stopPlayerRight = false;
	}
}

Called in movement script:

	void Update () 
	{
		float horizontal = Input.GetAxis ("Horizontal");
		float vertical =  Input.GetAxis("Vertical");

		if(StopUp.stopPlayerUp == true)
		{
			vertical = Mathf.Clamp(vertical,-1f, 0f);
		}

		if(StopDown.stopPlayerDown == true)
		{
			vertical = Mathf.Clamp (vertical,0f, 1f);
		}

		if(StopLeft.stopPlayerLeft == true)
		{
			horizontal = Mathf.Clamp (horizontal,0f, 1f);
		}

		if(StopRight.stopPlayerRight == true)
		{
			horizontal = Mathf.Clamp (horizontal,-1f, 0f);
		}