matthewtsmall
Uploaded by
23 SLIDES
233 VUES
230LIKES

test 2

DESCRIPTION

a test

1 / 23

Télécharger la présentation

test 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Scripting Basics Presented by Dr. Matthew Small

  2. Today’s Topics • Scripting • Scripting Overview • Dynamically changing transforms usingscripting

  3. Scripting • Scripts allow us to interact with GameObjects and Unity at runtime and are crucial to implementing complex game behaviors • Unity supports: • C Sharp (C#) • Javascript (UnityScript) • Boo (a python derivative)

  4. How Scripts are Used • Scripts are attached to GameObjects as components • There are special functions you can create that will be called automatically by Unity while your game is playing • It is like you are writing an event handler to run certain code whenever an event occurs • Two example events: • Your script’s Start() routine will be called when the game is initialized • Your script’s Update() routine will be called once per frame (i.e. once every time the picture on the screen is updated) • Scripts are often written with code that applies to the GameObject it is attached to

  5. A C# Script

  6. The Unity Game Loop Game Initialization Player Input Game World Simulation Game Loop Rendering Exit Game Shut Down

  7. These functions are similar to event handlers • When EVENT occurs, Unity executes the following sequence: Scene GameObjects Attached Scripts • for every GameObject GO in the Game Scene{ • for every Script S attached to GO{ • if(S has a function F to handle EVENT ) • call S.F(); • } • } . . . . . .

  8. Scripting

  9. Vector

  10. Transform Translation void Translate (Vector3 translation, Space relativeTo = Space.Self); • Moves a GameObject’s transform in the direction and distance of translation • A Vector3 is a structure (like a object in the object-oriented programming sense)

  11. Wrapping Up • If you have not already, download and install Unity • You may reference these videos to learn more about basic navigation of the editor:

  12. SCRIPTING BASICS Demonstration 2

  13. Homework 1 • Create a Unity game that has the following characteristics: • A single cube is located the middle of the screen • Modify the Scaler script to do the following: • Every time the “b” (bigger) key is pressed, the cube will grow slightly • Every time the “s” (smaller) key is pressed, the cube will spin left • Submit your entire project folder via Dropbox

  14. Physics • Unity has NVIDIA PhysX physics engine built-in • Add RigidBodycomponent to enable physics on a GameObject • Now under the control of physics engine • Gravity, collisions, momentum, etc. handled • You don’t edit RigidBody’s transform manually • GameObject’s ‘Collider’ component will be used to handle its physical representation

  15. OUR FIRST GAME Demonstration 3

  16. Additional Resources • Unity Scripting Reference • http://docs.unity3d.com/Documentation/ScriptReference/index.html • Unity Manual • http://docs.unity3d.com/Documentation/Manual/index.html • Book I am using • http://www.amazon.com/gp/product/1849691444/ref=oh_details_o01_s00_i00

  17. Video Game Organization • Video games are often composed of

  18. How Video Games are Programmed • Library-based development

  19. Game Rendering Code Graphics Library Graphics Hardware

  20. Advantages of Unity3D • Supports “author once, deploy everywhere” principle • Unity3D itself runs on Mac OS X or Windows • Projects created in Unity3D can be deployed on: OS X, Windows, Linux, IOS, Android, Flash, Wii, PS3 and Xbox • Supports state-of-the-art technologies for designing professional games • Flexible development model supports nearly any game mechanic imaginable • Robust asset store to easily purchase and import professional, ready-to-use game elements – or even an entire game!

  21. Tradeoffs of Unity3D • Unity is proprietary • Once you design a game in Unity, you are in their eco-system for better or worse. • Licensing • Free version to deploy for desktop and web-player (with splash-screen or watermark) for organizations grossing < $100k/year • Always costs to deploy to mobile/embedded devices (per device-type) • Standard licenses (https://store.unity3d.com/) • Academic licenses (http://www.studica.com/unity) • Arguably, better graphics can be achieved with other game engines such as Unreal(which costs much more)

  22. How Video Games are Structured • Home consoles (e.g. NES) became ubiquitous in the mid-80’s through modern day [1] Game Developer Magazine Survey, May 2012

  23. History of the Video Game Industry • First commercial video game was released in 1971 • Coin-operated arcade game called “Computer Space” • The next year, the hugely popular “pong” was released • The “golden age of arcade games” occurred from 1978 through the mid-80’s • Space Invaders, Donkey Kong, Pac-man, Frogger, etc. • Atari 2600 released in 1977 and popularizes cartridge-delivered content for home consoles [1] Game Developer Magazine Survey, May 2012

More Related