how to be a nintendo switch developer using unityuniteseoul.com/2019/pdf/d1t3s3.pdf · -unity for...

77

Upload: others

Post on 12-Feb-2020

38 views

Category:

Documents


0 download

TRANSCRIPT

How to be a Nintendo Switch Developer using Unity

Nintendo Switch

Nintendo Switch

Nintendo Switch Sales

- Hardware: 34.74 million units- Software: 187.52 million units

(From a Nintendo IR Information, As of March 31, 2019)

Nintendo Switch Sales did well in 2018

“Strong holiday season pushes Nintendo Switch to record-breaking sales for 2018”

- DIGITAL TRENDS

“The Nintendo Switch Smashed The PS4 And Xbox One To Pieces In 2018”

- Forbes

“But, isn’t everyone just playing first party Nintendo games?”

Not at all!

“One of the best aspects of the Nintendo Switch is its ever-growing library of indie games from smaller-scale or independent publishers”

- Business Insider

“Tangledeep Dev reveals launch week sales on Switch surpassed six months of Steam early access sales”

- Automaton

There are already loads of Made with Unity titles on sale!

1,500 titles have been made with Unity across the Nintendo 3DS, Wii U, and Switch

“We are currently working towards reaching 1,500 software titles developed for Nintendo platforms using Unity”

- Tatsumi KimishimaRepresentative Director and President of Nintendo

at the 78th Annual General Meeting of Shareholders

Unity has supported the Nintendo Switch since it launched

- Prior to the Nintendo Switch, Unity also supported the Wii U and New Nintendo 3DS

- The Nintendo Switch launched with 15 titles

- Among them, 5 were Made with Unity- I Am Setsuna (Square Enix)- Super Bomberman R (Konami Digital Entertainment)- Snipperclips: Cut It Out, Together! (Nintendo)- Soldam: Bloom Declaration (City Connection)- VOEZ (Flyhigh Works)

What kind of hardware does the Nintendo Switch have?

- Unfortunately, Nintendo Switch information is covered by an NDA, so I can’t discuss the details here

- What I can tell you is that it comes with special Joy-Cons that can be shared between players, and it can connect to a dock to play on a display or be used alone as a handheld. In other words, things you probably already know.

How do you develop titles for the Nintendo Switch?

- You must sign an NDA with Nintendo

- You can apply to be a Certified Developer online

- Nintendo Developer Portal (NDP): https://developer.nintendo.com/

How do you develop titles for the Nintendo Switch?

How do you develop titles for the Nintendo Switch?

How do you develop titles for the Nintendo Switch?

- You must sign an NDA with Nintendo

- You can apply to be a Certified Developer online

- Nintendo Developer Portal (NDP): https://developer.nintendo.com/

- An additional application is required to develop for the Nintendo Switch

- Please contact Nintendo ([email protected]) after completing registration at the NDP

Nintendo Developer Portal

- You can get a development kit through the NDP

- All authorized developers can use the Unity for Nintendo Switch extension

- Developers can also access the Unity for Nintendo Switch forum (Japanese and English)

Unity for Nintendo Switch

Unity for Nintendo Switch

- Unity’s Nintendo Switch extension can be used by any certified developer for free

- Developers can also use the Unity Pro license for Nintendo Switch development

- Nintendo Switch title development- Nintendo Switch prototyping- Nintendo Switch titles as external tools

- Ex: level editor, asset converter

Which version of Unity can be used?- Support at launch (2017) started with Unity 5.5

- Currently the latest version (2019.2) is also supported - 2017 LTS- 2018 LTS- 2019.x

- Certain versions of Unity were built with a particular version of the SDK, so it’s important to pair the appropriate versions together

- LTS versions will support SDK upgrades during their support periods

Unity Support Cycle

Which version of Unity should I use?- If you’re porting a game, compare your update timeframe to

Unity’s support timeframe. If there’s no problem, use an older version.

- Keep in mind that 2017 LTS support ends in March 2020

Which version of Unity should I use?- For a new project, use the latest version of Unity if you want

access to the latest features

- If not, it’s probably best to use the version that will switch to LTS at or right after the timeframe for uploading your master

- It’s possible that bug fixes won’t be applied to previous (LTS) versions

- It may not be possible to apply fixes if the major versions are different

- Also, the newest version gets bug fixes the fastest

Which version of Unity should I use?- Ex 1: Submit master in December 2019: use 2018 LTS- Ex 2: Submit master in June 2020: use 2018 LTS- Ex 3: Submit master in December 2020: use 2019.x

What else do I need to develop titles for the Nintendo Switch?

- Sign a developer contract with Nintendo ✓

- Get Unity for Nintendo Switch from NDP ✓

- Get dev kit through NDP ✓

- ?

What’s the next step?

Change platforms

Change platforms

- Re-convert assets (automatic)- Rebuild asset bundles- Change native plugins platforms- Change platform dependent code

Change platform dependent code

- Platform directive: #if UNITY_SWITCH- There are several features that can’t be used with Unity for

Nintendo Switch - Unity Ads, Unity Analytics services- Asset bundle cache- Playerprefs(PlayerPrefs.Save wouldn’t work)

That’s it!

- Now the project runs on Nintendo Switch. It should... mostly...- There aren’t many other necessary changes- If it won’t run due to insufficient memory

- Make all the textures smaller- Go to [Project Settings > Quality > Texture Quality] to lower all

loaded texture resolution equally- Don’t forget to revert this later

- Remember, JSON data and text data can momentarily use a lot of memory

If you just want it to run on the dev kit, it should only take 1 or 2 weeks

Run ≠ Playable

- This is where a hard task begins!- Performance optimization

- The framerate isn’t good enough- Memory runs out mid-play, game crashes...

Performance optimization

- The Profiler- Unity Profiler

- CPU- GPU (Rendering)- Memory

- The Profiler included with the SDK- CPU profiler that shows load per function- GPU profiler that shows load per draw call

Performance Optimization

- When GPU load is high- Adjust the render buffer’s resolution level- Use mesh reduction- There aren’t really any methods for improvement that are unique to

the Nintendo Switch - Be aware that the screen resolution will change in docked vs.

undocked mode

Performance Optimization

- When CPU load is high- There aren’t many simple solutions… - Distribute CPU usage across multiple frames- Process using background threads- There aren’t really any methods for improvement that are unique to

the Nintendo Switch

Session talks at Unite

Bringing supernatural thriller, "Oxenfree" to Nintendo Switch - Unite LA

https://www.youtube.com/watch?v=ngpmR0Bxi08

Unite Berlin 2018 - Old Man's Journey: Bringing a Pointer-Based Game to Nintendo Switch

https://www.youtube.com/watch?v=0mhdZnwEpwY

Unite Europe 2017 - How we got GoNNER on Nintendo’s latest console

https://www.youtube.com/watch?v=PSejEB6x4EQ

Blog post

Cuphead developer’s tips to optimize for Nintendo Switchhttps://blogs.unity3d.com/2019/04/18/cuphead-developers-tips-t

o-optimize-for-nintendo-switch/

What else do I need to develop titles for the Nintendo Switch?

- Sign a developer contract with Nintendo ✓

- Get Unity for Nintendo Switch from NDP ✓

- Get dev kit through NDP ✓

- Change platforms ✓

- Performance optimization ✓

At this point, there’s nothing new, just the regular porting process

Nintendo Switch-specific Support

Nintendo Switch Characteristics

Nintendo Switch Characteristics

Things you will (probably) need to support for Nintendo Switch

- Dock/Undock support- Joy-Con support- Multiplay support- Guideline support

Dock/Undock Support

Dock/Undock Support

- The Switch display’s resolution is 1280x720, but when docked it usually outputs 1920x1080 to the connected display

- Also, when in handheld mode the device runs on its internal battery, so it’s important to consider things like adjusting process loads in order to keep battery consumption down

- Ex: lower resolution, change post effects, etc.

Dock/Undock Support

- When the device is in handheld mode, the touch screen can be used

- Docking/Undocking the device triggers a script event, and this can be used as a trigger for various process settings

Joy-Con Support

Joy-Con Support

- The Joy-Con has several different grip styles- Attached to the Switch’s main body- Inserted into the Joy-Con Grip- Held separately in each hand

- Used individually by multiple players

- Controller assignments and grip styles can be changed by the user from the system menu

Joy-Con Support

- Multiplayer mode changes the analog stick and button orientations

- The button mapping will need to change depending on the Joy-Con’s orientation (Vertical, Horizontal)

- When vertical, the A button is on the right, but when horizontal it’s on the bottom

Joy-Con Support

- Unity for Nintendo Switch doesn’t have full InputManager support

- There are no detection problems when the Joy-Cons are attached to the main device in handheld mode or inserted in the Joy-Con Grip in full key mode

- With the new “Input System” available from 2019.1, all modes and orientations will be supported.

- If you use a version older than 2019.1, you may have to get the controller values from the SDK API

- Nintendo provides a native plugin for calling the API

Multiplay Support

Multiplay Support

- Every console has platform specific online services for things like

- Online matching- Online accounts- Nintendo Switch uses Nintendo Switch Online

Multiplay Support

- Can Unity use these features?- Unfortunately Unity cannot directly call them

- .NET System.Net.Sockets can be used

- However, Nintendo does provide a native plugin to allow Unity to call things like the Nintendo SDK’s online matching API via script.

- It can be found in the NDP, just like Unity for Nintendo Switch

- The actual matching process, etc. will have to be implemented via the native plugin.

Guideline Support

What are Guidelines?

- There are several things that must be done and several things that are not allowed in order for an application to release on the Nintendo Switch

- We won’t get into those specifics here

Guideline Support

- Most of the guidelines will have to be handled by each application independently

- This may affect how asset data is handled, so it’s important to find out early

Making Patch Data Smaller

Making Patch Data Smaller

- Patches are made by detecting differences in file data

Patch dataUpdated data

block

Data Data

Updated data block

Issues with creating patch data in Unity

- However, sometimes the differences aren’t detected properly and the entire file gets marked as an update target due to issues with loss of consistency and position alignment in Unity data

Data Data

Updated data block

Patch data

Data

Updated data block

Issues with creating patch data in Unity

- To avoid this, it’s important to remember that “patches target files”

- This means it’s important to partition asset data at the file level

- “But my game doesn’t have any updates scheduled, so it’s fine”- It’s still a better idea to use asset bundles and separate data properly to avoid

the risk.

Asset Data Structure in Unity

- If model data will be included in a scene, for example, there are several ways for Unity to handle that data

- Place directly in the scene hierarchy - Load from an asset bundle- Load from Resources

- The data will be saved as scene data

- It will be serialized as a single file in each scene

- It may also be saved as shared data

- In that case it will be saved as a single shared data file

Place directly in the scene hierarchy

Load from Resources

- All files in the Resources folder will be saved as a single file

Load from Resources

- Resources is Unity’s old data retrieval method and the structure itself has several issues. It’s no longer recommended not just for the Nintendo Switch, but for other platforms as well

- 2.1. Best Practices for the Resources SystemDon't use it.

https://unity3d.com/learn/tutorials/topics/best-practices/resources-folder?playlist=30089

Load from Resources

Load from asset bundles

- This method IS recommended!

- “So that means it’s OK to put the whole scene (.unity) into an asset bundle?”

- No, because then the whole thing will become a single file 👼

- Moreover, compressing the asset bundle almost guarantees that the whole file will become a patch target

- Create asset bundles with the proper granularity - “proper granularity” depends on the application

How to easily manage Asset Bundles

The new Asset Bundle Management System

- The Addressable Asset System is the new asset management system introduced in 2018.2

The Addressable Asset System

- Is the new Asset management/retrieval system available as of 2018.2 (currently still a preview version)

- Combines the simplicity of Resources and the freedom of Assetbundle

- Not much of a big change internally from Assetbundle

The Addressable Asset System

- However, there are some details and techniques that are important to know

- There are lots of settings, which can be overwhelming at first

- It’s still in development, and will improve over time

- We won’t get into the fine details here, so please see other sessions for more info

- How to use Unity's Addressable Asset system for speed and performance - Unite LA https://www.youtube.com/watch?v=U8-yh5nC1Mg

Management in the Assetbundle era

- The developers were responsible for managing which assets went into which asset bundles

- Asset bundles, including dependent ones, had to be loaded simultaneously

Assetbundle B

Texture

Assetbundle A

Prefab A

Prefab B

Management in the Assetbundle era

- Data updates occurred at the asset bundle level

Assetbundle C

Prefab A

Prefab B

Assetbundle C`

Prefab A

UpdatedPrefab B

Overwrite

Management in the Addressable Assets Era

- This system will manage which asset bundle every asset goes into, and which asset bundles will be placed where

- This is managed through the content catalog

- Necessary assets can be loaded automatically

Content catalog

- Index data of which assets are grouped, in what form, and where, based on Addressable information when building

- The information is updated when assets are added or changed, then built

Assetbundle A

Prefab A

Prefab B

Catalog

Prefab A is

Prefab B is

Content catalog

- Index data of which assets are grouped, in what form, and where, based on Addressable information when building

- The information is updated when assets are added or changed, then built

- This should work if the base asset bundle is configured as a Static Content

Assetbundle A

Prefab A

Prefab B

Catalog

Prefab A is

Prefab B is

Assetbundle B

Updated Prefab B

Only the changes and Catalog need to be sent as a patch

How to make patch data smaller

- Use Assetbundles

- Manage Assetbundles with the Addressable Asset System to make things easier

- However, it’s still a preview version, expected to be completed by the end of 2019

- Also, there are a lot of features which will need to be examined in order to master them

- Consider using the new system for a new project

Takeaways

- Start by registering as a developer with Nintendo. Then you’ll be able to experience the things discussed today in detail

- There are some characteristics unique to the platform, but optimization methods are the same as on other platforms

- There’s no need to do more than what’s necessary for development- However, check performance in detail on the dev kit during the

development process

- Use Asset Bundles- The Addressable system is really helpful for managing asset bundles

Thank you!