Tutorial: 1st-person sneak in Unity 5, part 8

It is time to create a start menu for the game. For that, we need a scene. After creating the scene, rename the scene file to “start_screen” or something like that.

(Scroll down for the links to previous parts of this tutorial.)

Add the scene to the build settings (File->Build Settings…)

Make sure that start_screen scene is scene number zero (that scene will be loaded when the game starts).

Continue reading

Advertisements

Tutorial: 1st-person sneak in Unity 5, part 5

This part adds logic for the PC and keep track of things such as health, dying. I also add functionality for invisibility (that have already partly added in Guard class).  I also add HUD using the new GUI system to show health and energy (that is used to maintain invisibility).

Previous parts:

Continue reading

Tutorial: 1st-person sneak in Unity 5, part 2

The first part of tutorial: /2015/05/07/tutorial-1st-person-sneak-in-unity-5-part-1/

The guards needs to be able to observe their surroundings so we need a perception system. I want to make agent not to see its back, but sensing if someone is really close and have some peripheral vision with limited range (cf figure below). Also, guard should not be able to see through obstacles.

Continue reading

Tutorial: 1st-person sneak in Unity 5, part 1

This tutorial goes through how to build a 1st person sneaking game with simple enemies/guards that patrols predefined routes and if they spot the PC they start to follow and attack if they get near enough. A short video clip demonstrates the guard behaviour this tutorial builds.

This tutorial assumes that you are familiar with Unity and can create game objects, prefabs, and scripts.  The code snippets below are in C#.

Continue reading

Colliders and Different Methods of Moving Objects in Unity

One problem with students starting to work with Unity is to understand when colliders work and when they do not work. This very simple demonstration shows how Physics::AddForce(), CharacterController:: SimpleMove() and Translate.Transform() behaves with colliders. Moving a GameObject using Physics and CharacterController based methods interacts with collisions whereas Transform::Translate() does not as seen in the video. Moreover, Translate does not work with MonoBehavior::OnTriggerEnter().


Physics::AddForce():

public class PhysicMove : MonoBehaviour {

	void Start () {
		rigidbody.AddForce (new Vector3 (100, 0, 0));
	}
}

CharacterController::SimpleMove()

public class Move : MonoBehaviour {

	public float speed;

	private CharacterController controller;

	void Start () {
		controller = GetComponent ();
	}
	
	void Update () {
		controller.SimpleMove (new Vector3 (1, 0, 0) * Time.deltaTime * speed);
	}
}

Transform::Translate()

public class MoveTranslate : MonoBehaviour {

	public float speed;

	void Start () {
		enabled = false;
	}

	void Update () {
		transform.Translate (new Vector3 (1, 0, 0) * Time.deltaTime * speed);
	}
}

An Experiment in Teaching Level Design

I wanted to introduce some unconventional design approaching while teaching level design. I have had an idea to do a game with using a surrealist  approach. For that I designed a game stub and coded the base functionality on the top of Unity. The student are tasked to do level design using that design, code, created prefabs.

My slides for the course intro (http://www.slideshare.net/lankoski/level-designintro)