Tuesday, 14 May 2013

End Game

Here I will be describing the problems we had with our final instalment of vertical slice of our game Dionysus below you can see the first person controller facing outside the house pod. The added in the fog to hide the rendering of the trees as you can see where crossovers are this position of one of the parts and as you can see it is not their. This will be shown once the plant in front has been eaten also below you can see in the bottom right-hand corner. There is the mini map that Alistair made, which shows the position of the controller with red arrow.



below is a closer up image of previous few above, and their health by the top left-hand corner has also got smaller as decreases over time due to your hunger.


one of our main problems was that when you first eat one of the plants. The mini map will disappear forever and will not return. We looked into this and could not find a solution, even though the mini map was successful and worked well due to perhaps encoding it just disappears.and also, as you can see from the plants being eaten apart are described earlier, has now appeared.


below is the pause menu that cat made using the coding as shown on the blog . Unfortunately, due to the lock of the mouse and not coding the buttons to do their own functions. It doesn't work that this show that we were on the verge of finishing it and we needed more time to code


below is a video showing the character, leaving the part eating the plant, seeing the object to pick up and picks it up. This is just shows the basics and the core mechanic of our game.


Problems:
  • Getting the code to work for the health and death zones around Alistairs trees
  • to get the mini map to stay on the screen after plants being eaten
  • getting the pause menu to work
  • having an end game screen or reverting back to menu
Overview:

looking at the vertical slice. We believe that the core mechanic has been shown due to hallucinations from eating the plant to finding a part to the fix your ship. This is the core mechanic of Dionysus . We believe, for the first vertical slice. We have made. This is a great combination of all our knowledge and special skills and a unique talents from Alistair JJ, who mainly focused on 3-D and Alice and Cat who focused on coding and Rebecca, focusing on 2-D. The team had its ups and downs, but overall the vertical slice has come out to be a solid game yet you do not have a death screen and an endgame, but as I said above, the core mechanic of the game has been shown using this knowledge that we have learnt the game that we will make in the third year will be greater than this vertical size due to the knowledge lessons we have learned and all help us a lot in the future

Thanks for your help. Tanguay, Steve and Robin


AI Information code pontentially working

using UnityEngine;
using System.Collections;
public class Information : MonoBehaviour {
 // Use this for initialization
 void Start () {

 }

 // Update is called once per frame
 void Update () {

 }


// This function checks if the player has entered a trigger
 void OnTriggerEnter(Collider other)
 {
  // The switch statement checks what tag the other gameobject is, and reacts accordingly.
  switch(other.gameObject.tag)
  {
   case "FlowerInfo":
   hitObj.gameObject.BroadcastMessage("This plant seems to have healing capabilities");
   break;
  
      case "LeavingDoor":
   hitObj.gameObject.BroadcastMessage("Hello Comrade, you are missing parts for your distress beacon, search the canyon for this parts");
            break;
  
      case "DeathSpot":
      hitObj.gameObject.BroadcastMessage("Comrade, this area appears to be very damaging towards your health");
   break;
  
  
       }
 }
}

Pause Menu code

using UnityEngine;

using System.Collections;

public class PauseMenu1 : MonoBehaviour

{

public GUISkin myskin;

private Rect windowRect;

private bool paused = false, waited = true;



private void Start ()

{

windowRect =
new Rect(Screen.width /2 -100, Screen.height /2 -100, 200, 200);

}





private void Waiting()

{

waited =
true;

}



private void Update()

{

if(Input.GetKey (KeyCode.Escape) || Input.GetKey (KeyCode.P))

{

if (paused)

paused=false;

else

paused =true;



waited =
false;



Invoke(
"Waiting", 0.3f);

}



if(paused)



Time.timeScale = 0;



else



Time.timeScale = 1;





}









private void OnGUI()

{

if(paused)

windowRect = GUI.Window(0, windowRect, windowFunct, "Pause Menu");

}



private void windowFunct(int id)

{

if(GUILayout.Button("Resume"))

{

paused =
false;

}



if(GUILayout.Button("Options"))

{



}



if(GUILayout.Button ("Quit Game"))

{



}

}

}

Ship Parts

Given that, as said in the privius post of mine, there was an explotion on the shit, ive created tilable ship parts which should be useful to litter around the map.


This one is for the ships flooring, emergency lights are self powerd so even if the ship brakes up the light will still be on.


Part of the large Heat Sheld that the ship had


Part of the common flooring within the colony ship.

Health Damage and Health Bar Code


public class HealthBar : MonoBehaviour
{
 //  player's health and health bar
 public float curHP=100;
 public float maxHP=100;
 public float maxBAR=100;
 public float HealthBarLength;


 void OnGUI()
 {
  //  creates the health bar at the coordinates 10,10
  GUI.Box(new Rect(10,10,HealthBarLength,25), "");
  //  determines the length of the health bar
  HealthBarLength=curHP*maxBAR/maxHP;
 }

 void ChangeHP(float Change)
 {
  //  takes whatever value is passed to this function and add it to curHP.
  curHP+=Change;

  // This if statement ensures we don't go over the max health
  if(curHP>maxHP)
  {
   curHP=100;
  }

  // This if statement is to check if the player has died
  if(curHP<=0)
  {
   // Die
   Debug.Log("Player has died!");
  }
 }

 // This function checks if the player has entered a trigger
 void OnTriggerEnter(Collider other)
 {
  // The switch statement checks what tag the other gameobject is, and reacts accordingly.
  switch(other.gameObject.tag)
  {
  case "Heal":
   ChangeHP(5);
   break;
  case "Damage":
   ChangeHP(-25);
   break;
  }
  // Finally, this line destroys the gameObject the player collided with.
  Destroy(other.gameObject);
 }
}


Now we just need to add a timer which Alice is currently looking into :)

using UnityEngine;
using System.Collections;

public class HealthBar : MonoBehaviour
{
 //  player's health and health bar
 public float curHP=100;
 public float maxHP=100;
 public float maxBAR=100;
 public float HealthBarLength;
 private float updateDisplayTime = 0F;


 void Start()
 {
   updateDisplayTime = Time.time + 5F;
 }

 void Update()
 {

        if ( updateDisplayTime < Time.time )
     
   {
         curHP -= 3;
         updateDisplayTime = Time.time + 5F;
   }

    if ( curHP <= 0 )
      {
          this.enabled = false;
      }
 }
 void OnGUI()
 {
  //  creates the health bar at the coordinates 10,10
  GUI.Box(new Rect(10,10,HealthBarLength,25), "");
  //  determines the length of the health bar
  HealthBarLength=curHP*maxBAR/maxHP;
 }

 void ChangeHP(float Change)
 {
  //  takes whatever value is passed to this function and add it to curHP.
  curHP+=Change;

  // This if statement ensures we don't go over the max health
  if(curHP>maxHP)
  {
   curHP=100;
  }

  // This if statement is to check if the player has died
  if(curHP<=0)
  {
   // Die
   Debug.Log("Player has died!");
  }
 }

 // This function checks if the player has entered a trigger
 void OnTriggerEnter(Collider other)
 {
  // The switch statement checks what tag the other gameobject is, and reacts accordingly.
  switch(other.gameObject.tag)
  {

  case "Heal":
   ChangeHP(5);
   break;
  case "Damage":
   ChangeHP(-1);
   break;

   if ( updateDisplayTime < Time.time )
    
  {
        curHP -= 10;
        updateDisplayTime = Time.time + 5F;
  }

   if ( curHP <= 0 )
     {
         this.enabled = false;
     }

  }
  // Finally, this line destroys the gameObject the player collided with.
  Destroy(other.gameObject);
 }
}


The "private float updateDisplayTime = 0F;" we managed to find from one of Alisters lessons, so that there is a counter to how quickly the health decreases when you're near the trees.

Cargo

since we lacked geniral debri such as Cargo which would of been throwen out of the ship during the initial explition i desided to create a few boxes of various types depending on the cargo. was not hard to make, and it is easy to duplicate within Unity.

All of them are Normal Mapped, some of them are better than others since there was troble with "SSBump" and trying to get it to be smooth rather than Jagged, but the effect works well since they would of been bashed about.






Monday, 13 May 2013

Intro Screen

Here is the intro screen.
 
 
Here I was looking at using the rolling credits like in star wars and using the words "A Long Time Ago In A Galaxy Far, Far Away" what the planet dose at the end of the rolling credits is come up close as if your zooming into the planet to where you are.
 

 
 
Part 1

 
Part 2

 
Part 3

 
Part 4

 
Here is the planet zooming in.

Crosshair, Fog and Code

 
Using these codes below I got the mouse to stay in the center of the screen
 
These codes are Javer Script and there in yellow
 
Code 1:: function Update () {
    Screen.lockCursor = true;
    Screen.lockCursor = false;
}
 
Code 2:: Screen.showCursor = false;
 
 
Also to get the crosshair to show in the center of the screen I uead this code.
 
Crosshair Code:
 
Code 3: var crosshairTexture : Texture2D;
var position : Rect;
static var OriginalOn = true;
function Start()
 {
  position = Rect((Screen.width - crosshairTexture.width) / 2, (Screen.height -
  crosshairTexture.height) /2, crosshairTexture.width, crosshairTexture.height);
 
 }
function OnGUI()
 {
 if(OriginalOn == true)
 {
  GUI.DrawTexture(position, crosshairTexture);
 }
}

 
Below is the crosshair that I made in Photoshop and then added to unity.
 
 
 
Using the simple reder settings (see Below) we added fog so we could hide the trees when they redered. 
 
 

Friday, 10 May 2013

3D modle Assets

more assets have been added to the Pods intorior, decorative ones to make it more homely.

so far we have a transparent Glass, Tolet role and an Alarm Clock which is the essential stuff at the moment.

 
JJ Made the glass
 

Alistair Made the clock


JJ Made the toilet roll.

Update


Alistair has added a crosshair so that the mouse locks in at the centre of the screen and made assets

JJ has edited sound effects and made assets

Alice has added a health bar, but we are having problems trying to get it so the health gradually decreases, goes up on eating a fruit and goes down on being near the tree's dealing damage or in the water.

I have added extra lighting to the pod and other areas like the AI and cave. Edited the waterfall texture so its showing water falling instead of a spray effect. I found some more sounds and added them to the game however only the ones attached to the first person controller are currently working and we'll need to add the door and eating effects to the code. Added in the assets JJ and Alistair made. Added code for a pause menu but it doesn't completely work with our current code/properly.

Play a sound on Click code

I've found two codes where you click an object and a sound will play:

System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"c:\mywavfile.wav"); < change this part to whatever sound we want
player.Play();



 
private void Button_Click(object sender, EventArgs e)
{
using (var soundPlayer = new SoundPlayer(@"c:\Windows\Media\chimes.wav")) {
soundPlayer.Play(); // can also use soundPlayer.PlaySync()
}
}


 

More Sound

More sound has been added, edited in Adobe Audition so we have out desired effects. also colaboreted with Rebecca Toop with her Audeo files she added, so now we have a sound for when the player eats and walks and so on.

also creating geniral 3D objects for inside the Pod at the moment since it looks qite bear in some arias.

Health Bar Code

    using UnityEngine;
          using System.Collections;
 
public class PlayerHealth : MonoBehaviour {
 
public int maxHealth = 100;
public int curHealth = 100;
 
public float healthBarLength;
 
// Use this for initialization
void Start () {
 
healthBarLength = Screen.width /2;
 
}
// Update is called once per frame
void Update () {
AddjustCurrentHealth(0); 
void OnGUI(){
 
GUI.Box (new Rect(10,10, healthBarLength, 20), curHealth + "/" + maxHealth);
 
}
 
 
public void AddjustCurrentHealth(int adj)
 
{
 
curHealth += adj;
 
if(curHealth <0)
curHealth = 0; 
 
if(curHealth > maxHealth)
curHealth = maxHealth;
 
if(maxHealth <1)
maxHealth = 1;
 
healthBarLength =(Screen.width /2) * (curHealth / (float)maxHealth);
 }
}
 
I put this code in and the health bar is being shown in the top left hand corner of the screen. I am having trouble at the moment getting it to decrease everytime you go near Alisairs tree's or if you go in the water. It probably needs an if, else statement, Cat when your are next in i'll show you what happens and you might be able to help me get it to work :- )

Yeah the unityanswers this code came from doesnt have any solutions I doubt we are actually going to get this to work

Wednesday, 8 May 2013

Meeting 08/05/2013

We've discussed adding a pause screen since our game relies heavily on time. We could also use the AI code to make enemies which could appear when you eat a certain plant. We could also have objects which cause damage that disappear when a certain plant is eaten meaning the player will have to memorise where these are and avoid the area they are in adding more layers of gameplay.

Tasks:

Alistair: Unity adjustments

Cat + Alice: Adding health code, GUI text, AI GUI text code, copying AI code for enemies
(You guys will need to split this between you)

JJ: Adjusting volume of sound effects in Audition and saving as .wav's

Toop: Make enemies/harmful objects?

A.I Update ( Textureing )

 
Has JJ was having truble with textueing the A.I I volanterd to do the textureing as you can see by the UV map this it have the best in the world but it needed to be done so I got the detail out where it was needed and it looks ok.
 
Below are some of the images of the A.I in maya and a rendered picture at the bottom of this post.
 




Tarrain Update


Here are three of the plants that will make you screen change colour below is one of the three changes.

Below is when you would eat the Blue flower.



Above is a view of the canyon.


Above is the A.I textured in the enviroment.


Here are some fish underwater.


This is the inside of the pod that has had some lights added and also the texture of the mirror has been remove and the textures being in the right place has been conpleted and as you can see it looks alot of frindly and the last textures.


Thursday, 2 May 2013

Following AI code update

Hope we have fixed the ai circling bug with this snippet of code.
if we change this part of the previous code

//move towards the player
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;

to:


//move towards the player if not too close

if ( ( myTransform.position - target.position ).sqrMagnitude > 4F )
{

myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;

}
 
it should only move towards the player if the player is a certain distance away so it should in theory stop moving all together if it is so many units close to the player.

Wednesday, 1 May 2013

ColourFilterControl script


public var cameraNormal : GameObject;
public var cameraRed : GameObject;
public var cameraBlue : GameObject;
public var cameraOrange : GameObject;
public var SWITCH_TO_NORMAL_CAMERA_TIME : float = 10;
public class ColorFilterControl extends MonoBehaviour
{
 public static var Instance : ColorFilterControl = null;
 public function SwitchToRedCamera()
 {
  CancelInvoke("SwitchToNormalCamera");
 
  cameraNormal.SetActive(false);
  cameraRed.SetActive(true);
  cameraBlue.SetActive(false);
  cameraOrange.SetActive(false);
 
  Invoke("SwitchToNormalCamera", SWITCH_TO_NORMAL_CAMERA_TIME );
 }

 public function SwitchToBlueCamera()
 {
  CancelInvoke("SwitchToNormalCamera");
 
  cameraNormal.SetActive(false);
  cameraRed.SetActive(false);
  cameraBlue.SetActive(true);
  cameraOrange.SetActive(false);
 
  Invoke("SwitchToNormalCamera", SWITCH_TO_NORMAL_CAMERA_TIME );
 }

 public function SwitchToOrangeCamera()
 {
  CancelInvoke("SwitchToNormalCamera");
 
  cameraNormal.SetActive(false);
  cameraRed.SetActive(false);
  cameraBlue.SetActive(false);
  cameraOrange.SetActive(true);
 
  Invoke("SwitchToNormalCamera", SWITCH_TO_NORMAL_CAMERA_TIME );
 }

 public function SwitchToNormalCamera()
 {
  cameraNormal.SetActive(true);
  cameraRed.SetActive(false);
  cameraBlue.SetActive(false);
  cameraOrange.SetActive(false);
 }


 function Awake()
 {
  if ( Instance != null )
  {
   Destroy (this );
  }
  else
  {
   Instance = this;
  }

 }

 function Start ()
 {
  SwitchToNormalCamera();
 }

}

PickUp fruit - initiate effect code


#pragma strict
public enum ColorFilterType { normal, red, blue, orange };
public var colorSwitcher : ColorFilterType;
function OnTriggerEnter (other : Collider)
{
 renderer.enabled = false;

 switch ( colorSwitcher )
 {
  case ColorFilterType.normal:
 
   ColorFilterControl.Instance.SwitchToNormalCamera();
   break;
  
  case ColorFilterType.red:
 
   ColorFilterControl.Instance.SwitchToRedCamera();
   break;
  case ColorFilterType.blue:
 
   ColorFilterControl.Instance.SwitchToBlueCamera();
   break;
  
  case ColorFilterType.orange:
 
   ColorFilterControl.Instance.SwitchToOrangeCamera();
   break;  
 }
 
 yield WaitForSeconds (8);
 renderer.enabled = true;
}
/*function update();
{
 if (renderer.enabled = false)
*/

Sound

sound is on the way, collected the set we agreed on, however, a small problem. (dont owrry its not going to stop is uts just a basic one) the audeo files are in diforent formats, like IFF and so on, however i also need to know what type of audeo file Unity uses so that i dont wait stime converting the audeo files to like MP3 or something and all of a sudden being told we need IFF or something like that.

in a nutshell, there ready, just need to know what they need to be converted too.

Monday, 29 April 2013

Beacon pickup / rotate code

using UnityEngine;
using System.Collections;
public class Pickup : MonoBehaviour {
 // Use this for initialization
 void Start () {

 }

 public float rotationSpeed = 100.0f;
 // Update is called once per frame
 void Update () {
 transform.Rotate(new Vector3 (0,rotationSpeed * Time.deltaTime, 0));
 }

 void OnTriggerEnter(Collider col){
 if(col.gameObject.tag == "Player"){
   col.gameObject.SendMessage("CellPickup");
   Destroy(gameObject);
  }
}
}

Friday, 26 April 2013

Texturing

found a useful tutorial on texturing for all of us, probably worth a look at wether your an expert or not.

in a nutshell, it hightlight triks and tips on texturing, so for exampile, how can you create a rust effect in a seccond rather than spending hours perfecting it.

hear is the link: http://forums.cgsociety.org/showthread.php?t=373024

Audio and Adobe Audition

OK so i think it about time to show what we will be facing in turms of Audio. So i did some resurch to see what we where up against and so i have come to the conclution below.


Sound effects, while some of it can be edited in Adobe Audition for effects (faid in and faid out and so on) achaly recording the Audio in the first place will prove a challenge. for exampole, while recording can be acheved through a sympole basic micraphone, removing background could prove challenging depending on the sound.

Adobe Audition had a very effective tool of removing the noise but for longer Audio this could prove time consuming as well as frustrating if something where to go wrong. how this works is that Audition creats a sort of "Thermal Imige" of the audio and allows the user to highlight and deleat arias of the audeo, this is created by what freqensies it can pik up and split them up, however, it can be a problem if an unwanted sound where to be present at the same freqency and the sound we would want, there for it not only would it be hiddent, it would be alot harder to remove, not to mention the audio would be changed with the content of the audio we would want, which would be problamatic.

So... in a Nutshell... well have to stick with the basics it would seem. althogh, i do beleve that we have time for the basic effects for the game.

Light/ Colour Script

using UnityEngine;
using System.Collections;

public class DoorControl : MonoBehaviour {

 public bool toggleDoor = false;

 private bool doorOpen = false;
 private const string strOpen = "Open";
 private const string strClose = "Close";

 public TextMesh counterTM;
 private int counter = 0;

 public Light redLight;
 public Light blueLight;
 public Light greenLight;
 public Light orangeLight;

 public int currentCycleState = NONE;
 public float nextCycleTime = 0f;
 public bool enableCyclingOfLights = false;

 //public int countTo4 = 0;

 // Use this for initialization
 void Start () {

 }

 // Update is called once per frame
 void Update ()
 {

  if ( enableCyclingOfLights )
  {
   if ( nextCycleTime < Time.time )
  
   {
   CycleEachLight();
  
   }
  }


  else if (toggleDoor)
  {
   doorOpen = !doorOpen;
 
   if (doorOpen)
   {
    animation.Play(strOpen);
    counter++;
    counterTM.text = counter.ToString ();
  
    // when door is opened and the counter changes
    // check if the lights need to be changed
    UpdateLightsStates( counter );

   }
   else
   {
    animation.Play(strClose);
    counterTM.text = "Closing Door";
   }

   toggleDoor = false;
 
  }
 }

 void CycleEachLight()
 {

  switch ( currentCycleState )
  {
   case NONE:
    SwitchLightOn ( RED );
    currentCycleState = RED;
    nextCycleTime = Time.time + 2f;
    break;
 
   case RED:
    SwitchLightOn ( ORANGE );
    currentCycleState = ORANGE;
    nextCycleTime = Time.time + 2f;
    break;
 
   case ORANGE:
    SwitchLightOn ( GREEN );
    currentCycleState = GREEN;
    nextCycleTime = Time.time + 2f;
    break;
 
   case GREEN:
    SwitchLightOn ( BLUE );
    currentCycleState = BLUE;
    nextCycleTime = Time.time + 2f;
    break;
 
   case BLUE:
    currentCycleState = NONE;
    enableCyclingOfLights = false;
    counter = 0;
    break;
 
 
  }


 }

 void UpdateLightsStates ( int count )
 {
  switch ( count )
  {
   case 2:
    SwitchLightOn ( RED );
    break;
 
   case 4:
    SwitchLightOn ( ORANGE );
    break;
 
   case 7:
    SwitchLightOn ( GREEN );
    break;
 
   case 9:
    SwitchLightOn ( BLUE );
    break;
 
   case 10:
    enableCyclingOfLights = true;
 
    break;
  }



 }

 private const int NONE = 0;
 private const int RED = 1;
 private const int ORANGE = 2;
 private const int GREEN = 3;
 private const int BLUE = 4;


 void SwitchLightOn( int lightToSwitchOn )
 {
  switch ( lightToSwitchOn )
  {
   case RED:
    redLight.enabled = true;
    orangeLight.enabled = false;
    greenLight.enabled = false;
    blueLight.enabled = false;
    break;
 
   case ORANGE:
    orangeLight.enabled = true;
    redLight.enabled = false;
    greenLight.enabled = false;
    blueLight.enabled = false;
    break;
 
   case GREEN:
    greenLight.enabled = true;
    orangeLight.enabled = false;
    redLight.enabled = false;
    blueLight.enabled = false;
    break;
 
   case BLUE:
    blueLight.enabled = true;
    greenLight.enabled = false;
    orangeLight.enabled = false;
    redLight.enabled = false;
    break;
 
 
 
  default:
   //catch all condition
   blueLight.enabled = false;
   greenLight.enabled = false;
   orangeLight.enabled = false;
   redLight.enabled = false;
   break;
 
  }

 }

}

Here is some code Toop and I were thinking of using to make the scene change colour. When you hit the plant, it will make everything that colour.

Title Screen

 
 We desided to make a title screen as all games have one so use uead the textures that JJ had made at the start of the porject and also uead the font that we where using for the game in the development stage.
 
 
Above is a close up of the planet the JJ made the texture in Photoshop we did not what to use the Hi defanition texture as we where conserned that the game would crach.
 
 
Above is the final screen that will be in the game the plant dose spin on and 360 degree rotation.