tales from the trenches: developing “the harvest” and “gunpowder” with unity

38

Upload: addo

Post on 10-Feb-2016

28 views

Category:

Documents


0 download

DESCRIPTION

Tales from the trenches: Developing “The Harvest” and “Gunpowder” with Unity. Ethan Abeles – Senior Producer, Microsoft Studios Richard Sun – Co-Founder and Lead Programmer, Rogue Rocket Games 3-044. Agenda. Introductions Why make games for Windows 8? - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity
Page 2: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

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

Page 3: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

IntroductionsWhy make games for Windows 8?Demo: See what we’ve done!Why Unity?How Unity?Tips and tricksThinking about the future

Agenda

Page 4: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

Part of the Connected Experience Team, focused on bringing cool, new content to Microsoft’s latest platformsWorking to build out the content on the platform and push the platform to be the best it can be for gaming partnersWanted to move to where games are evolving more quicklyNeeded a quick and cheap way to produce prototypes and demosLooking to work with developers comfortable in the mobile spaceReleased 2 Unity for Windows 8 games

“I’m not only a producer, I’m also a client!”

Ethan Abeles – Senior Producer

Page 5: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

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 smallDeveloped games in teams of various sizes and product scopesSpecializes in rapid prototyping and developmentGreat hairReleased 2 Unity for Windows 8 games

And in this corner, representing the fantastically creative, super agile, indie game studio…

Page 6: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

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.

Page 7: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

New Store = less competitionDeveloper-friendly environmentUser base growing every dayUsers hungry for contentIndustry leading revenue splits!

Why make games for Windows 8?

Page 8: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

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.

Page 9: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

All of the great Unity tools you’re used to are ready to go out of the boxUnity’s multiplatform approach is great for modern game development and releaseQuickly port existing projects to Windows 8

Why build with Unity?

Windows 8 and Unity

Page 10: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with 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?

Page 11: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

Those caveats aside, it’s still the same awesome Unity being used to make new and innovative Windows 8 games.

Page 12: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

Gunpowder – Windows 8

Page 13: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

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

Page 14: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

So what should I know about my workflow?

Use the Unity editor as you always doHave 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 talksDebug 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

Page 15: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with 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

Page 16: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

Make loading times interestingScript builds with MSBUILDWindows 8 delegatesComponent cachingObject poolingAvoid CPU-intensive componentsTips for porting

Tips and tricks for making your life easy!

Page 17: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

Players don’t like looking at static screensTwo 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 StudioUse 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

Page 18: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

Visual Studio won’t “queue” up multiple configurations when building app packagesPowerShell is your friendMSBUILD: Awesome, complicated, and slightly under-documentedBuild 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

Page 19: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

Scripts for building app packagesstart msbuild /p:Configuration=Release /p:Platform="ARM"choice /t 5 /c yn /d ystart msbuild /p:Configuration=Release /p:Platform="x86"

Page 20: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

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

Page 21: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

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;

Page 22: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

~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

Page 23: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

Tip #4 – Component cachingBAD

public class example: MonoBehavior {void Update() {

transform.Translate(0, 0, 5);}

}

Page 24: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

Tip #4 – Component CachingTERRIBLE

public class example: MonoBehavior {void Update(){

for (int i = 0; I < 1000; ++i) {myTransform.Translate(0, 0, transform.position.z

+ 0.005f);}

}}

Page 25: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

Tip #4 – Component CachingGOOD

public class example: MonoBehavior (Transform transform) {private Transform myTransform;

void Awake(){myTransform = transform;

}void Update(){

myTransform.Translate(0, 0, 5);}

}

Page 26: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

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

Page 27: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

Tip #5 – GameObject poolingInstead of destroying GameObjects:gameObject.SetActive(false);MyPoolManager.AddToFreePool(gameObject);

Instead of instantiating:GameObject = MyPoolManager.GetFreeObject();SetupObjectDefaults(gameObject);gameObject.SetActive(true);

Page 28: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

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

Page 29: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

Think about mouse + touch• Input.Touch vs. Input.Mouse• Input.simulateMouseWithTouchesNative 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

Page 30: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

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?

Page 31: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

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?

Page 32: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

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?

Page 33: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

Windows 8.1 – Making the marketplace even betterNew hardware – Greater performance from new hardwareUnity 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!

Page 34: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

Resources – Unity documentationMobile 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

Page 35: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

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

Page 36: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

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!

Page 37: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

© 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.

Page 38: Tales from the  trenches: Developing  “The Harvest” and “Gunpowder” with Unity

© 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.