5/11/2010

Substitute for Revolution - Synopsis & Outline

This interactive story is a psychological drama about a depressed man who wants to escape the real world. 


The user is put into the position of the character, a depressed and psychologically disturbed man living in a run down inner-city apartment. As the user explores his apartment, they discover gateway objects, which lead to experiencing altered states of mind. When awaking back in the real world, the user and character find that parts of his altered state have manifested in the real world apartment.


After experiencing all the altered states of mind available in the apartment, the walls break down to reveal a fragmented reality containing both his physical and imagined worlds. While this split world starts out as an interesting space to explore, it continues to fragment and glitch until the user looses all control over the character and the visual gets to fragmented and distorted to make any sense of it.  


Th interactive finishes with a cut back to a zoom out shot of the main character lying on the floor in the apartment. Unconscious or maybe dead.



5/10/2010

Trigger Happy!

var theLight : Light;

function OnTriggerEnter ()
{
theLight.enabled = true;
}


-------


if (hit.collider.isTrigger == true) {
hit.collider.active = false;
yield WaitForSeconds (0.1);
hit.collider.active = true;
}

Controlling music loops

/*

Groove v1.1 © "hai_ok". Feel free to use for anything.
If you use this, please let me know. Its good to know if I helped someone. :D

INSTRUCTIONS:
Use this script to dynamically change the music in a game, in the middle of any "song".
It only works with loops that you might use to make music in music creation software like Garageband or FL Studio (Techno EJ...).
This only assumes you want to use bass and drum tracks.
I did this so that I could use more prominant lead loops to "celebrate" getting collectibles or acheiving goals.

You can Add AS MANY LOOPS AS YOU NEED from within the Unity Inspector once you have added the script to the Raideo.
Audition them to see where you would put them.
Try to keep them in groups that maintain the same mood.
Or switch to a funkier set of loops to "punctuate" a win.

THE ORDER OF EVENTS IN THIS SCRIPT IS VITAL TO ITS FUNCTION = DO NOT CHANGE THIS WITHOUT KNOWING WHAT YOU'RE DOING:

This was written to call from another script.
Here is the Syntax:

groove.tune("set","dance");}
groove.tune("set","triphop");}
groove.tune("set","off");}

*/

// Make sure that "Play On Awake" is on, and "Loop" is off, for your Audio Source.
private var triphopdelay : float = 4.8; // length of the triphop loops
private var dancedelay : float = 3.692; // length of the dance loops
var triphopDrumLo : AudioClip[];//Lo triphop Drum Loop Array
var triphopBassLo : AudioClip[];//Lo triphop Bass Line Array
var danceDrumLo : AudioClip[];//Hi triphop Drum Loop Array
var danceBassLo : AudioClip[];//Hi triphop Bass Line Array
/*create a one dimensional array where the name is an int from 0-infinity and I and inject my own values*/
static var music = new Array();/*the array is calle music and is accesable as groove.music[x] where x = the int entry value*/
static var station:String;/*the big ticket*/
function Awake () {//prep stuff here so other stuff can use it
tune("set","off");//tune the raideo off
}
function Start(){/*00*/
while (true) {/*crack smoker*//*which is to say, "hard worker", or always on the job. ;) */
station=tune("get","tune");/*call the music array and get the station*/
switch (station){/*evaluate the station*/
case "triphop":/*Play a random pair of drum and bass loops from any selection in their entire arrays*/
audio.PlayOneShot(triphopDrumLo[Random.Range(0,triphopDrumLo.Length)]);
audio.PlayOneShot(triphopBassLo[Random.Range(0,triphopBassLo.Length)]);
yield WaitForSeconds (triphopdelay);/*wait for the loops to play themselves thru*/
break;
case "dance":/*Play a random pair of drum and bass loops from any selection in their entire arrays*/
audio.PlayOneShot(danceDrumLo[Random.Range(0,danceDrumLo.Length)]);
audio.PlayOneShot(danceBassLo[Random.Range(0,danceBassLo.Length)]);
yield WaitForSeconds (dancedelay);/*wait for the loops to play themselves thru*/
break;
case "off":
yield WaitForSeconds (2);//wait to see if they turn me back on
break;
}
}
}
/*---TUNE THE RAIDEO-----------------------------------------------------------------*/
static function tune (instruction:String,value:String){
if ("set" in instruction){/*if we are changing the station*/
music.Clear();/*empty the array*//*we're only storing whats on so we dont need anything else*/
music.Add(value);/*inject the value as the first entry (stored at the [0] index)*/
//Debug.Log (">>>GETTING TIRED OF "+station+". TIME FOR SOME "+value+".<<<");/*tell teh player what we did*/ }else if ("get" in instruction){/*if we are retreiving the station*/ value=music[0];/*assign the value to the first array entry (stored at the [0] index)*/ return value;/*return the value*/ } } /* >>>THE ORDER OF EVENTS IN THIS SCRIPT IS VITAL TO ITS FUNCTION<<< instance =" Instantiate(prefab);" velocity =" Random.insideUnitSphere">

Communication between scripts

var playerHealth : NameOfGUIScript; //This will become a link to your player health.

function Start () {
playerHealth = FindObjectOfType(NameOfGUIScript); //This caches a link to that script.
}

function OnCollisionStay (collision : Collision) {
if (collision.relativeVelocity.magnitude > 0.1) {
playerHealth.health += 1; //Find the variable health in the script we found earlier and add 1 to it.
}
}

5/07/2010

Fade GUI in/out

var guiObject : GUITexture; 
var fadeTime = 1.0; 
enum Fade {In, Out} 

// Fade in the GUITexture, wait a couple of seconds, then fade it out 
function Start () { 
   yield FadeGUITexture(guiObject, fadeTime, Fade.In); 
   yield WaitForSeconds(2.0); 
   yield FadeGUITexture(guiObject, fadeTime, Fade.Out); 
} 

function FadeGUITexture (guiObject : GUITexture, timer : float, fadeType : Fade) { 
   var start = fadeType == Fade.In? 0.0 : 1.0; 
   var end = fadeType == Fade.In? 1.0 : 0.0; 
   var i = 0.0; 
   var step = 1.0/timer; 
    
   while (i < 1.0) { 
      i += step * Time.deltaTime; 
      guiObject.color.a = Mathf.Lerp(start, end, i)*.5; 
      yield; 
   } 
}

5/06/2010

Resources for Team Engine

IsPlaying syntax

animation.IsPlaying("wallcrumble");
http://unity3d.com/support/documentation/ScriptReference/Rigidbody.html


MovieTexture.IsPlaying("friends");


Resources

Twitter-room
http://forum.unity3d.com/viewtopic.php?t=41934&highlight=twitter

Drunk-effect
http://www.pixelplacement.com/iTween/


Short script for timer

yield WaitForSeconds(10.0);
Application.LoadLevel("SceneName");



Script for timer before warping back to apartment

var startTime = 30.0;
var minutes : int = 0;
var seconds : int = 20;
var fraction : int = 0;
var timeLeft = startTime;

function Update () {

//The time left for player to complete level
timeLeft = startTime - Time.time;
//Don't let the time left go below zero
timeLeft = Mathf.Max (0, timeLeft);
//Format the time nicely
guiText.text = FormatTime (timeLeft);
// Loads the level with index 0
if (timeLeft <= 1.0) {
Application.LoadLevel (0);
}
}

//Format time like this
//12(minutes):34(seconds).5(fraction)

function FormatTime (time) {
var intTime : int = time;
var minutes : int = intTime / 60;
var seconds : int = intTime % 60;
var fraction : int = time * 10;
fraction = fraction % 10;

//Build string with format
//12(minutes):34(seconds).5(fraction)

timeText = minutes.ToString () + ":";
timeText = timeText + seconds.ToString ();
timeText += "." + fraction.ToString ();
return timeText;
}


Tutorials 1
http://www.unifycommunity.com/wiki/index.php?title=Tips

Tutorials 2
http://www.unifycommunity.com/wiki/index.php?title=Tutorials

5/04/2010

GUISkin Creation Walkthru

If you are creating a GUI Skin from scratch, I can suggest this workflow:


In Illustrator:

1. Develop your style/theme and drag a few different backgrounds in for alpha testing (this is important if you make semi-transparent windows).

2. Create a mock of the complete skin including all the controls.

3. Check the transparent elements again black, white and your other backgrounds - make sure some mock text is readable with a busy background behind.

4. Switch to Pixel layout made and check the clarity of each control. Resize, and adjust as needed.

5. Create a new layer and copy the skin into it. Turn off the old skin layer - its a backup incase things get funky.

6. In the new layer, break the skin apart into functional elements (i.e. match each part to a Unity GUISkin GUIStyle.


Exporting Illust to Pshop

7. Copy each element and paste into a single new photoshop document. I usually do this by category to avoid confusion. You should have a big jumble of controls on one page with lots of layers - this is good.


In Photoshop:

8. When you paste a control in from Illustrator, it will almost never come in perfectly. There are often stray or misaligned antialiasing pixels and whatnot. You need to manually make each element "pixel-perfect". I tend to copy and rotate elements to ensure they mirror each other. In photoshop, if you paste pixels with less than 100% opacity over eachother, the effects are additive, so make sure your paste target area is empty. This care taken in this step is the difference between a polished and average GUI.

9. Cut up the resizable controls to their minimum. For buttons and windows, this just means finding the last row and column of repeatable pixels before the corners kick in, deleting what's in between and merging the results. You should leave a single line of repeatable pixels for each corner - less than this can give odd results.

10. Copy each element and paste it into a new document - I would suggest pasting each state of the same element into the same document and making sure they line up.

11. Save the PSD as the element name and then export for Web as a PNG. Make sure you have a good naming convention for each control state (like buttonNormal, buttonHover etc).


In Unity:

12. Create the GUI skin and assign the elements. I always turn off Mipmapping, as Nicholas said, and I never use DXT compression instead opting for RBGA32. Better to sacrifice a little memory for a super-crisp GUI.

13. You'll need a GUI script to see all your elements. You can use mine, if you don't mind C#. Its here - http://forum.unity3d.com/download.php?id=2330

14. Adjust the margins and borders for each of the GUIStyles - the horizontal scrollers & sliders can take a bit of fiddling - for sliders use the overflow properties to get things lined up correctly. Remember: the thumb is larger than the slider, thus; left & right overflow = (slider width or height - thumb width or height) / 2.


If you're not bad at Illust & PShop it takes around 1 day from concept to getting a skin up and running in Unity.


Source: http://www.unifycommunity.com/wiki/index.php?title=GUISkin_Creation_Walkthru

5/03/2010

How to make icon for interactive.

Try get hold of a software called Iconographer.

* Create a .icns file using Iconographer, Icon Composer or a similar tool. Save it as "UnityPlayerIcon.icns".

* Control click your built game application and choose Show Package Contents. Go to the Contents folder, then into Resources. You should see a file named "UnityPlayerIcon.png" here. This is supposed to be the default icon, but it doesn't appear (probably because it's a PNG instead of a .icns file). Don't delete it - Unity might be using it for some other purpose.

* Drop your UnityPlayerIcon.icns file into this Resources folder.

* Now for the fun bit. The Finder is notoriously bad at noticing when an application's default icon has changed, so you need to do a little dance to make it realise what's happened. Logging out and in again usually works. Alternatively, you may be able to make the new icon appear by duplicating the game from the Finder - the copy should appear with the correct icon.



Source: Unity forum

Free sounds.

Monday - Resources from Ole

How to make splash screen.



How to reduce file size. Must read for Production Team!
How to optimize performance. Must read for Production Team!





Have fun!