david, on using monodevelop david, on getting to edit and debug in visual studio
TRANSCRIPT
Tales from the trenches:Developing “The Harvest” and “Gunpowder” with UnityEthan Abeles – Senior Producer, Microsoft StudiosRichard Sun – Co-Founder and Lead Programmer, Rogue Rocket Games3-044
IntroductionsWhy make games for Windows 8?Demo: See what we’ve done!Why Unity?How Unity?Tips and tricksThinking about the future
Agenda
Part of the Connected Experience Team, focused on bringing cool, new content to Microsoft’s latest platforms
Working to build out the content on the platform and push the platform to be the best it can be for gaming partners
Wanted to move to where games are evolving more quickly
Needed a quick and cheap way to produce prototypes and demos
Looking to work with developers comfortable in the mobile space
Released 2 Unity for Windows 8 games
“I’m not only a producer, I’m also a client!”
Ethan Abeles – Senior Producer
Richard Sun – Co-Founder, Rogue Rocket Games
11-year game-development veteran
• Planet Moon Studios – Lead programmer
• LucasArts Entertainment – Programmer
Shipped many titles on many platforms, both big and small
Developed games in teams of various sizes and product scopes
Specializes in rapid prototyping and development
Great hair
Released 2 Unity for Windows 8 games
And in this corner, representing the fantastically creative, super agile, indie game studio…
We are real-world clients and users of Unity. We cut our teeth during the Alpha days of the Windows 8 branch and we’ve come to here to tell you tales, tips, and tricks from the frontlines.
New Store = less competitionDeveloper-friendly environmentUser base growing every dayUsers hungry for contentIndustry leading revenue splits!
Why make games for Windows 8?
But there are a few hurdles…
New Store = initially small user baseWindows Store discovery and layout
Thankfully, as you’ve seen this week, Microsoft is working hard to fix those issues and make the platform a great place to sell games.
All of the great Unity tools you’re used to are ready to go out of the box
Unity’s multiplatform approach is great for modern game development and release
Quickly port existing projects to Windows 8
Why build with Unity?
Windows 8 and Unity
Unity provides a Visual Studio 2012 Project
• Similar to how Unity handles iOS projects/xCode
• This is actually awesome and we’ll talk about it shortly
Unity runs on the .NET Framework – Not Mono
• We’ll talk about what that means in just a bit.
Unity games for the Windows Store can consume only Windows Runtime Components (no unmanaged DLLs)
• This can come into play when you try to use Unity plug-ins
Unity on Windows 8 is a bit different.
Okay, so how does Unity for Windows 8 work?
Those caveats aside, it’s still the same awesome Unity being used to make new and innovative Windows 8 games.
Gunpowder – Windows 8
And we aren’t the only ones using Unity. As of mid-May there are a bunch of awesome games in the Windows Store
>30 Games
So what should I know about my workflow?
Use the Unity editor as you always do
Have Unity generate a Windows 8 Visual Studio project
Extend your application to take advantage of the fun Windows 8 features you’re hearing about in the other //BUILD talks
Debug directly from within Visual Studio or build an app package for sideload testing
Unity workflow on Windows 8 should be familiar for anyone who has built iOS applications using Unity
Yes we did!
• The Windows and Visual Studio teams created and massively improved the tools developers have for authoring, debugging, and previewing DirectX code. This makes everyone happy!
Wait, did you say I get to use Visual Studio?
David, on using MonoDevelop
David, on getting to edit and debug in
Visual Studio
Make loading times interesting
Script builds with MSBUILD
Windows 8 delegates
Component caching
Object pooling
Avoid CPU-intensive components
Tips for porting
Tips and tricks for making your life easy!
Players don’t like looking at static screens
Two ways to do this: • XAML – Use <Storyboard> and Animations
• WMV – Use <MediaElement> with a WMV file
Both options make use of a XAML page built in Visual Studio
Use Unity to call out to your XAML class to show/hide/collapse these XAML views
Use a XAML layer to do cool things during loading time
Tip #1 – Making loading times interesting
Visual Studio won’t “queue” up multiple configurations when building app packages
PowerShell is your friend
MSBUILD: Awesome, complicated, and slightly under-documented
Build from the command line with following code
If you’re working with a publisher or partner, script your build process to save clicks/time!
Tip #2 – Script builds with MSBUILD
Scripts for building app packages
start msbuild /p:Configuration=Release /p:Platform="ARM"
choice /t 5 /c yn /d y
start msbuild /p:Configuration=Release /p:Platform="x86"
You’ll want to have Unity talk to the OS to do this, so you’ll do two things:• Define the delegates in Unity • Implement them on the Windows 8 C#
side
You can now use plug-ins but that wasn’t ready for us so we used delegate registration
Tip #3 – Talking between Unity and the Windows Runtime
Tip #3 – Talking between Unity and the Windows RuntimeUnity3D side C#public delegate void Win8ShowPopupFunc(string title, string desc, System.Action onDismiss);
public delegate void Win8ShowYesNoPopupFunc(string title, string desc, System.Action onDismiss);
public static Win8ShowPopupFunc _ShowPopup = null;
public static Win8ShowYesNoPopupFunc _ShowPopup = null;
Windows 8 side C#RRGMetroBridge._ShowPopup = ShowGenericPopup;
RRGMetroBridge._ShowYesNoPopup = ShowYesNoPopup;
~95% of Unity’s engine code is in C++ but we, as users, interface with the engine in C#
Interop between managed and native code is expensive, so…
Code wisely and minimize the Unity APIs you call each frame, including component references
Use component caching to minimize interop overhead
Tip #4 – Component caching
Tip #4 – Component caching
BAD
public class example: MonoBehavior {void Update() {
transform.Translate(0, 0, 5);}
}
Tip #4 – Component Caching
TERRIBLE
public class example: MonoBehavior {void Update(){
for (int i = 0; I < 1000; ++i) {myTransform.Translate(0, 0, transform.position.z
+ 0.005f);}
}}
Tip #4 – Component Caching
GOOD
public class example: MonoBehavior (Transform transform) {private Transform myTransform;
void Awake(){myTransform = transform;
}void Update(){
myTransform.Translate(0, 0, 5);}
}
Rather than creating and destroying objects at will, create a basic pooling system that:• Keeps track of free/inactive objects• Has methods for reusing/resetting objects quickly
For extra brownie points, implement a more granular pooling system that pools objects of the same or similar type, so reconfiguration/reuse cost is minimized
Instantiating and destroying GameObject objects is expensive
Tip #5 – GameObject pooling
Tip #5 – GameObject pooling
Instead of destroying GameObjects:gameObject.SetActive(false);MyPoolManager.AddToFreePool(gameObject);
Instead of instantiating:GameObject = MyPoolManager.GetFreeObject();SetupObjectDefaults(gameObject);gameObject.SetActive(true);
Use with caution:• Intense desktop shaders• Unity terrains• Real-time shadows• Dense particles• Non-tessellated sprites*This list might change as hardware evolves
Remember that Windows 8 is supported by a huge range of hardware, both super fast and low power consumption
Tip #6 – Budget CPU-intensive components
Think about mouse + touch• Input.Touch vs. Input.Mouse• Input.simulateMouseWithTouches
Native code plug-ins will need to use Windows Runtime APIs• Convert HashTable and ArrayList to Dictionary• Keep native-code version of API (which stubs
Windows Store functionality) for use in the Editor’s Play Mode• Check the API lists located on the resource slide• How can you tell if a plug-in uses an unapproved API?
Use the Windows App Certification Kit
If you’re bringing a released app to Windows 8…
Tip #7 – Notes for porting
Windows App Certification Kit• Gives you a quick Windows Store compliance test
CurrentApp vs. CurrentAppSimulator• The real licensing API vs. the testable license API• Make sure you #IFDEF all calls
SoC processing power considerations• Load times, Fullscreen FX, too many draw calls, complex
shaders
We can show you scars!
What other knowledge can you share?
If you want to submit a game to the Windows Store, you must provide metadata that defines the ratings for your game as part of the game package.• Some territories require ratings for
games• Some territories use self-ratings
systems
These files allow parents to use the Family Safety features of Windows. Happy parents mean happy consumers!
Ratings + GDF files
What other knowledge can you share?
Make use of Live Tiles to drive retention and increase conversions• Sales / Limited-time discounts• F2P discounts• Limited-time in-game events• Multiplayer invites• Multiplayer turn notifications• Other calls to action
Live tiles are awesome, unique and powerful
What other knowledge can you share?
Windows 8.1 – Making the marketplace even better
New hardware – Greater performance from new hardware
Unity optimizations – Continued work on optimizing Unity for Windows 8 shows great promise
Things are going to get even better?
Thinking about the future – Up, Up and Away!
Resources – Unity documentation
Mobile Optimization Tipshttp://docs.unity3d.com/Documentation/Manual/MobileOptimisation.html
Optimizing Graphics Performancehttp://docs.unity3d.com/Documentation/Manual/OptimizingGraphicsPerformance.html
Practical Guide to Optimization for Mobileshttp://docs.unity3d.com/Documentation/Manual/iphone-PracticalGuide.html
Resources – Windows 8 & Windows RuntimeDisallowed .NET APIshttp://msdn.microsoft.com/en-us/library/windows/apps/xaml/br230302.aspx
Allowed win32 APIshttp://msdn.microsoft.com/en-us/library/windows/apps/br205757.aspx
Replacing disallowed win32 APIshttp://msdn.microsoft.com/en-us/library/windows/apps/hh464945.aspx
Windows 8 & Windows RT hardware compatibility FAQhttp://www.microsoft.com/en-us/windows/compatibility/win8/compatcenter/faq
Resources – Other videos/presentationsChannel 9 – Windows 8 / Windows Phone and Unity presentationshttp://channel9.msdn.com/Events/Windows-Camp/Building-Windows-Games-with-Unity
Covers what we’ve covered in a lot more detail!
Featuring :Platform introductionEnd-to-end develop, debug, and deployTips & tricksWindows 8 platform usage… And an awesome talk by our very own Richard Sun!
© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.