Some of the other posts Here are the other posts in the series.
Introduction This post is the 4th in a series about providing additional content for the Windows 8 App Factor learning series.
- This post has two goals:
- Describe the product Unity
- Point developers to other Windows 8 Starter Kits
Quick Facts Here is some quick facts about Unity.
- Unity (also called Unity3D)
- A cross-platform game engine with a built-in IDE developed by Unity Technologies.
- Main advantage is that you are working in an authoring environment, not C++ in Direct3D.
- Direct3D is not for the feint of heart.
- You can also port to multiple platforms easily.
- Primary Use
- Develop video games for web plugins, desktop platforms, consoles and mobile devices
- The things that simplify a developer’s life
- Asset Pipeline
- Work with output from modeling software
- Play with materials and textures easily
- Building Scenes
- Using building blocks (PreFabs, GameObjects, Components)
- Iterating fast
- Just hit “play” avoid long recompilations
- Scripting, not C++
- Less code means less headaches
- Easily implement multi-player games
- Developer Audience
- Utilized by over one million developers
- Focused on
- Unity is primarily used to create mobile and web games
- You can also deploy games to consoles or the PC
- Written in
- The game engine was developed in C/C++
- It currently supports development for iOS, Android, Windows, OS X, Linux, web browsers, Flash, PlayStation 3, Xbox 360, and Wii U
- It grew from an OS X supported game development tool in 2005 to the multi-platform game engine that it is today
- Latest Version
- The latest update, Unity 4.1, was released March 2013
- 2 versions
- The game engine is downloadable from their website in two different versions: (1) Unity and (2) Unity Pro
Unity – What it supports for Graphics APIs The graphics engine uses the following APIs.
||Windows, XBOX 360
||Direct3D is part of Microsoft’s DirectX application programming interface (API). Direct3D is available for Microsoft Windows operating systems (Windows 95 and above), and for other platforms through the open source software Wine.
||Mac, Windows, Linux
||OpenGL (Open Graphics Library) is a cross-language, multi-platform API for rendering 2D and 3D computer graphics. Developed by Silicon Graphics Inc. in 1991. OpenGL is managed by the non-profit technology consortium Khronos Group.
||OpenGL for embedded systems such as mobile phones
||Set of C++ classes that allow you to connect to your Wii remote through Windows’ HID interface to send and receive commands
Key features in programming graphics and games Here are some examples of the capabilities the modern game programmer needs.
- Bump mapping
- A technique in computer graphics for simulating bumps and wrinkles on the surface of an object
- Makes a rendered surface look more realistic by simulating small displacements of the surface
- Reflection mapping
- Efficient image-based lighting technique for approximating the appearance of a reflective surface by means of a precomputed texture image
- Is more efficient than the classical ray tracing approach of computing the exact reflection by tracing a ray and following its optical path
- Parallax mapping
- An enhancement of bump mapping.
- An example is stone walls that have more apparent depth and thus greater realism
- At steeper view-angles, the texture coordinates are displaced more, giving the illusion of depth due to parallax effects as the view changes
- Screen space ambient occlusion (SSAO)
- In realtime, it approximates the way light radiates in real life, especially of what are normally considered non-reflective surfaces.
- For objects that are close together areas tend to block out or occlude ambient light, hence they appear darker.
- Looks more realistic. Compare here.
- Dynamic shadows using shadow maps
- Shadows are added to 3D computer graphics in realtime
- Rendering to texture, or “texture baking,” allows you to create texture maps based on an object’s appearance in the rendered scene.
Game Types Video games can be categorized into different genres, which is nothing more than a fancy way to categorize games based on the gameplay interaction.
- In the action game category, you will find some familiar approaches to gaming, such as a fighting game, a pinball game, ball and paddle, and first-person shooter, to name a few.
- First Person Shooter
- One of the more popular approaches to creating action games is first-person shooter, which is a video game genre centered on gun and projectile weapon-based combat through a first-person perspective
- Razor Salvation
- For additional genres, see http://en.wikipedia.org/wiki/Video_game_genre
Top-down perspective AKA bird’s-eye view, Overworld, overhead view or helicopter view.
- Used be popular with 2D role playing video games
- Railroad Tycoon
- The Legend of Zelda
- Grand Theft Auto
- Microsoft GunPowder
Unity Editor interface
You will need to learn the user interface.
Unity and the demos A lot of great examples are available to give you a clear picture of what is exactly possible with Unity.
- Check out demos below
You generally need a 3D modeling package to create a rough version of your asset. Maya3D is typically used.
A scene contains a collection of assets.
Key Relationships At a high level, here is the way to think about how scenes are constructed
- Assets – Examples
- Materials have textures
- Materials are applied on to GameObjects
- Animations are applied on to GameObjects
- Sound Files
- Sound files are added to GameObjects
- Unity defines the following components:
- Mesh Renderer
- Audio Source
- You can group things together with PreFab
- Prefab is top level component for GameObjects
- GameObjects + Components = PreFab
- Think of GameObjects as types and PreFab as real live obects
- You can clone PreFabs and all clones can update in unison
Creating Scenes Scenes contain the objects of your game
- Scenes contain the objects of your game
- Scenes instantiate PreFabs and GameObjects
- Scenes have cameras and act as the eyes for the scene
- The player looks through the camera
- Cameras can be pointed and positioned
- Scenes have lights and create shadows
Grid App Templates There are a number of samples that demonstrate the use of the Grid App template available on CodePlex.
- With each sample, you typically get both C# and JS versions:
Examples Cover many categories