Showing posts with label Unity. Show all posts
Showing posts with label Unity. Show all posts

Tuesday, May 10, 2016

Dev Blog Entry 8

Unity Technical Questions:
  • What is the proper way to work with Animations and Animators in Unity without having to enable legacy components?
  • How do Unity Ads work?
  • How do you publish an game made in Unity to an app store?
  • Is it really that inefficient/bad to use OnMouseDown() rather than Raycasting to approximate touches on mobile games?
  • How do you develop games for consoles using Unity? How do you get input from game controllers in Unity?
What I Learned:
  1. Working with particles
  2. Making mobile games
  3. Working with UI elements/canvas scaling
The main resources I use to help me with any issues I encounter with Unity are the Unity Manual, the Unity Scripting Reference, and the Unity Answers forum. Unity has great documentation that has helped me figure out how to implement many of the mechanics that I have needed to implement for my games. Piazza was also a great resource for getting help from my classmates and my professor. My teammates were also extremely helpful for the two team projects I worked on. When all else failed, trial and error usually helped me figure out what I needed to do. It was also helpful to write down my ideas and make diagrams sometimes to help me visualize concepts/logic.

Monday, May 2, 2016

Touches/Taps On Objects In Mobile Games in Unity

Here's a script that will allow you to do something when you tap on a GameObject for mobile games in Unity. You could use OnMouseDown() and it would work, but after reading the Unity Reference and multiple forum posts it seems that this method is more efficient for mobile processors.

#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WEBGL
 void OnMouseDown() {
  //Code to execute when you click the object when the game is run on a non-mobile platform
 }

#elif UNITY_ANDROID || UNITY_IOS
void Update() {
    for(int i = 0; i<Input.touchCount; i++) {
        Ray ray = Camera.main.ScreenPointToRay (Input.GetTouch (i).position);
        RaycastHit hit;
        if(Input.GetTouch(i).phase == TouchPhase.Began) {
            if(Physics.Raycast(ray, out hit)) {
                //Code to execute when you touch the object when the game is run on a mobile platform (use hit.transform.gameObject or hit.collider.gameObject to refer to the GameObject that you touched)
            }
        }
    }
}
#endif

The way the code works is that if you run your game on a mobile device it will use Raycasting to determine when you touch the object and when you run your game on a non-mobile device it will use OnMouseDown() to determine when you click on the object. It is important to note that in order for Raycasting to work your object must have a 3D collider on it (ie. a BoxCollider instead of a BoxCollider2D). For more information on Raycasting you can look at Physics.Raycast in the Unity Reference.

-Reposted from Piazza

Thursday, April 7, 2016

Dev Blog Entry 4

Grim Fandango is a great game. Although I have never played it directly, I did watch the Super Beard Bros' playthrough of it on YouTube and it was amazing. The art style, the narrative, the characters, and the puzzles all worked really well together to create a compelling and immersive gameplay experience. I found the "Puzzle Document," which breaks down the design and development process for the game, to be very intriguing. I think it is great how organized everything is. It is extremely clear how much effort went into making the puzzles and narrative blend together seamlessly. The document definitely has given me ideas/inspirations that I can use to improve my own design process. I definitely like the idea of using flow charts to track the progression of the story and puzzles. I also was intrigued by the fact they wrote out detailed descriptions of the puzzles and their solutions. Furthermore, I found it interesting that they left the player some options in terms of the order they can play through the puzzles. I like the idea that, even though all the minigames need to be completed, some minigames can be worked on simultaneously. Overall, the designers/developers did a great job making a truly immersive game with a compelling story.

Dev Blog Entry 3

Link to WebGL version of the game: https://googledrive.com/host/0B0fww2eOQcDTXzU3cGVteVdsd0k/index.html
Link to video from start of game (WebGL does not support Movie Textures): https://drive.google.com/file/d/0B0fww2eOQcDTMWNsSThLZTBvNGM/view?usp=sharing

Our design went through many iterations throughout the development process. The biggest changes that happened in our game were made to help convey the story of the game. For example, there was originally supposed to be a minigame after every level but then we decided to only have them at the beginning as story telling devices. CAI (the evil AI) also got a bigger role as opposed to the minimal player interaction that she was originally planned for because we needed her as a story telling device. Another change that was made for the purpose of the story was that the Scientist character was added. There were other small things that we had to take out during development because we had trouble implementing them. The light on the chest of AHAB (the player) was supposed to flash every time it fired a lase but we could not figure out how to make that happen. We also could not include one semi-important narration file because it was supposed to play when AHAB broke the first wall with the laser and we could not figure out how to implement that.

There are still some aspects of the game we want to improve on/change based on the results of play testing. Some of the narrations were too long, specifically the one where CAI kills AHAB. There is also a glitch where the laser can hit the player if they are walking forward while shooting it. The game should also loop back to the menu or show some ending screen after the good or bad ending plays. It would also be cool to be able to incorporate some of the features that we could not figure out during development such as the blinking light and wall break dialogue mentioned above. Overall, our game was pretty well-received.

Monday, April 4, 2016

Creating Local Networked and Internetworked Games with Unity

Here is a link to the Unity Documentation for their tutorial on how to make a basic local networked game: http://docs.unity3d.com/Manual/UNetSetup.html. The tutorial is pretty straightforward and easy to follow.

Here is a link to the Unity Documentation that discusses how to integrate Unity's Internet Services (Matchmaking) into your game: http://docs.unity3d.com/Manual/UNetInternetServicesOverview.html. After you setup the Multiplayer service in your Unity account, all you have to do is apply the Matchmaking script they provide to your NetworkManager object. It also talks about using a Relay server but we never looked into what this does.

My group and I completed the tutorial I mentioned above and integrated the Matchmaking service in order to make the game playable over the internet. Here is Drive link to a folder that has a Windows build, a Mac build, and all of the source files: https://drive.google.com/folderview?id=0B0fww2eOQcDTMmljZEVxRWN0THM&usp=sharing. (If you can't get the Mac build to run, right click the package and select Show Package Contents. In the Contents folder, check for the info.plist file. If it's called info.plist.xml then you need to rename it to info.plist in order to make the app run.)

-Reposted from Piazza

Thursday, March 3, 2016

Video Texture in Unity

Here's the link to the Unity reference for how to do Movie Textures (aka how to put videos in Unity): http://docs.unity3d.com/Manual/class-MovieTexture.html. Below is the script that you need to play the movie with audio once the texture is assigned to an object (you must also add an Audio Source to your object):


using UnityEngine;
using System.Collections;

public class Video : MonoBehaviour {

 void Start () {
        ((MovieTexture)GetComponent<Renderer>().material.mainTexture).Play();
  AudioSource audio = GetComponent<AudioSource>();
  audio.clip = ((MovieTexture)GetComponent<Renderer>().material.mainTexture).audioClip;
  audio.Play ();
    }
}

-Reposted from Piazza