unity при побудові 3d ігор для windows 8 та windows phone

15
Unity при побудові 3D ігор для Windows 8 та Windows Phone Олег Прiдюк Технічний євангеліст, Unity Technologies

Upload: hakan

Post on 25-Feb-2016

79 views

Category:

Documents


0 download

DESCRIPTION

Unity при побудові 3D ігор для Windows 8 та Windows Phone. Олег Прiдюк Технічний євангеліст, Unity Technologies. Oleg Pridiuk Technical Evangelist. Multi platform Perfect support Ultimate flexibility. Why people choose Unity?. Unity is multi-platform. Windows Windows 8, RT, WSA - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

Unity при побудові 3D ігор для Windows 8 та Windows PhoneОлег ПрiдюкТехнічний євангеліст, Unity Technologies

Page 2: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

Oleg PridiukTechnical Evangelist

Page 3: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

Multi platformPerfect supportUltimate flexibilityWhy people choose Unity?

Page 4: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

Unity is multi-platform• Windows

• Windows 8, RT, WSA• Mac• Web

• Flash, Google NaCL, Facebook, Unity plugin

• Ubuntu Linux• Mobiles

• BlackBerry 10, Android, iOS, Windows Phone 8

• Consoles• PS Vita, PS4, PS3, Xbox 360,

Nintendo Wii U• Union• More to come!

Page 5: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

What does it take to port a Unity game?• Define a “game” in this context?

• Core gameplay – game logic, scenes, assets• Wrappers – monetization, social, plugins• Addons, process to update and patch

• Assuming “to port” means• Core gameplay launches on a new platform• Unity takes care of what it can control

• Texture compression, sounds, scripts, scene setup (physics, light probes, lightmaps, navigation, occlusion, etc)

• Cross platform plugins, if applicable• Performance?

Page 6: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

Performance may vary hard!

NVIDIA GeForce 650 NVIDIA GeForce 650M

NVIDIA Tegra 3 Qualcomm Adreno 225

0100200300400500600700800900

GPU Performance Comparison

GigaFLOPS

Page 7: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

Windows 8/RT Device Capabilities• Windows 8 & RT devices scale in

performance from phone-equivalent all the way to high-end multi-GPU gaming desktop• But most devices are mobile or have mobile GPUs

• Touch is a first-class citizen• Minimum device resolution is 1024x768• Windows RT has a minimum DirectX

feature level of 9_1• May not have 4k texture support• May not have simultaneous render targets

Page 8: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

Get familiar with the platform• Unique features & behaviors of

Windows 8/RT and Unity for WSA• Application design• Hardware: touch, battery, x86, ARM, x64• Always on approach for devices

• Changes to the runtime APIs for Windows Store Apps and WP8

• Many new Windows devices have a trackpad and touchscreen that can be used simultaneously

• Understand performance hotspots and optimization techniques – both hardware and software

Page 9: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

Unity for WSA and WP8• Unity’s Windows Store runtime is built on .NET

• Unity generates a tweakable Visual Studio project• C# debugging in Visual Studio• Simplifies native code plugin integration• Your ported code pretty much ‘just works’ on Windows

Phone 8• WSA can only consume WinRT Components (no

unmanaged DLLS)• Boo, JavaScript not fully implemented• GameObject.SendMessage lacks type conversion• Network classes not supported (WWW works)• Cloth not supported

Page 10: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

Unity for WSA and WP8• Interop in Unity for Windows Store Apps is

expensive• Minimize the Unity APIs you call each

frame, including Component referencespublic class example : MonoBehaviour { private Transform myTransform;

void Awake() { myTransform = transform; } void Update() { myTransform.Translate(0, 0, 5); }}

public class example : MonoBehaviour {

void Update() {

transform.Translate(0, 0, 5);

}

}

Page 11: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

Disallowed Windows APIs• HashTable - use a Dictionary

• Better performance for value types• Not necessarily thread-safe• Type-constrained

• ArrayList - Use a Dictionary or a List<T>• Possibly a small loss of performance

• System.Xml.XmlDocument - don’t use XML• But if you have to… use System.Xml.Linq• Better is to use JSON or YAML

• System.Threading.Thread• Use ThreadPools - system.threading.threadpool

• And a few thousand Win32 functions• http://msdn.microsoft.com/en-us/library/windows/apps/hh464945.

aspx• SuspendThread, GetThreadContext, SetUnhandledExceptionFilter,

Winsock2, CreateThread, HeapCreate, Sleep, etc.

Page 12: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

Plugins in Windows Store AppsWindows Store Apps can only consume WinRT Components• Unmanaged legacy native code DLLs aren’t

allowed• http

://msdn.microsoft.com/en-us/library/windows/apps/hh441569.aspx

The Unity Editor is still based on Mono• Make sure your WinRT Component can also be

built as a legacy native code DLL (Windows Store functionality can be stubbed out)

Page 13: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

Optimizing performance• Instantiating and Destroying

GameObjects is expensive• Reuse when possible!

• Don’t Use• Desktop shaders• Terrains• Realtime shadows• Dense particles

• Use structs instead of classes • Classes are stored on the heap, structs on

the stack.• We have more on this in docs…

Page 14: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

Demo time!

Small overview of Unity tools

Page 15: Unity  при побудові  3D  ігор для  Windows 8  та  Windows  Phone

Test against the zooRun the WACK oftenParticipate in the beta!In order to ship to Windows 8 ecosystem well…