Escape: Level Design Exercise in Unity

32
Escape Level Design Exercise in Unity Petri Lankoski

description

Slides introduces Escape package that is developed for teaching Unity. The package contains building blocks for a simple first person sneaking game. Contents: - Introduction to prefabs in package - Level design assignment Download the Unity package: http://www.mediafire.com/download/2t49ajxl6n7xq3z/escape_new.unitypackage

Transcript of Escape: Level Design Exercise in Unity

Page 1: Escape: Level Design Exercise in Unity

Petri Lankoski

EscapeLevel Design Exercise in Unity

Page 2: Escape: Level Design Exercise in Unity

Petri Lankoski

Goals Learn to use with Unity

editor in level design

Familiarize to simple level design task

Prerequisites Familiar with

the Unity interface Materials in Unity How to create textures

and import them to Unity

Page 3: Escape: Level Design Exercise in Unity

Petri Lankoski

ContentsUnity package Escape

Level design assignment description Using Escape package

Page 4: Escape: Level Design Exercise in Unity

Petri Lankoski

Escape PackageHow-To

Page 5: Escape: Level Design Exercise in Unity

Petri Lankoski

An Example Intended to show how main pieces are used

Prefabs with functionality

Not an example of level design

Not cover all aspects of level design No examples working with materials and 3D models

StartScreen(scene 0) level1 level2 level3 TheEnd

An enemy patrolling + door

A door with a lock + key + power-ups

Gate + lever

Page 6: Escape: Level Design Exercise in Unity

Petri Lankoski

Set-up Create New Unity Project

File -> New Project

It is important to start from empty Unity project!

Select folder and name

All packages should be unchecked

Page 7: Escape: Level Design Exercise in Unity

Petri Lankoski

Set-up… Download the unity

package

Import package to Unity Assets -> Import

Package -> Custom Package…

Select escape_new.unitypackage

Click Import

Page 8: Escape: Level Design Exercise in Unity

Petri Lankoski

Prefabs Main components are in

Prefabs folder Enemy

Waypoint Health power-up Power power-up Door Door with key

Key Gate Gate with Lever Some wall pieces

Page 9: Escape: Level Design Exercise in Unity

Petri Lankoski

Start Screen Add StartScreen prefab

Save scene File->Save

Name it as StartScreen Move the StartScreen

scene to Scenes folder

Add scene to Build File->Build Settings… Click “Add Current”

Page 10: Escape: Level Design Exercise in Unity

Petri Lankoski

StartScreen Object

Credits screen Uses these

Write level1(new Game loads this level)

Page 11: Escape: Level Design Exercise in Unity

Petri Lankoski

Level1 Save Scene

Create new scene File -> New Scene

Save and name the scene File->Save Scene Name should be level1

Move level1 to Scenes folder

Add scene to Scenes to be build File->Build Settings…

Page 12: Escape: Level Design Exercise in Unity

Petri Lankoski

Building a Level

Delete Main Camera

1. GameObject->Create Other-> • Directional light• Plane

2. Scale the plane3. Move the plane to <0,0,0>

Add GameManager

Add PlayerStart- Place it above the Plane

Page 13: Escape: Level Design Exercise in Unity

Petri Lankoski

Some TipsStart building your levels at <0,0,0>

In project use folders E.g., all scene files belongs to Scenes folder Do not leave thing floating around at the top level

In Hierarchy one can use an empty GameObject like folder Moving that empty GameObject moves all children

Page 14: Escape: Level Design Exercise in Unity

Petri Lankoski

Building the first Level

• NextLevel:• size: 1• Element0:

level2• If more than one

level specified, the level is picked randomly

• GameFinished• Check if this is

the game if finished after reaching this door

Page 15: Escape: Level Design Exercise in Unity

Petri Lankoski

Adding an Enemy

First we need create a patrol route for the enemy• A three waypoints• Rename

• Waypoint1• Waypoint2• Waypoint3

• Make sure that the waypoints (colliders) are just fully above the plane

Page 16: Escape: Level Design Exercise in Unity

Petri Lankoski

Adding an Enemy…

Add the enemy• Place it near

waypoint1• Make sure that the

enemy (CharacterController) is just fully above the plane

Connect the Enemy to the Waypoint1• Drag-and-drop

Waypoint1 to Target in Inspector

Page 17: Escape: Level Design Exercise in Unity

Petri Lankoski

Connecting Waypoints

1. Select Waypoint12. Drag-and-Drop

Waypoint2 to NextTarget of Waypoint1

3. Select Waypoint2 4. Drag-and-drop

Waypoint3 to NextTarget

5. Select Waypoint3 6. Drag-and-drop

Waypoint1 to NextTarget

Page 18: Escape: Level Design Exercise in Unity

Petri Lankoski

Ready Enemy

• Save Scene!

Page 19: Escape: Level Design Exercise in Unity

Petri Lankoski

Second levelCreate new Scene

Remove MainCamera

Add Plane DirectionalLight GameManager PlayerStart

Save scene Name it level2

level2 is the name we added to door in level1

Page 20: Escape: Level Design Exercise in Unity

Petri Lankoski

Door with a Lock

• Set-up door: NextLevel = level3

• Number of keys needed to make door visible and accessible

Page 21: Escape: Level Design Exercise in Unity

Petri Lankoski

Keys

Place three keys

Page 22: Escape: Level Design Exercise in Unity

Petri Lankoski

Power-ups

• Save Scene!

Page 23: Escape: Level Design Exercise in Unity

Petri Lankoski

Third LevelFile->New Scene

Delete MainCamera

Add DirectionalLight Plane Door (Next Level: TheEnd, check Game Finnished) PlayerStart GameManager

Page 24: Escape: Level Design Exercise in Unity

Petri Lankoski

Gate

Add walls• Gate prevents

accessing door• We need a way to

open the game

Page 25: Escape: Level Design Exercise in Unity

Petri Lankoski

Switch to the gate

Page 26: Escape: Level Design Exercise in Unity

Petri Lankoski

Gate

Lever control Disable Type

Absolute Lever turns the gate

on/off Timed

Gate will active after a Disable Time has elapsed.

Disable Time Second the game if off

Off intervals Intervals

If check the gate will turn on and off randomly

Min time Minimum that time (sec)

that the gate if off in one time

Max time

Maximumthat time (sec) that the gate if off in one time

Page 27: Escape: Level Design Exercise in Unity

Petri Lankoski

TheEnd scene Create new scene

Add TheEnd prefab to the scene

Save the scene Name it as TheEnd

Add to Scenes to be build File->Build Settings…

Page 28: Escape: Level Design Exercise in Unity

Petri Lankoski

Building Web Player File->Build Settings

Platform: Web Player

Build

Page 29: Escape: Level Design Exercise in Unity

Petri Lankoski

Thanks to Oscar Romin

Programming / Electric Gates

Andreas Jansson Electric gate model Power power-up model

License Escape Unity Assignment

by Petri Lankoski is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Page 30: Escape: Level Design Exercise in Unity

Petri Lankoski

Level Design Assignment

Page 31: Escape: Level Design Exercise in Unity

Petri Lankoski

AssignmentBuild a game that has 3–5 small levels using

Escape Unity package

The game is a 1st person sneaking game where the player should find ones way via levels that are patrolled by monsters. The monsters shoot an electrical ray if they see the player. The player can turn oneself invisible in order to evade the monsters. Being invisible draws energy. If the player runs out of energy, it is not possible to turn oneself invisible.

Page 32: Escape: Level Design Exercise in Unity

Petri Lankoski

Requirements 3–5 small levels (playtime around 2–5 minutes)

All main components are in used in the game Do not use every main component type in one level Do not modify the looks of main components Use inspector to fine-tune the behavior of the main components

The game is possible to play through

No new component with functionality. You should the gameplay using the above-listed main components.

In addition to ready-made level pieces, create your own pieces to make levels in Maya or use Unity’s components

Object should be textured and the levels should have one directional light

The web player should be less than 100MB

Return as Unity Web Player