Deep dive: Tips & tricks for porting games from other platforms to Windows 8 Randy Spong Field Engineer Unity Technologies.

Slides:



Advertisements
Similar presentations
Introduction to Direct3D 10 Course Porting Game Engines to Direct3D 10: Crysis / CryEngine2 Carsten Wenzel.
Advertisements

MVisio: a multi-device 2D/3D graphic engine for PDAs, PCs and CAVEs Achille Peternier, Ph. D. Student VRLab, EPFL, Switzerland 3D Mental Vision.
Amanda Silver Director of Program Management Visual Studio Tools for Client Applications Cross-Platform Development using Visual Studio.
Migrating Win32 Applications to WPF. PowerBuilder Migration of Existing Applications Migration:  The architecture of WPF is significantly different 
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
1 Component Description Alice 3d Graphics Software Human Computer Interaction Institute Carnegie Mellon University Prepared by: Randy Pausch,
Introducing the UWP.
Unity 3D game IDE 1.  Unity is a multi-platform, integrated IDE for scripting games, and working with 3D virtual worlds  Including:  Game engine ▪
AGD: 5. Game Arch.1 Objective o to discuss some of the main game architecture elements, rendering, and the game loop Animation and Games Development.
Tammy Manganello, SVP - Games for Windows.
Design Synopsys System Verilog API Donations to Accellera João Geada.
There has never been a better time to build a game that targets PC, tablets, phone and Xbox!
Microsoft Evangelist Presentation September 13, 2012.
Software Development. Chapter 2 – Programming on Windows 8.
Week 1 Game Design & Development for Mobile Devices.
High Performance in Broad Reach Games Chas. Boyd
DEVSENSE s.r.o.. Visual Studio Industry Partner DEVSENSE s.r.o. NEXT STEPS Contact us at: In 2009, DEVSENSE was founded by four software.
Antigone Engine Kevin Kassing – Period
David, on using MonoDevelop David, on getting to edit and debug in Visual Studio.
Introduction to Silverlight. Slide 2 What is Silverlight? It’s part of a Microsoft Web platform called Rich Internet Applications (RIA) There is a service.
Angelo Chan Kamran Bilgrami. Agenda ● WinJS - What and Why ● Modern Apps ● WinRT Architecture ● Demos o Controls o Data Bindings o Program LifeCycle Management.
Integrate your game with Windows platform Vladimir Kolesnikov Technical Evangelist
DEBUGGING CHAPTER Topics  Getting Started with Debugging  Types of Bugs –Compile-Time Bugs –Bugs Attaching Scripts –Runtime Errors  Stepping.
Developing Cross-Platform Applications with Visual Studio 2015
The West Wind Web Connection 5.0 Web Control Framework The West Wind Web Connection 5.0 Web Control Framework An overview of the new Web Control Framework.
EEC-693/793 Applied Computer Vision with Depth Cameras Lecture 13 Wenbing Zhao
11 A First Game Program Session Session Overview  Begin the creation of an arcade game  Learn software design techniques that apply to any form.
4/23/2017 4:23 AM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
SE 320 – Introduction to Game Development Lecture 8: Animations, GUIs, Debugging and IDEs Lecturer: Gazihan Alankuş Please look at the last two slides.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
Web Games Programming An Introduction to Unity 3D.
Active Server Pages (ASP), also known as Classic ASP or ASP Classic, was Microsoft's first server-side script engine for dynamically generated web pages.
WPH310. Free Phone! Windows Phone 7 as a Game Platform Free Tools to Build Great Games The Game Loop Input on Windows Phone 7 Building a Game with Your.
“The perfect project plan is possible if one first documents a list of all the unknowns.” Bill Langley.
GAM666 – Introduction To Game Programming ● DirectX is implemented as a collection of COM objects ● To use a DirectX program, the user must have the correct.
PRIOR TO WEB SERVICES THE OTHER TECHNOLOGIES ARE:.
Computer Graphics 3 Lecture 6: Other Hardware-Based Extensions Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
Maths & Technologies for Games Graphics Optimisation - Batching CO3303 Week 5.
Tips & Tricks: Writing Performant Managed Code Rico Mariani FUNL04 Performance Architect Microsoft Corporation.
DEV394 Windows Forms Performance Tips And Tricks Mike Henderlight Development Manager.NET Client Team Microsoft Corporation
02 | Things to consider when porting Michael “Mickey” MacDonald | Indie game developer Bryan Griffiths | Software Engineer/Game Developer.
Antigone Engine. Introduction Antigone = “Counter Generation” Library of functions for simplifying 3D application development Written in C for speed (compatible.
DEV414 Black-belt ASP.NET Tips And Tricks For Your ASP.NET Applications Rob Howard Program Manager Web Platform and Tools Team.
UFCFSU-30-13D Technologies for the Web An Introduction to Unity 3D.
GPU Computing for GIS James Mower Department of Geography and Planning University at Albany.
Eric Strittmatter COSC 480 – Spring 2012 Previewing.
Unity при побудові 3D ігор для Windows 8 та Windows Phone Олег Прiдюк Технічний євангеліст, Unity Technologies.
Computer Graphics Imaging Lecture 13 and 14 UV Mapping.
The types of computers and their functionalities.
The Windows 10 App platform: an introduction to the UWP Andy Wigley b:
0 Developing for Windows 10 Tony Champion Champion DS.
Porting your Unity Game to the Windows Store Jump Start
EEC-693/793 Applied Computer Vision with Depth Cameras
Introducing the Windows Mobile development
The Universal Windows Platform
Antigone Engine.
Tooling Breakout Session
EEC-693/793 Applied Computer Vision with Depth Cameras
Migrating 8.1 Apps to Windows 10
Build /24/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Introduction to Silverlight
EEC-693/793 Applied Computer Vision with Depth Cameras
Who Am I? appMobi's lead HTML5 game developer / evangelist
Optimizations Module #4 of 6.
Office 365 Development.
EEC-693/793 Applied Computer Vision with Depth Cameras
Device Access Tomas Lukša.
Combining XAML and DirectX
Mark Quirk Head of Technology Developer & Platform Group
Presentation transcript:

Deep dive: Tips & tricks for porting games from other platforms to Windows 8 Randy Spong Field Engineer Unity Technologies

The Goal Understand the work needed to bring your existing Unity project over to Microsoft’s Windows Store for Windows 8 and Windows RT devices

The Goal Understand the work needed to bring your existing Unity project over to Microsoft’s Windows Store for Windows 8 and Windows RT devices Knowing the unique features & behaviors of Windows 8/RT and Unity for Windows Store Apps, you’ll be better prepared to estimate the amount of work required to port your project

The Goal Understand the work needed to bring your existing Unity project over to Microsoft’s Windows Store for Windows 8 and Windows RT devices Knowing the unique features & behaviors of Windows 8/RT and Unity for Windows Store Apps, you’ll be better prepared to estimate the amount of work required to port your project Your knowledge of the changes to the runtime APIs for Windows Store Apps will make your porting work go more quickly

The Goal Understand the work needed to bring your existing Unity project over to Microsoft’s Windows Store for Windows 8 and Windows RT devices Knowing the unique features & behaviors of Windows 8/RT and Unity for Windows Store Apps, you’ll be better prepared to estimate the amount of work required to port your project Your knowledge of the changes to the runtime APIs for Windows Store Apps will make your porting work go more quickly Your understanding of performance hotspots and optimization techniques will help you extract maximum performance from Windows 8 and Windows RT devices

The Goal Understand the work needed to bring your existing Unity project over to Microsoft’s Windows Store for Windows 8 and Windows RT devices Knowing the unique features & behaviors of Windows 8/RT and Unity for Windows Store Apps, you’ll be better prepared to estimate the amount of work required to port your project Your knowledge of the changes to the runtime APIs for Windows Store Apps will make your porting work go more quickly Your understanding of performance hotspots and optimization techniques will help you extract maximum performance from Windows 8 and Windows RT devices

Agenda Overview of Windows 8 and Windows RT Overview of Unity’s Windows Store add-on Porting Existing Code Optimizing Performance Best Practices for porting your Unity project

Windows 8 and Windows RT

Hardware Landscape (Slide provided courtesy of Microsoft, 2012)

New Category of Windows PCs New design point  Always on, always connected  System on a chip  Battery is primary power source  Focus on low power Both x86/x64 and ARM-based systems Covers a range of form factors (Slide provided courtesy of Microsoft, 2012)

Range of Performance

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 Touch is a first-class citizen Minimum device resolution is 1366x768 Windows RT has a minimum DirectX feature level of 9_1  May not have 4k texture support  May not have simultaneous render targets

Unity for Windows Store

Differences Unity’s Windows Store runtime is built on.NET Unity apps for Windows Store can only consume WinRT Components (no unmanaged DLLS) Many new Windows devices have a trackpad and touchscreen that can be used simultaneously

Other Things to Watch Out For No 64-bit Windows Store Apps just yet Boo, JavaScript not fully implemented Network classes not supported (WWW is fully implemented, though) Cloth not supported Microphone not implemented

Other Things to Watch Out For, Continued Animation of script variables is not allowed AnimationEvent callback functions with arguments (Supported: a function with no arguments or with AnimationEvent argument) GameObject.SendMessage - The function argument types the message receiver must exactly match the message (we don’t have type conversion) No fog for devices with DX feature level less than 9.3  Example workaround at

Things to Get Excited About  C# debugging in Visual Studio  Building the Unity project generates a tweakable Visual Studio project  Simplifies native code plugin integration  Your ported code pretty much ‘just works’ on Windows Phone 8

Porting Existing Code

Overview Disallowed Windows APIs Sharing plugin code between the Editor and your Windows Store App

Disallowed Windows APIs HashTable ArrayList System.Xml.XmlDocument System.Threading.Thread And a few thousand Win32 functions

Disallowed Windows APIs HashTable Use a Dictionary  Better performance for value types  Not necessarily thread-safe  Type-constrained

Disallowed Windows APIs ArrayList Use a Dictionary or a List  Possibly a small loss of performance

Disallowed Windows APIs System.Xml.XmlDocument Don’t use XML  But if you have to… use System.Xml.Linq  Better is to use JSON or YAML

Disallowed Windows APIs System.Threading.Thread Use ThreadPools

Disallowed Windows APIs Win32 APIs Winsock2, CreateThread, HeapCreate, Sleep, etc. (SuspendThread, GetThreadContext, SetUnhandledExceptionFilter are the ones that really threw us for a loop) Find Windows 8/RT -compatible alternatives at us/library/windows/apps/hh aspx us/library/windows/apps/hh aspx

Plugins in Windows Store Apps Windows Store Apps can only consume WinRT Components Unmanaged legacy native code DLLs aren’t allowed Check out the details at 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)

Optimizing Performance

Component Caching Interop in Unity for Windows Store Apps is expensive Minimize the Unity APIs you call each frame, including Component references

Component Caching Bad public class example : MonoBehaviour { void Update() { transform.Translate(0, 0, 5); }

Component Caching Good public class example : MonoBehaviour { private Transform myTransform;MonoBehaviourTransform void Awake() { myTransform = transform; } void Update() { myTransform.Translate(0, 0, 5); } }

Component Caching Terrible public class example : MonoBehaviour { void Update() { for (int i = 0; i < 1000; ++i) { transform.Translate(0, 0, transform.position.z f); }

GameObject Pooling Instantiating and Destroying GameObjects is expensive Reuse when possible!

GameObject Pooling Instantiating and Destroying GameObjects is expensive Reuse when possible! Instead of Destroying: gameObject.SetActive(false); MyPoolManager.AddToFreePool(gameObject); Instead of Instantiating: GameObject gameObject = MyPoolManager.GetFreeObject(); SetupObjectDefaults(gameObject); gameObject.SetActive(true);

Draw Calls - Dynamic Batching Works automatically Maximum of 900 vertex attributes per mesh Differently scaled objects won’t batch together Dynamic Batching incurs some CPU overhead at runtime

Draw Calls - Static Batching Supports arbitrarily complex geometry Can significantly reduce CPU usage at runtime for setting up draw calls Objects cannot move, rotate, or scale Objects must be marked as static in Unity Uses lots of device memory

Draw Calls - Texture Atlasing Batching only works when objects share materials Combine object textures into a Texture Atlas

Draw Calls - Texture Atlasing

Unity Features on Windows RT Don’t Use Desktop shaders Terrains Realtime shadows Dense particles Non-tessellated sprites

Sprite Meshes (Images provided courtesy of Bento Studio [Uni2D], 2013)

Use Our Documentation

The Unity documentation is full of concise and useful optimization advice Practical Guide to Optimization for Mobiles Optimizing Graphics Performance Mobile Developer ChecklistMobile Developer Checklist – OptimizationsOptimizations

Best Practices

Animated Loading Screen Camouflages your loading times Gives the user a sense of progress

Target Device Testing Regularly use different devices for development testing  Including the crappy ones

Stay Compliant Run the WACK tool regularly  Aim for daily runs when you’re refactoring for Windows 8 support or laying down new.NET code

Recap

Recap - Windows 8 and Windows RT Windows 8 and RT are mobile operating systems Touch is a first-class citizen Broad range of form factors Broad range of performance capabilities

Recap – Unity for Windows Store Need to handle both trackpad and mouse input in the same app Native code plugins have to be rewritten as WinRT Components The Editor can’t consume WinRT Components (need to use a version of the com

Recap – Porting Existing Code Convert usage of HashTable and ArrayList to Dictionary Rewrite native code plugins as WinRT Components  Keep a native code version (which stubs Windows Store functionality) for using in the Editor’s Play Mode

Recap – Optimizing Performance Cache Component references Pool GameObjects Batch draw calls Use texture atlases to increase batch sizes Avoid expensive “do it all” features like terrain Use Unity’s extensive optimization resources   

Recap – Best Practices Test on low-end devices more than high-end devices Run the WACK toolkit regularly  Finds coding errors and use of disallowed APIs  Informs you about potential certification failures

Resources for Windows 8 & RT Disallowed.NET APIs Allowed win32 APIs Replacing disallowed win32 APIs Windows 8 & RT Hardware Compatibility FAQ

Resources for Unity Windows 8 and Windows RT Open Beta Sign-Up Windows 8/RT Help In the Editor: “Help -> Unity Manual (Metro)” Mobile Optimization Tips Optimizing Graphics Performance Practical Guide to Optimization for Mobiles