Skip to content

Publish staged content #852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/basics/scenemanagement/using-networkscenemanager.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ The term "Scene Event" refers to all subsequent scene events that transpire over
The purpose behind the above outline is to demonstrate that a Scene Event can lead to other scene event types being generated and that the entire sequence of events that transpire occur over a longer period of time than if you were loading a scene in a single player game.

:::tip
When you receive the `SceneEventType.LoadEvenetCompleted` or the `SceneEventType.SynchronizeComplete` you know that the server or clients can start invoking netcode specific code (i.e. sending Rpcs, updating `NetworkVariable`s, etc.). Alternately, `NetworkManager.OnClientConnectedCallback` is triggered when a client finishes synchronizing and could be used in a similar fashion. _However, that only works for the initial client synchronization and not for scene loading or unloading events._
When you receive the `SceneEventType.LoadEventCompleted` or the `SceneEventType.SynchronizeComplete` you know that the server or clients can start invoking netcode specific code (i.e. sending Rpcs, updating `NetworkVariable`s, etc.). Alternately, `NetworkManager.OnClientConnectedCallback` is triggered when a client finishes synchronizing and could be used in a similar fashion. _However, that only works for the initial client synchronization and not for scene loading or unloading events._
:::

:::warning
Expand Down
325 changes: 203 additions & 122 deletions docs/learn/bossroom/getting-started-boss-room.md

Large diffs are not rendered by default.

185 changes: 185 additions & 0 deletions docs/learn/bossroom/optimizing-bossroom.md

Large diffs are not rendered by default.

79 changes: 47 additions & 32 deletions docs/tutorials/testing/testing_locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ title: Testing multiplayer games locally
description: Guide covering the available workflows for testing multiplayer games locally.
---
Testing a multiplayer game presents unique challenges:
- You need to run multiple instances of the game in order to test multiplayer scenarios.
- You also need to iterate quickly on custom code and asset changes and validate work in a multiplayer scenario.
- You need to be able to debug work in a multiplayer scenario using editor tools.

* You need to run multiple instances of the game in order to test multiplayer scenarios.
* You also need to iterate quickly on custom code and asset changes and validate work in a multiplayer scenario.
* You need to be able to debug work in a multiplayer scenario using editor tools.

Currently, Unity does not provide any workflow that covers all of these requirements. (See our [roadmap here](https://unity.com/roadmap/unity-platform/multiplayer-networking))

Expand All @@ -22,7 +23,7 @@ Player builds do not meet the quick iteration and easy debuggability using edito
This approach is great when we need to verify work on the target platform or with a wider group of testers.
:::

First step is to build an executable.
First step is to build an executable.

1. Navigate to `File->Build Settings` in the menu bar.
1. Click `Build`.
Expand All @@ -45,39 +46,34 @@ Though functional, we find this approach to be somewhat slow for the purposes of
:::

## ParrelSync
:::caution

ParallelSync is **not** supported by Unity. More information on its usage is available [here](https://github.com/VeriorPies/ParrelSync). Troubleshooting information can be found [here](https://github.com/VeriorPies/ParrelSync/wiki/Troubleshooting-&-FAQs)
[**ParrelSync**](https://github.com/VeriorPies/ParrelSync) is an open-source Unity editor extension that allows users to **test multiplayer gameplay without building the project** by having another Unity editor window opened and mirror the changes from the original project.

:::caution
ParallelSync is **not** supported by Unity. Please see the repositor for more information and [troubleshooting information](https://github.com/VeriorPies/ParrelSync/wiki/Troubleshooting-&-FAQs)
:::

![parrelsync-bossroom-demo](../../../static/img/parrelsync-bossroom-demo.gif)

[**ParrelSync**](https://github.com/VeriorPies/ParrelSync) is an open-source Unity editor extension that allows users to **test multiplayer gameplay without building the project** by having another Unity editor window opened and mirror the changes from the original project.

**ParrelSync** works by making a copy of the original project folder and creating symbolic links to the `Asset` and `Project Settings` folders back from the original project.

We use **ParrelSync** for local iteration in [Boss Room sample](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop/).

:::important

**ParrelSync** relies on symbolic links and partial copies of the original project folder structure - generally it is completely safe.
![parrelsync-bossroom-demo](../../../static/img/parrelsync-bossroom-demo.gif)

To ensure that no bug in any of the software you use can destroy your work - it is recommended that you consistently backup your project or use a version control system. Some common examples are:
- [Git](https://git-scm.com/)
- [SVN](https://subversion.apache.org/)
- [Plastic](https://www.plasticscm.com/)
ParrelSync is generally safe because it relies on symbolic links and partial copies of the original project folder structure.

:::important
Although ParrelSync is generally safe, you should still consistently back up your project or use a version control system to ensure you don't lose your work.
:::

### Installation

Follow the installation instructions on **ParrelSync** repo [page](https://github.com/VeriorPies/ParrelSync#installation)

### Usage
- Navigate to `ParrelSync->Preferences` in the menu bar to open the preferences window.
- Ensure that both Options are selected as shown below


* Navigate to `ParrelSync->Preferences` in the menu bar to open the preferences window.
* Ensure that both Options are selected as shown below

![parrelsync-preferences](/img/parrelsync-preferences.png)

:::important
Expand All @@ -86,21 +82,40 @@ By default **ParrelSync** prevents asset serialization in all clone instances an

:::

- Open the `ParrelSync->Clones Manager` from which you can launch, create and remove clone editors.
- Advanced usage is to utilize **ParrelSync's** capability of passing [Arguments](https://github.com/VeriorPies/ParrelSync/wiki/Argument) to clones, thus allowing to run custom logic on a per-clone basis.
* Open the `ParrelSync->Clones Manager` from which you can launch, create and remove clone editors.
* Advanced usage is to utilize **ParrelSync's** capability of passing [Arguments](https://github.com/VeriorPies/ParrelSync/wiki/Argument) to clones, thus allowing to run custom logic on a per-clone basis.

### UGS Authentication

When you use [Unity Authentication](https://docs.unity.com/authentication/IntroUnityAuthentication.html), it caches the user's identity locally, even with [Anonymous Sign-in](https://docs.unity.com/authentication/UsingAnonSignIn.html).This means that each ParrelSync clone will be signed in as the same user, making testing certain scenarios difficult. You can force each clone to use a different identity using the [profile management in the Authentication SDK](https://docs.unity.com/authentication/ProfileManagement.html). You can use `ParrelSync.ClonesManager` to detect and automate this step.

```csharp
// ParrelSync should only be used within the Unity Editor so you should use the UNITY_EDITOR define
#if UNITY_EDITOR
if (ParrelSync.ClonesManager.IsClone())
{
// When using a ParrelSync clone, switch to a different authentication profile to force the clone
// to sign in as a different anonymous user account.
string customArgument = ParrelSync.ClonesManager.GetArgument();
AuthenticationService.Instance.SwitchProfile($"Clone_{customArgument}_Profile");
}
#endif
```

### Known issues and workarounds
- An important nuance is that **ParrelSync** does not sync changes made to packages. `Packages` folder is synced on clone opening, so if you made package changes - you should close and re-open your clones.
- [Relevant GitHub issue](https://github.com/VeriorPies/ParrelSync/issues/48)
- If you encounter a Netcode error that mentions `soft sync` - that generally means that prefabs or scenes are not in sync between editors. You should save the project in the main editor via `File->Save Project` and refresh the projects in the clone editors by pressing `Ctrl + R` (which is by default done automatically) or reimport networked prefabs in the main editor.
- More information and general **ParrelSync** FAQ: https://github.com/VeriorPies/ParrelSync/wiki/Troubleshooting-&-FAQs
- The ultimate workaround in case nothing helps - deleting and re-creating the clone instance via `ParrelSync->Clones Manager` window.

* An important nuance is that **ParrelSync** does not sync changes made to packages. `Packages` folder is synced on clone opening, so if you made package changes - you should close and re-open your clones.
* [Relevant GitHub issue](https://github.com/VeriorPies/ParrelSync/issues/48)
* If you encounter a Netcode error that mentions `soft sync` - that generally means that prefabs or scenes are not in sync between editors. You should save the project in the main editor via `File->Save Project` and refresh the projects in the clone editors by pressing `Ctrl + R` (which is by default done automatically) or reimport networked prefabs in the main editor.
* More information and general **ParrelSync** FAQ: https://github.com/VeriorPies/ParrelSync/wiki/Troubleshooting-&-FAQs
* The ultimate workaround in case nothing helps - deleting and re-creating the clone instance via `ParrelSync->Clones Manager` window.

## General tips
- Bigger screens or multi-screen setups allow for more screen real estate, which is handy when one has to have multiple instances of an app opened at the same time.
- **ParrelSync** has to copy and update separate `Packages` and `Library` folders for every clone, and in certain cases a fix for misbehaving clone is re-creation - a good SSD makes this process quite a bit faster.
- Creating a fork of any git repository that your project relies upon in production could help avoid bad surprises if the repo gets taken down or introduces an undesirable change. You should fork **ParrelSync** before using it in your live project.

* Bigger screens or multi-screen setups allow for more screen real estate, which is handy when one has to have multiple instances of an app opened at the same time.
* **ParrelSync** has to copy and update separate `Packages` and `Library` folders for every clone, and in certain cases a fix for misbehaving clone is re-creation - a good SSD makes this process quite a bit faster.
* Creating a fork of any git repository that your project relies upon in production could help avoid bad surprises if the repo gets taken down or introduces an undesirable change. You should fork **ParrelSync** before using it in your live project.

:::contribution Special Thanks
This guide would not have been possible without the hard work and support of Philipp Deschain, Unity.
:::
This guide would not have been possible without the hard work and support of Philipp Deschain, Unity.
:::
6 changes: 5 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,13 @@ module.exports = {
lastVersion: 'current',
versions: {
current: {
label: '1.0.0',
label: '1.1.0',
path: 'current',
},
'1.0.0': {
label: '1.0.0',
path: '1.0.0'
}
},
editCurrentVersion: true,
routeBasePath: 'tools',
Expand Down
4 changes: 4 additions & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ module.exports = {
"type": "doc",
"id": "learn/bossroom/networkobject-parenting"
},
{
"type": "doc",
"id": "learn/bossroom/optimizing-bossroom"
},
{
"type": "doc",
"id": "learn/bossroom/networkrigidbody"
Expand Down
99 changes: 99 additions & 0 deletions sidebarsTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ module.exports = {
"type": "doc",
"id": "RNSM"
},
{
"type": "doc",
"id": "tools-network-simulator"
}
],

"api": [
Expand Down Expand Up @@ -78,6 +82,14 @@ module.exports = {
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetStats.Units",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetStats.MetricIdTypeLibrary",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetStats.AssemblyRequiresTypeRegistrationAttribute",
},
],
},
{
Expand Down Expand Up @@ -141,6 +153,93 @@ module.exports = {
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetStatsMonitor.SmoothingMethod",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetStatsMonitor.SampleRate",
},
],
},
{
"collapsed": true,
"type": "category",
"label": "Network Simulator",
"items": [
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.BuiltInScenarios",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.BuiltInScenarios.ConnectionsCycle",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.BuiltInScenarios.ConnectionsCycle.Configuration",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.BuiltInScenarios.PresetConfiguration",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.BuiltInScenarios.RandomConnectionsSwap",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.BuiltInScenarios.RandomConnectionsSwap.Configuration",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.INetworkEventsApi",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.INetworkSimulatorPreset",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.MinMaxRangeAttribute",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.NetworkScenario",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.NetworkScenarioBehaviour",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.NetworkScenarioTask",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.NetworkSimulator",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.NetworkSimulatorPreset",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.NetworkSimulatorPresetAsset",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Runtime.NetworkSimulatorPresets",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Editor.UI.PropertyDrawers",
},
{
"type": "doc",
"id": "api/Unity.Multiplayer.Tools.NetworkSimulator.Editor.UI.PropertyDrawers.MinMaxDrawer",
},
],
},
],
Expand Down
Binary file added static/img/tools/netsim-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/tools/netsim-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/tools/netsim-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/tools/netsim-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/tools/netsim-13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/tools/netsim-14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/tools/netsim-15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/tools/netsim-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/tools/netsim-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/tools/netsim-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/tools/netsim-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/tools/netsim-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/tools/netsim-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/tools/netsim-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/tools/netsim-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading