virtual worls and serious games

25
© Cláudia Ribeiro UNITY3D INTRODUCTION

Upload: dangxuyen

Post on 14-Feb-2017

228 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: VIRTUAL WORLS AND SERIOUS GAMES

© Cláudia Ribeiro

UNITY3D INTRODUCTION

Page 2: VIRTUAL WORLS AND SERIOUS GAMES

Unity3D

© Cláudia Ribeiro AVT 2012

Page 3: VIRTUAL WORLS AND SERIOUS GAMES

Unity3D Engine

© Cláudia Ribeiro AVT 2012

Page 4: VIRTUAL WORLS AND SERIOUS GAMES

RENDERING Deferred Renderer On modern hardware your games can use a new state-of-the-art deferred rendering pipeline. 100 Built-in shaders Unity comes with 100 shaders ranging from the simplest (Diffuse, Glossy, etc.) to the very advanced (Self Illuminated Bumped Specular, etc.). Scalability When using advanced shader effects you want to make sure your game runs well across all your target hardware. Full Screen Post-Processing Effects Unity has tons of full-screen image postprocessing effects built in: Sun shafts, high quality depth-of-field, lens effects, chromatic abberation, curve-driven color correction and lots more. Surface Shaders With Unity 3, we're introducing Surface Shaders, a new simplified way to author shaders for multiple devices and rend

Page 5: VIRTUAL WORLS AND SERIOUS GAMES

PERFORMANCE Batching

In order to minimize draw calls, Unity will automatically combine your geometry into batches. This significantly minimizes driver

overhead while retaining full flexibility.

Occlusion Culling

Together with Umbra Software – used in many AAA games – Unity developed a completely new Precomputed Visibility Solution,

only available in Unity.

GLSL Optimizer

OpenGL ES finally allows for use of full shaders on mobile devices. Sadly, many graphics drivers still leave a lot to be desired.

Rewritten Rendering Engine

For Unity 3 we rewrote the entire rendering backend to be more flexible and powerful than ever before.

Page 6: VIRTUAL WORLS AND SERIOUS GAMES

LIGHTING Deferred Renderer

With Unity 3 we rewrote the entire rendering backend. Now, Unity Pro adds deferred lighting, using the modern light pre-pass

technique.

Realtime Shadows

Soft and hard realtime shadows can be cast from any light in the scene.

Screen Space Ambient Occlusion

Unity Pro has SSAO as a standard image effect. Add this component to any camera and get a better looking game, it's really that

simple.

Sun Shafts & Lens Effects

Unity 3 Pro also adds sunshafts/godrays as a built-in effect. Simply add the component to a camera and get an immediate

ambience boost.

Page 7: VIRTUAL WORLS AND SERIOUS GAMES

PHYSICS NVIDIA® PhysX® Unity contains the powerful NVIDIA® PhysX® next-gen Physics Engine. Rigidbodies Unity supports full Rigidbody physics. Rigidbodies act under forces, collide, and work in Joints with no scripting required. Joints Hinges, springs, ball-sockets, character limbs, and the fully-customizable configurable Joint. Make them breakable to allow emergent game play. Soft Bodies Unity 3 lets you make soft bodies of objects – so you can make nice semi-deflated beach balls that interact realistically with the environment. Ragdolls Unity comes with a wizard that lets you set up a full ragdoll from animated character in seconds. You can tweak the ragdoll as needed for unique behaviors.

Page 8: VIRTUAL WORLS AND SERIOUS GAMES

AUDIO Edit Away

All key audio properties are driven by attenuation curves in the inspector. This gives you the smoothest workflow to getting your

worlds to sound just right.

Tracker Power

To conserve distribution size, Unity support most common tracker file formats: MOD, IT, S3M and XM can be pulled in and used

natively in the project. Naturally, all filters work on them.

Live Previewing

Simply turn on the preview button to hear your complete environment in the editor. Never before has audio tweaking been so

natural, yet so powerful.

Instant-on Streaming

Ogg Theora video and Ogg Vorbis audio files can be streamed from the net. No need to bloat your Web Player download size

with several audio tracks before they're needed.

Page 9: VIRTUAL WORLS AND SERIOUS GAMES

PROGRAMMING Performance Scripting is frequently thought of as limiting and slow. But in Unity the blazing fast iteration times and ease of use of scripting languages are paired with compilation to native code and thus run nearly as fast as C++. And Unity's JavaScript implementation runs the same speed as C# and Boo. Visual Properties Public variables defined by scripts are shown in the Unity Editor. You simple drag objects to set variable references, pick from drop-down lists, and change colors with a color picker. In short, no need to write glue code. .NET based Game logic runs on the Open Source .NET platform Mono. This gives you the full strength, speed and flexibility of one of the world's leading programming environments. Flexible and Easy Moving, rotating, and scaling objects just takes a single line of code. Duplicating, removing, and changing properties likewise. Everything can be referenced directly, by name or hierarchy, tags, proximity, or touch.

Page 10: VIRTUAL WORLS AND SERIOUS GAMES

NETWORK Realtime Networking

Unity makes the complexities of realtime networking easy to negotiate. Turning a single-player game into a networked multiplayer

game requires few changes to your existing code and you never have to worry about networking technicalities like NAT

punchthrough.

State Synchronization

GameObject position, velocity, animation, and anything else can be synchronized between players using a delta compression

algorithm or uncompressed unreliable strategies.

Remote Procedure Calls

Easily call any functions on any other clients, without the need to do marshalling or other network negotiation.

Page 11: VIRTUAL WORLS AND SERIOUS GAMES

UNITY 3D EDITOR

Page 12: VIRTUAL WORLS AND SERIOUS GAMES

INTEGRATED EDITOR Live Preview

Instantly run your game inside the editor and preview how it behaves on the platforms that matter to you. You can alter values,

assets, and scripts while playing.

Prefabs

To streamline the repeated use of complex objects, you can turn one or more of them into a Prefab. This Prefab can then be easily

placed throughout the game or instantiated at runtime

Customization

Create specialized editor tools and build them into the existing Unity Editor interface using Editor Windows and custom Inspectors

Asset Management

When you're working with large projects you want to find your assets fast. In Unity 3, we added a project browser that shows

everything with interactive previews, tagging and searching – always have the assets you need at your fingertips.

Page 13: VIRTUAL WORLS AND SERIOUS GAMES

ASSET PIPELINE Automatic & Instantaneous Importing

When any asset file is saved, it is without exception seamlessly imported. Each asset's Import Settings are stored, so you can set

them once and never worry again.

Incredible 3D Package Support

Unity can import 3D models, bones, and animations from almost any 3D application. See the bottom of this page for details.

Just Hit Save

Hit Save in Maya, 3ds Max, Cinema 4D, Cheetah3D or Blender, and Unity will pick up the changes across your entire project. It 's

that simple. See the bottom of this page for a full list of supported formats.

TrueType Font Support

Unity handles pixel-perfect rendering of Unicode TrueType fonts. Drop in any TTF font and start making great-looking text. When

localization time rolls around Unicode strings are supported as well as IME input.

Page 14: VIRTUAL WORLS AND SERIOUS GAMES

ASSET SERVER Integrated and Immediate Updates, commits, and graphical version comparisons are all performed inside the Unity Editor. When files are modified, their status is updated instantly. Renaming and moving assets is handled elegantly and seamlessly. Open Source Server The enterprise-level database PostgreSQL powers Unity Asset Server. PostgreSQL is famous for reliability, data integrity, and easy administration and backups. PostgreSQL handles the workloads of enormous projects. Windows, Mac OS X, and Linux Unity Asset Server is available as Microsoft Windows and Mac OS X Installers and as Linux RPM, Debian, and source code packages. The support for multiple platforms gives you flexibility in how to integrate Unity Asset Server into your existing IT infrastructure. Optimized for Big Projects Multi-gigabyte projects with thousands of multi-megabyte files are handled with ease. Import settings and other metadata are stored and versioned too.

Page 15: VIRTUAL WORLS AND SERIOUS GAMES

PUBLISHING True Multiplatform Authoring

Unity 3 lets you target all platforms from a single tool. Within a single project you have complete control over delivery to all

platforms.

Instant Previews

The Unity Editor emulates all your selected platforms. Try the game as it will be when you deploy.

Painless Coding

Unity makes it simple to keep your code working across many devices. Unity abstracts away the majority of platform differences.

When precise control is needed, simply use #ifdef to specialize code per platform.

Precise Quality Control

Unity lets you specify texture compression and resolution settings for each platform your game supports. This lets you use a single hi-

res Photoshop file and have it all just work.

Page 16: VIRTUAL WORLS AND SERIOUS GAMES

Unity3D Hand’s On

© Cláudia Ribeiro AVT 2012

Page 17: VIRTUAL WORLS AND SERIOUS GAMES

EDITOR LAYOUT Scene Allow the user to navigate inside the scene in a development mode, the user can drag and drop objects and perform several changes inside the scene. Hierarchy Represents a graph a game objects, similar to an high level scene graph. Project Gives access to the project file hierarchy. Inspector Allow the user to attach scripts to a component and configure several variables like position, colors, rotation and many other.

Page 18: VIRTUAL WORLS AND SERIOUS GAMES

GAME OBJECTS A GameObject is a container for many different Components. By default, all GameObjects automatically

have a Transform Component. This is because the Transform dictates where the GameObject is located,

and how it is rotated and scaled. Without a Transform Component, the GameObject wouldn't have a

location in the world. Try creating an empty GameObject now as an example. Click the GameObject-

>Create Empty menu item. Select the new GameObject, and look at the Inspector.

Remember that you can always use the Inspector to see which Components are attached to the selected

GameObject. As Components are added and removed, the Inspector will always show you which ones are

currently attached. You will use the Inspector to change all the properties of any Component (including

scripts).

Page 19: VIRTUAL WORLS AND SERIOUS GAMES

SCRIPTING Scripting inside Unity is done by writing simple behaviour scripts in JavaScript, C#, or Boo. You can use one or

all scripting languages in a single project, there is no penalty for using more than one. Unless stated

otherwise, all the scripting examples are in JavaScript.

We will use always C# scripts.

Scripting inside Unity consists of attaching custom script objects called behaviours to game objects. Different

functions inside the script objects are called on certain events.

Page 20: VIRTUAL WORLS AND SERIOUS GAMES

© Cláudia Ribeiro

• 1ª Class

Goals: - Create basic primitives and prefabs

- Lights and textures

- Character Controller

- Collisions

Page 21: VIRTUAL WORLS AND SERIOUS GAMES

EXERCISE 01

Goals: Build a box with a set of cubes.

Steps: 1. Create a new game object (cube) (GameObject -> Create Other -> Cube) 2. Change his position and scale using the inspector. 3. Test the scene using the play button.

Page 22: VIRTUAL WORLS AND SERIOUS GAMES

EXERCISE 02

Goals: Add textures and lights

Steps: 1. Create a new game object (point light and spotlight) (GameObject -> Create Other

-> Spotlight/Point Light) and position appropriately in the scene 2. Change the texture of each “wall”. Download a texture from the internet, create a

folder in the Project hierarchy and drag it inside unity3D. Finally drag it to the wall. 3. Test the scene using the play button.

Page 23: VIRTUAL WORLS AND SERIOUS GAMES

EXERCISE 03

Goals: Create a prefab and add a character controller

Steps: 1. Create an empty game object and drag all the game object to make up your box.

Create a directory “prefab” In the project hierarchy and drag to it the empty game object.

2. Assets -> Import Package -> Character Controller 3. Add First Person Controller to the scene.

Page 24: VIRTUAL WORLS AND SERIOUS GAMES

EXERCISE 04

Goals: Create a empty script and detect collision with a game object

Steps: Open the Assets->Create->JavaScript (orAssets->Create->C Sharp Script or Assets-

>Create->Boo Script) from the main menu. This will create a new script called NewBehaviourScript and place it in the selected folder in Project View.

Page 25: VIRTUAL WORLS AND SERIOUS GAMES

Homework

© Cláudia Ribeiro AVT 2012