From b324c9f6ba34515a0139070d51b5d8b76e82f2d0 Mon Sep 17 00:00:00 2001 From: Samuel Bellomo Date: Tue, 6 Apr 2021 10:39:00 -0400 Subject: [PATCH 01/13] quick fix for missing TGA --- .gitattributes | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index a7c1fa5fa..02663bbf7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -45,7 +45,7 @@ *.pict filter=lfs diff=lfs merge=lfs -text *.png filter=lfs diff=lfs merge=lfs -text *.psd filter=lfs diff=lfs merge=lfs -text -*.tga filter=lfs diff=lfs merge=lfs -text +*.[tT][gG][aA] filter=lfs diff=lfs merge=lfs -text *.tif filter=lfs diff=lfs merge=lfs -text *.tiff filter=lfs diff=lfs merge=lfs -text @@ -53,4 +53,4 @@ *.unity filter=lfs diff=lfs merge=lfs text *.prefab binary *.asset filter=lfs diff=lfs merge=lfs -text -*.anim filter=lfs diff=lfs merge=lfs -text \ No newline at end of file +*.anim filter=lfs diff=lfs merge=lfs -text From b5522f1501b82682ccf05c5d885a3a358bd559a7 Mon Sep 17 00:00:00 2001 From: Fernando Cortez <75813458+fernando-cortez@users.noreply.github.com> Date: Tue, 6 Apr 2021 13:08:46 -0400 Subject: [PATCH 02/13] project name update (#245) --- Assets/Readme.asset | 4 +- .../CHANGELOG.md | 4 +- .../LICENSE.md | 2 +- .../README.md | 49 +++++++++++++------ ProjectSettings/ProjectSettings.asset | 4 +- 5 files changed, 42 insertions(+), 21 deletions(-) diff --git a/Assets/Readme.asset b/Assets/Readme.asset index 4af7a64d1..82f297bf6 100644 --- a/Assets/Readme.asset +++ b/Assets/Readme.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ee7c71d7f0de6fe2614eaddccd0475f7123fcf5c7023373ab585d864cde14e7b -size 1593 +oid sha256:0dc36111ae6abda8bd267480ed5bb0463196175b303325911227d92acf9e5ac5 +size 1599 diff --git a/Packages/com.unity.multiplayer.samples.coop/CHANGELOG.md b/Packages/com.unity.multiplayer.samples.coop/CHANGELOG.md index f5d0d7c5b..24fde3b47 100644 --- a/Packages/com.unity.multiplayer.samples.coop/CHANGELOG.md +++ b/Packages/com.unity.multiplayer.samples.coop/CHANGELOG.md @@ -4,6 +4,6 @@ All notable changes to this project template will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [0.1.0-experimental] - 2021-04-07 +## [0.1.0] - 2021-04-07 -### This is the experimental release of *Boss Room: Small scale coop sample*. +### This is the early access release of *Boss Room: Small scale co-op sample*. diff --git a/Packages/com.unity.multiplayer.samples.coop/LICENSE.md b/Packages/com.unity.multiplayer.samples.coop/LICENSE.md index bb8c73b1a..1f9b60552 100644 --- a/Packages/com.unity.multiplayer.samples.coop/LICENSE.md +++ b/Packages/com.unity.multiplayer.samples.coop/LICENSE.md @@ -1,4 +1,4 @@ -Boss Room: Small scale coop sample © 2021 Unity Technologies +Boss Room: Small scale co-op sample © 2021 Unity Technologies Licensed under the Unity Companion License for Unity-dependent projects (see https://unity3d.com/legal/licenses/unity_companion_license); otherwise licensed under the Unity Package Distribution License (see https://unity3d.com/legal/licenses/Unity_Package_Distribution_License). diff --git a/Packages/com.unity.multiplayer.samples.coop/README.md b/Packages/com.unity.multiplayer.samples.coop/README.md index ddd7573bf..3601e75bf 100644 --- a/Packages/com.unity.multiplayer.samples.coop/README.md +++ b/Packages/com.unity.multiplayer.samples.coop/README.md @@ -1,25 +1,35 @@ ![Banner](Documentation/Images/Banner.png) -# BossRoom - co-op multiplayer RPG built with Unity MLAPI +# Boss Room - co-op multiplayer RPG built with Unity MLAPI ->**IMPORTANT**: This project is currently experimental. +| 🛑 IMPORTANT - Early Access 🛑 | +| -- | +| Boss Room: Small Scale Co-op Sample is built on top of the MLAPI package. The MLAPI package is on the road to being a fully featured solution. We have solutions architects available on Discord and forums to help you work through issues you encounter. | -BossRoom is a fully functional co-op multiplayer RPG made in Unity and MLAPI. It is built to serve as an educational sample that showcases certain typical gameplay patterns that are frequently featured in similar games. +Boss Room is a fully functional co-op multiplayer RPG made with Unity MLAPI. It is built to serve as an educational sample that showcases certain typical gameplay patterns that are frequently featured in similar games. -Our intention is that you can use everything in this project as a starting point or as bits and pieces in your own Unity games. The project is licensed under the Unity Companion License. See [LICENSE](LICENSE) for more legal information. +Our intention is that you can use everything in this project as a starting point or as bits and pieces in your own Unity games. The project is licensed under the Unity Companion License. See [LICENSE.md](LICENSE.md) for more legal information. ``` Platforms : Windows, Mac ``` +![](Documentation/Images/3Players.png) +![](Documentation/Images/Boss.png) + ## Getting the project - - A release version can be downloaded from the [Releases](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop/releases) page. + - The early access version can be downloaded from the [Releases](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop/releases) page. - Alternatively: click the green `Code` button and then choose to download the zip archive. Remember, that you would download the branch that you are currently viewing in Github. + - For Windows users: Using Windows' built-in extracting tool may generate a "Error 0x80010135: Path too long" error window which can invalidate the extraction process. A workaround for this is to shorten the zip file to a single character (eg. "c.zip") and move it to the shortest path on your computer (most often right at C:\\) and retry. If that solution fails, another workaround is to extract the downloaded zip file using 7zip. + +## Installing Git LFS + +This project uses Git Large Files Support (LFS), which ensures all large assets required locally are handled for the project. See [Git LFS installation options](https://github.com/git-lfs/git-lfs/wiki/Installation) for Windows and Mac instructions. ## Opening the project for the first time -Once you have downloaded the project the steps below should get you up and running: +Once you have downloaded the project, the steps below should get you up and running: - Make sure you have installed the version of Unity that is listed above in the prerequisites section. - Make sure to include standalone support for Windows/Mac in your installation. - Add the project in _Unity Hub_ by clicking on **Add** button and pointing it to the root folder of the downloaded project. @@ -28,7 +38,6 @@ Once you have downloaded the project the steps below should get you up and runni ![](Documentation/Images/StartupScene.png) - From there you can click the **Play** button. You can host a new game or join an existing game using the in-game UI. - ## Testing multiplayer In order to see the multiplayer functionality in action we can either run multiple instances of the game locally on our computer or choose to connect to a friend over the internet. @@ -49,11 +58,16 @@ After the build has completed you can launch several instances of the built exec --------------- **Multiplayer over internet** -In contrast to running a local setup, when playing over internet we don't neccessarily need a built executable. We can just run the game in editor. +In order to play over internet, we need to have a built executable that is shared between all players. See the previous section. -Running the game over internet currently requires setting up a [Photon Transport for MLAPI](https://github.com/Unity-Technologies/mlapi-community-contributions), which uses Photon relay server to facilitate communication between clients and server living on different networks. +It is possible to connect between multiple instances of the same executable OR between executables and the editor that produced said executable. -Alternatively you can use Port Forwarding. The wonderful https://portforward.com/ site has guides on how to enable port forwarding on a huge number of routers. BossRoom uses `UDP` and needs a `9998` external port to be open. +Running the game over internet currently requires setting up a [Photon Transport for MLAPI](https://github.com/Unity-Technologies/mlapi-community-contributions), which uses Photon relay server to facilitate communication between clients and server living on different networks. + +> Checkout our Photon-Realtime setup guide, here: +> [Boss Room Photon Setup Guide](Documentation/Photon-Realtime/Readme.md) + +Alternatively you can use Port Forwarding. The wonderful https://portforward.com/ site has guides on how to enable port forwarding on a huge number of routers. Boss Room uses `UDP` and needs a `9998` external port to be open. ------------------------------------------ @@ -66,14 +80,14 @@ The game is server-authoritative, with latency-masking animations. Position upda Code is organized into three separate assemblies: **Client**, **Shared** and **Server** which reference each other when appropriate. -For an in-depth overview of the project's architecture please check out our [ARCHITECTURE.md](ARCHITECTURE.md). +For an overview of the project's architecture please check out our [ARCHITECTURE.md](ARCHITECTURE.md). + +--------------- +For a deep dive in MLAPI and Boss Room, visit our [doc](https://docs-multiplayer.unity3d.com/) and [Learn](https://docs-multiplayer.unity3d.com/docs/learn/introduction) sections. ## Contributing -> __IMPORTANT__: -> This project uses Git Large Files Support (LFS). See the [link with Git LFS installation options](https://git-lfs.github.com/). - The project uses the `git-flow` branching strategy, as such: - `develop` branch contains all active development - `master` branch contains release versions @@ -83,4 +97,11 @@ To get the project on your machine you need to clone the repository from GitHub git clone https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git ``` +> __IMPORTANT__: +> You should have [Git LFS](https://git-lfs.github.com/) installed on your local machine. + Please check out [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on submitting issues and PRs to BossRoom! + +For futher discussion points and to connect with the team, join us on the MLAPI by Unity Discord Server - Channel #dev-samples + +[![Discord](https://img.shields.io/discord/449263083769036810.svg?label=discord&logo=discord&color=informational)](https://discord.gg/FM8SE9E) diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index e97816aaf..9a8e0e2b5 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4f5c071ca7bf442a2eabdb420c97f16bd488d29dca6f2df824914f0d752d1a0b -size 20855 +oid sha256:5a41039292e87eb931590c172313c31f152d6000f3da88f47904d23cd28dac22 +size 20842 From 99284dbff7e3e348838e02de14952efb91f40894 Mon Sep 17 00:00:00 2001 From: Sam Bellomo <71790295+SamuelBellomo@users.noreply.github.com> Date: Tue, 6 Apr 2021 13:41:11 -0400 Subject: [PATCH 03/13] Adding missing space --- CODE_OF_CONDUCT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 7b3c7c7ad..a3362d446 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1 +1 @@ -The BossRoom repository follows the same code of conduct as the MLAPI repository. Please read the [MLAPI code of conduct](https://github.com/Unity-Technologies/com.unity.multiplayer.mlapi/blob/master/CODE_OF_CONDUCT.md), thank you! \ No newline at end of file +The Boss Room repository follows the same code of conduct as the MLAPI repository. Please read the [MLAPI code of conduct](https://github.com/Unity-Technologies/com.unity.multiplayer.mlapi/blob/master/CODE_OF_CONDUCT.md), thank you! From 5d8cf6de2f2b8eed4ebcfcb7af4f435809b8096f Mon Sep 17 00:00:00 2001 From: Briancoughlin <76997526+Briancoughlin@users.noreply.github.com> Date: Tue, 6 Apr 2021 18:57:02 +0100 Subject: [PATCH 04/13] Update readme (#256) --- README.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3601e75bf..da848ead0 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,11 @@ Boss Room is a fully functional co-op multiplayer RPG made with Unity MLAPI. It Our intention is that you can use everything in this project as a starting point or as bits and pieces in your own Unity games. The project is licensed under the Unity Companion License. See [LICENSE.md](LICENSE.md) for more legal information. +> __IMPORTANT__: +> - Boss Room supports those platforms supported by MLAPI (Windows and Mac). +> - Boss Room is compatible with Unity 2020.3 and later. +> - Make sure to include standalone support for Windows/Mac in your installation. + ``` Platforms : Windows, Mac @@ -45,12 +50,12 @@ In order to see the multiplayer functionality in action we can either run multip --------------- **Local multiplayer setup** -First we would need a built executable. +First we need to build an executable. -To make a build in the menu bar press _File/Build Settings_ and then press **Build**. +To build an executable press _File/Build Settings_ in the menu bar, and then press **Build**. ![](Documentation/Images/BuildProject.png) -After the build has completed you can launch several instances of the built executable to be able to both host and join a game. +Once the build has completed you can launch several instances of the built executable in order to both host and join a game. > Mac users: to run multiple instances of the same app, you need to use the command line. > Run `open -n BossRoom.app` @@ -58,7 +63,7 @@ After the build has completed you can launch several instances of the built exec --------------- **Multiplayer over internet** -In order to play over internet, we need to have a built executable that is shared between all players. See the previous section. +To play over internet, we need to build an executable that is shared between all players. See the previous section. It is possible to connect between multiple instances of the same executable OR between executables and the editor that produced said executable. @@ -67,14 +72,14 @@ Running the game over internet currently requires setting up a [Photon Transport > Checkout our Photon-Realtime setup guide, here: > [Boss Room Photon Setup Guide](Documentation/Photon-Realtime/Readme.md) -Alternatively you can use Port Forwarding. The wonderful https://portforward.com/ site has guides on how to enable port forwarding on a huge number of routers. Boss Room uses `UDP` and needs a `9998` external port to be open. +Alternatively you can use Port Forwarding. The https://portforward.com/ site has guides on how to enable port forwarding on a huge number of routers. Boss Room uses `UDP` and needs a `9998` external port to be open. ------------------------------------------ ## Exploring the project -BossRoom is an 8-player co-op RPG game experience, where players collaborate to take down some minions, and then a boss. Players can select between classes that each have skills with didactically interesting networking characteristics. Control model is click-to-move, with skills triggered by mouse button or hotkey. +BossRoom is an eight-player co-op RPG game experience, where players collaborate to take down some minions, and then a boss. Players can select between classes that each have skills with didactically interesting networking characteristics. Control model is click-to-move, with skills triggered by mouse button or hotkey. -One of the 8 clients acts as the host/server. That client will use a compositional approach so that its entities have both server and client components. +One of the eight clients acts as the host/server. That client will use a compositional approach so that its entities have both server and client components. The game is server-authoritative, with latency-masking animations. Position updates are done through NetworkedVars that sync position, rotation and movement speed. NetworkedVars and Remote Procedure Calls (RPC) endpoints are isolated in a class that is shared between the server and client specialized logic components. All game logic runs in FixedUpdate at 30 Hz, matching our network update rate. From d33d6a75188acd14a5a5b195862b54d821e8f426 Mon Sep 17 00:00:00 2001 From: Fernando Cortez <75813458+fernando-cortez@users.noreply.github.com> Date: Tue, 6 Apr 2021 14:36:19 -0400 Subject: [PATCH 05/13] adding initial codeowners file (sam as global) (#258) --- .github/CODEOWNERS | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..157aa3aa4 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,16 @@ + +# Lines starting with '#' are comments. +# Each line is a file pattern followed by one or more owners. + +# More details are here: https://help.github.com/articles/about-codeowners/ + +# The '*' pattern is global owners. + +# Order is important. The last matching pattern has the most precedence. +# The folders are ordered as follows: + +# In each subsection folders are ordered first by depth, then alphabetically. +# This should make it easy to add new rules without breaking existing ones. + +# Global rule: +* @SamuelBellomo \ No newline at end of file From 8c32d652fa51ef25017a96655112b356e9e70200 Mon Sep 17 00:00:00 2001 From: Simon Shen <75452232+nomishen@users.noreply.github.com> Date: Tue, 6 Apr 2021 14:42:03 -0400 Subject: [PATCH 06/13] Update LICENSE.md Updated Boss Room name. --- LICENSE.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index d5e667754..c5a1c2995 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,5 +1,4 @@ -# UCL License -Boss Room: Multiplayer Simple Coop © 2021 Unity Technologies +Boss Room: Small scale co-op sample © 2021 Unity Technologies Licensed under the Unity Companion License for Unity-dependent projects (see https://unity3d.com/legal/licenses/unity_companion_license); otherwise licensed under the Unity Package Distribution License (see https://unity3d.com/legal/licenses/Unity_Package_Distribution_License). From 140fa46741c507b34c3ef53359849b3e016c359d Mon Sep 17 00:00:00 2001 From: Simon Shen <75452232+nomishen@users.noreply.github.com> Date: Tue, 6 Apr 2021 14:44:29 -0400 Subject: [PATCH 07/13] Update LICENSE.md --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index c5a1c2995..cbc0bbfe9 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Boss Room: Small scale co-op sample © 2021 Unity Technologies +Boss Room: Small Scale Co-op Sample © 2021 Unity Technologies Licensed under the Unity Companion License for Unity-dependent projects (see https://unity3d.com/legal/licenses/unity_companion_license); otherwise licensed under the Unity Package Distribution License (see https://unity3d.com/legal/licenses/Unity_Package_Distribution_License). From 7030d057264bcee65444c8714dbc46b020b1b0c4 Mon Sep 17 00:00:00 2001 From: Simon Shen <75452232+nomishen@users.noreply.github.com> Date: Tue, 6 Apr 2021 14:49:53 -0400 Subject: [PATCH 08/13] Update LICENSE.md --- LICENSE.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index d5e667754..cbc0bbfe9 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,5 +1,4 @@ -# UCL License -Boss Room: Multiplayer Simple Coop © 2021 Unity Technologies +Boss Room: Small Scale Co-op Sample © 2021 Unity Technologies Licensed under the Unity Companion License for Unity-dependent projects (see https://unity3d.com/legal/licenses/unity_companion_license); otherwise licensed under the Unity Package Distribution License (see https://unity3d.com/legal/licenses/Unity_Package_Distribution_License). From 436a83309803928530ce604ee6cb381d462376f2 Mon Sep 17 00:00:00 2001 From: Lori Krell <76010626+lkrell@users.noreply.github.com> Date: Tue, 6 Apr 2021 16:52:26 -0500 Subject: [PATCH 09/13] docs: Changelog and Third Party for 0.1.0 (#233) --- CONTRIBUTING.md | 2 +- .../CHANGELOG.md | 38 ++++++++++++++++--- .../Third Party Notices.md | 37 ++++++++++++++++++ 3 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 Packages/com.unity.multiplayer.samples.coop/Third Party Notices.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77af4e23d..5f6d58245 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,7 +38,7 @@ If you would like to implement a new feature then consider what kind of change i ### Documentation -We accept changes and improvements to our documentation. Just submit a Pull Request with your proposed changes as described in the [Pull Request Submission Guidelines](#submit-pr). +We accept changes and improvements to our documentation through the [MLAPI Documentation repo](https://github.com/Unity-Technologies/com.unity.multiplayer.docs). ## Contributor License Agreements diff --git a/Packages/com.unity.multiplayer.samples.coop/CHANGELOG.md b/Packages/com.unity.multiplayer.samples.coop/CHANGELOG.md index 24fde3b47..e97877e69 100644 --- a/Packages/com.unity.multiplayer.samples.coop/CHANGELOG.md +++ b/Packages/com.unity.multiplayer.samples.coop/CHANGELOG.md @@ -1,9 +1,35 @@ -# Changelog -All notable changes to this project template will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +# Multiplayer Samples Co-op Changelog ## [0.1.0] - 2021-04-07 -### This is the early access release of *Boss Room: Small scale co-op sample*. +v0.1.0 is an Early Access release for Multiplayer Samples Co-op. + +It requires and supports Unity v2020.3 and later and Unity MLAPI v0.1.0. For additional information on MLAPI, see the changelog and release notes for the Unity MLAPI package. + +### New features + +Boss Room is a small-scale cooperative game sample project built on top of the new experimental netcode library. The release provides example code, assets, and integrations to explore the concepts and patterns behind a multiplayer game flow. It supports up to 8 players for testing multiplayer functionality. + +* See the README for installation instructions, available in the downloaded [release](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop/releases/latest) and [GitHub](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop). +* Learn with Unity using the Boss Room source code, project files, and assets which include: 1 populated dungeon level, 4 character classes with 2 genders, combatant imps and boss, and a simple collaborative puzzle. +* Test co-op games by running multiple instances of the game locally or connecting to a friend over the internet. + +### Known issues + +* Sometimes when the host leaves the Boss Room, not all clients will return to the Main Menu, but will remain stuck in the Boss Room scene. +* Sometimes after completing a match and the host starts a new match from the Victory or Loss screen, connected players may have no visible interactions to join or select characters. +* A player may encounter a rare exception when the Tank character uses her Shield Aura ability. This issue may be due to intercepting the Boss charge attack. +* If two players in the Character Select **Ready** for the same hero at the same time, the UI will update to *Readied* on both clients, but only one will have actually selected the hero on the Host. This issue blocks Character Select from proceeding. +* Any player that plays the game and then returns to the Main Menu may be unable to Start or Join properly again, requiring you to restart the client. +* Green quads may show on impact when the Archer arrow strikes enemies. This issue may only occur in the editor. +* You may encounter a game error due to a Unity MLAPI exception. Not all MLAPI exceptions are fully exposed few informing users. +* The Photon Transport currently generates some errors in the Player log related to the `PhotonCryptoPlugin`. +* The welcome player message in the lobby indicates P2 (player 2) regardless of your generated name. Currently the Character Select scene displays “Player1” and “P1” in two locations, where it is intended that the user’s name be displayed. +* The spawner portal does not work in this release. +* Players may not reliably play another match when selecting **Return to Main Menu** during the post-game scene. This may be due to states not properly clearing. +* Some actions may feel unresponsive and require action anticipation animations. +* In some degraded network conditions, a replicated entity on a client can vanish from that client, creating the effect of being assailed by an invisible enemy. +* Boss collisions with a Pillar may not correctly apply a stun effect and shatter the pillar when using the Trample attack. +* The displayed graphical affects for casting and blocking a Bolt do not correctly match the caster and target. +* Some areas of the Boss Room require updates to geometry seams and collisions, for short walls and lava pits. + diff --git a/Packages/com.unity.multiplayer.samples.coop/Third Party Notices.md b/Packages/com.unity.multiplayer.samples.coop/Third Party Notices.md new file mode 100644 index 000000000..e99fdae65 --- /dev/null +++ b/Packages/com.unity.multiplayer.samples.coop/Third Party Notices.md @@ -0,0 +1,37 @@ +This package contains third-party software components governed by the license(s) indicated below: +--------- + +## Package: + +--------- + +Component Name: UnityToonShader + +License Type: Unlicense + +https://github.com/IronWarrior/UnityToonShader + +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to \ No newline at end of file From 709a8bb768137a837fb138d5a174c1da7a4121bc Mon Sep 17 00:00:00 2001 From: Phil Deschain Date: Tue, 6 Apr 2021 17:57:07 -0400 Subject: [PATCH 10/13] Architecture.md improvements (#254) --- ARCHITECTURE.md | 106 ++++++++++++++++++++++++++++-------------------- 1 file changed, 61 insertions(+), 45 deletions(-) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index d9a511b98..12a3324b6 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -1,35 +1,71 @@ # Architecture - -This document describes the high-level architecture of BossRoom. +This document describes the high-level architecture of Boss Room. If you want to familiarize yourself with the code base, you are just in the right place! -> __IMPORTANT__: -> This doc is heavily WIP +Boss Room is an 8-player co-op RPG game experience, where players collaborate to take down some minions, and then a boss. Players can select between classes that each have skills with didactically interesting networking characteristics. Control model is click-to-move, with skills triggered by mouse button or hotkey. + +Code is organized into three separate assemblies: `Client`, `Server` and `Shared` (which, as it's name implies, contains shared functionality that both client and the server require). + +## Host model +Boss Room uses a Host model for its server. This means one client acts as a server and hosts the other clients. + +A common pitfall of this pattern is writing the game in such a way that it is virtually impossible to adapt to a dedicated server model. + +We attempted to combat this by using a compositional model for our client and server logic (rather than having it all combined is single modules): + - On the Host, each GameObject has `{Server, Shared, Client}` components. + - If you start up the game as a dedicated server, the client components will disable themselves, leaving you with `{Server, Shared}` components. + - If you start up as a client, you get the complementary set of `{Shared, Client}` components. + +This approach works, but requires some care: + - if you have server and clients of a shared base class, you need to remember that the shared code will run twice on the host; + - you also need to take care about code executing in `Start` and `Awake`: if this code runs contemporaneously with the `NetworkingManager`'s initialization, it may not know yet whether the player is a host or client. + - We judged this extra complexity worth it, as it provides a clear road-map to supporting true dedicated servers. + - Client server separation also allows not having god-classes where both client and server code are intermingled. This way, when reading server code, you do not have to mentally skip client code and vice versa. This helps making bigger classes more readable and maintainable. Please note that this pattern can be applied on a case by case basis. If your class never grows too big, having a single `NetworkBehaviour` is perfectly fine. + +## Connection flow +The Boss Room network connection flow is owned by the `GameNetPortal`: + - The Host will invoke either `GameNetPortal.StartHost`, or `StartRelayHost` (if Photon relay is being used). + - The client will invoke either `ClientGameNetPortal.StartClient`, or `StartClientRelayMode`. + - Boss Room's own connection validation logic is performed in `ServerGameNetPortal.ApprovalCheck`, which is plugged in to the `NetworkingManager`'s connection approval callback. Here some basic information about the connection is recorded (including a GUID, to facilitate future reconnect logic), and success or failure is returned. In the future, additional game-level failures will be detected and returned (such as a `ServerFull` scenario). -## Bird's Eye View +## Data model +Game data in Boss Room is defined in `ScriptableObjects`. The `ScriptableObjects` are organized by enum and made available in a singleton class: the `GameDataSource`, in particular `ActionDescription` and `CharacterData`. `Actions` represent discrete verbs (like swinging a weapon, or reviving someone), and are substantially data driven. Characters represent both the different player classes, and also monsters, and represent basic details like health, as well as what "Skill" Actions are available to each Character. -## Exploring the project -BossRoom is an 8-player co-op RPG game experience, where players collaborate to take down some minions, and then a boss. Players can select between classes that each have skills with didactically interesting networking characteristics. Control model is click-to-move, with skills triggered by mouse button or hotkey. +## Transports +Currently two network transport mechanisms are supported: +- IP based +- Relay Based -One of the 8 clients acts as the host/server. That client will use a compositional approach so that its entities have both server and client components. +In the former, the clients connect directy to a host via IP address. This will only work if both are in the same local area network or if the host forwards ports. -The game is server-authoritative, with latency-masking animations. Position updates are done through NetworkTransforms. NetworkedVars and RPC endpoints are isolated in a class that is shared between the server and client specialized logic components. All gamelogic runs in FixedUpdate at 30 Hz, matching our network update rate. +In the latter, some setup is required. Please see our guide [here](Documentation/Photon-Realtime/Readme.md) on how to setup our current relay. + +Please see [Multiplayer over internet](README.md) section of our Readme for more information on using either one. + +To allow for both of these options to be chosen at runtime we created `TransportPicker`. It allows to chose between an IP-based and a Relay-based transport and will hook up the game UI to use those transports. The transport field in the `NetworkManager` will be ignored. Currently we support the following transports: +- **UNet(IP):** UNet is the default MLAPI transport and the default IP transport for Boss Room. +- **LiteNetLib(IP):** We use LiteNetLib in Boss Room because it has a built in way to simulate latency which is useful for spotting networking issues early during development. +- **Photon Realtime (Relay):** Photon Realtime is a relay transport using the [Photon Realtime Service](https://www.photonengine.com/Realtime). + +To add new transport in the project parts of `GameNetPortal` and `ClientGameNetPortal` (transport switches) need to be extended. -Code is organized into three separate assemblies: **Client**, **Shared** and **Server** which reference each other when appropriate. +## Game state / Scene flow +In Boss Room, scenes correspond to top-level Game States (see `GameStateBehaviour` class) in a 1:1 way. That is, there is a `MainMenu` scene, `Character Select` scene (and state), and so on. -For an in-depth overview of the project's architecture please check out our [ARCHITECTURE.md](ARCHITECTURE.md). +Because it is currently challenging to have a client be in a different scene than the server it's connected to, the options for MLAPI developers are either to not use scenes at all, or to use scenes, and let game state transitions on the host drive game state transitions on the client indirectly by forcing client scene transitions through MLAPI's networked scene management. -### Key classes +We chose the latter approach. +Each scene has exactly one `GameStateBehaviour` (a specialization of `MLAPI.NetworkBehaviour`), that is responsible for running the global state logic for that scene. States are transitioned by triggered scene transitions. -### Key classes +## Important classes **Shared** - - `NetworkCharacterState` Contains all NetworkedVars, and both server and client RPC endpoints. The RPC endpoints only read out the call parameters and then raise events from them; they don’t do any logic internally. + - `NetworkCharacterState` Contains NetworkedVars that store the state of any given character, and both server and client RPC endpoints. The RPC endpoints only read out the call parameters and then raise events from them; they don’t do any logic internally. **Server** - `ServerCharacterMovement` manages the movement Finite State Machine (FSM) on the server. Updates the NetworkedVars that synchronize position, rotation and movement speed of the entity on its FixedUpdate. - - `ServerCharacter` has the AIBrain, as well as the ActionQueue. Receives action requests (either from the AIBrain in case of NPCs, or user input in case of player characters), and executes them. + - `ServerCharacter` has the `AIBrain`, as well as the ActionQueue. Receives action requests (either from the AIBrain in case of NPCs, or user input in case of player characters), and executes them. - `AIBrain` contains main AI FSM. - `Action` is the abstract base class for all server actions - `MeleeAction`, `AoeAction`, etc. contain logic for their respective action types. @@ -39,41 +75,21 @@ For an in-depth overview of the project's architecture please check out our [ARC - `ClientInputSender `. On a shadow entity, will self-destruct. Listens to inputs, interprets them, and then calls appropriate RPCs on the RPCStateComponent. - `ActionFX` is the abstract base class for all the client-side action visualizers - `MeleeActionFX`, `AoeActionFX`, etc. Contain graphics information for their respective action types. - - - -### Movement action flow + +## Movement action flow - Client clicks mouse on target destination. - Client->server RPC, containing target destination. - Anticipatory animation plays immediately on client. - - Server path-plans. - - Once path-plan is finished, server representation of entity starts updating its NetworkedTransform at 30fps. Graphics is on a separate GO and is connected to the networked GO via a spring, to smooth out small corrections. - - Graphics GO never passes the simulation GO; if it catches up to the sim due to a network delay, the user will see a hitch. - -### Transports - -Boss Room provides players with two ways to connect to a server. + - Server performs pathfinding. + - Once pathfinding is finished, server representation of entity starts updating it's NetworkVariables at 30fps. + - Visuals GameObject never outpaces the simulation GameObject, always slightly behind and interpolating towards the networked position and rotation. -- IP based: The clients connect directy to a host via IP address. This will only work if both are in the same local are network or if the host forwards ports. -- Relay Based: The clients and the host connect to a relay server with a room key and run all traffic over this relay server. +## Navigation System +Each scene which uses navigation or dynamic navigation objects should have a `NavigationSystem` component on a scene GameObject. That object also needs to have the `NavigationSystem` tag. -To allow for both of these options to be chosen at runtime we created `TransportPicker`. `Transport` picker allows to chose a ip based and a relay based transport and will hook up the game UI to use those transports. The transport field in the `NetworkManager` will be ignored. Currently we support the following transports: -- **UNet(IP):** UNet is the default MLAPI transport and the default IP transport for Boss Room. -- **LiteNetLib(IP):** We use LiteNetLib in Boss Room because it has a built in way to simulate latency which is useful for spotting networking issues early during development. -- **Photon Realtime (Relay):** Photon Realtime is a relay transport using the [Photon Realtime Service](https://www.photonengine.com/Realtime). +### Building a navigation mesh +The project is using `NavMeshComponents`. This means direct building from the Navigation window will not give the desired results. Instead find a `NavMeshComponent` in the given scene e.g. a **NavMeshSurface** and use the **Bake** button of that script. Also make sure that there is always only one navmesh file per scene. Navmesh files are stored in a folder with the same name as the corresponding scene. You can recognize them based on their icon in the editor. They follow the naming pattern "NavMesh-\" -To add new transport in the project parts of `GameNetPortal` and `ClientGameNetPortal` (transport switches) need to be extended. - -### Navigation System - -#### Building a navigation mesh -The project is using NavMeshComponents. This means direct building from the Navigation window will not give the desired results. Instead find a NavMeshComponent in the given scene e.g. a **NavMeshSurface** and use the **Bake** button of that script. Also make sure that there is always only one navmesh file per scene. Navmesh files are stored in a folder with the same name as the corresponding scene. You can recognize them based on their icon in the editor. They follow the naming pattern "NavMesh-\" - -#### Dynamic Navigation Objects +### Dynamic Navigation Objects A dynamic navigation object is an object which affects the state of the navigation mesh such as a door which can be openend or closed. To create a dynamic navigation object add a NavMeshObstacle to it and configure the shape (in most cases this should just match the corresponding collider). Then add a DynamicNavObstacle component to it. - -#### Navigation System -Each scene which uses navigation or dynamic navigation objects should have a NavigationSystem component on a scene gameobject. That object also needs to have the "NavigationSystem" tag. - ---------------------------- \ No newline at end of file From ef215c4799d364437e75f37a321a165746efa283 Mon Sep 17 00:00:00 2001 From: Sam Bellomo <71790295+SamuelBellomo@users.noreply.github.com> Date: Tue, 6 Apr 2021 18:05:24 -0400 Subject: [PATCH 11/13] Update README.md in package (#260) --- .../README.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Packages/com.unity.multiplayer.samples.coop/README.md b/Packages/com.unity.multiplayer.samples.coop/README.md index 3601e75bf..da848ead0 100644 --- a/Packages/com.unity.multiplayer.samples.coop/README.md +++ b/Packages/com.unity.multiplayer.samples.coop/README.md @@ -9,6 +9,11 @@ Boss Room is a fully functional co-op multiplayer RPG made with Unity MLAPI. It Our intention is that you can use everything in this project as a starting point or as bits and pieces in your own Unity games. The project is licensed under the Unity Companion License. See [LICENSE.md](LICENSE.md) for more legal information. +> __IMPORTANT__: +> - Boss Room supports those platforms supported by MLAPI (Windows and Mac). +> - Boss Room is compatible with Unity 2020.3 and later. +> - Make sure to include standalone support for Windows/Mac in your installation. + ``` Platforms : Windows, Mac @@ -45,12 +50,12 @@ In order to see the multiplayer functionality in action we can either run multip --------------- **Local multiplayer setup** -First we would need a built executable. +First we need to build an executable. -To make a build in the menu bar press _File/Build Settings_ and then press **Build**. +To build an executable press _File/Build Settings_ in the menu bar, and then press **Build**. ![](Documentation/Images/BuildProject.png) -After the build has completed you can launch several instances of the built executable to be able to both host and join a game. +Once the build has completed you can launch several instances of the built executable in order to both host and join a game. > Mac users: to run multiple instances of the same app, you need to use the command line. > Run `open -n BossRoom.app` @@ -58,7 +63,7 @@ After the build has completed you can launch several instances of the built exec --------------- **Multiplayer over internet** -In order to play over internet, we need to have a built executable that is shared between all players. See the previous section. +To play over internet, we need to build an executable that is shared between all players. See the previous section. It is possible to connect between multiple instances of the same executable OR between executables and the editor that produced said executable. @@ -67,14 +72,14 @@ Running the game over internet currently requires setting up a [Photon Transport > Checkout our Photon-Realtime setup guide, here: > [Boss Room Photon Setup Guide](Documentation/Photon-Realtime/Readme.md) -Alternatively you can use Port Forwarding. The wonderful https://portforward.com/ site has guides on how to enable port forwarding on a huge number of routers. Boss Room uses `UDP` and needs a `9998` external port to be open. +Alternatively you can use Port Forwarding. The https://portforward.com/ site has guides on how to enable port forwarding on a huge number of routers. Boss Room uses `UDP` and needs a `9998` external port to be open. ------------------------------------------ ## Exploring the project -BossRoom is an 8-player co-op RPG game experience, where players collaborate to take down some minions, and then a boss. Players can select between classes that each have skills with didactically interesting networking characteristics. Control model is click-to-move, with skills triggered by mouse button or hotkey. +BossRoom is an eight-player co-op RPG game experience, where players collaborate to take down some minions, and then a boss. Players can select between classes that each have skills with didactically interesting networking characteristics. Control model is click-to-move, with skills triggered by mouse button or hotkey. -One of the 8 clients acts as the host/server. That client will use a compositional approach so that its entities have both server and client components. +One of the eight clients acts as the host/server. That client will use a compositional approach so that its entities have both server and client components. The game is server-authoritative, with latency-masking animations. Position updates are done through NetworkedVars that sync position, rotation and movement speed. NetworkedVars and Remote Procedure Calls (RPC) endpoints are isolated in a class that is shared between the server and client specialized logic components. All game logic runs in FixedUpdate at 30 Hz, matching our network update rate. From b09b4d633b7f9e2e28d5aa9500bb69e65c5bb264 Mon Sep 17 00:00:00 2001 From: Christopher Pope Date: Thu, 8 Apr 2021 23:17:34 +0200 Subject: [PATCH 12/13] Create third-party contributions file (#262) A file containing details on our third-party contributors. --- third-party contributors.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 third-party contributors.md diff --git a/third-party contributors.md b/third-party contributors.md new file mode 100644 index 000000000..52bff65ef --- /dev/null +++ b/third-party contributors.md @@ -0,0 +1,24 @@ +## Third-Party Contributors + +The Boss Room sample game was created by Unity Technologies in partnership with external contributors: + +[Storm Flag Games](https://stormflaggames.com) + +* Multiplayer Code +* UI/UX +* Icon Art +* Environment Art +* 3D Characters and Animations + +[Jason Hayes Music LLC](https://www.jasonhayesmusic.com/) + +* Music and Sound Effects + +[Room 8 Studio](https://room8studio.com/) + +* Visual FX + +Please familarise yourself with the [License](https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop/blob/master/LICENSE.md) type for these assets. +You are free to use these assets in your own work. + +Everyone at Unity including our third-party contributors is very excited to see what you do with them in your Unity projects! From db507ac93b1323d70883dff571c49e8e3fc2eea2 Mon Sep 17 00:00:00 2001 From: Sam Bellomo <71790295+SamuelBellomo@users.noreply.github.com> Date: Thu, 8 Apr 2021 17:17:52 -0400 Subject: [PATCH 13/13] Correction for stealth state, should use bool, not byte (#263) --- .../Client/Game/Character/ClientCharacterVisualization.cs | 4 ++-- .../Scripts/Server/Game/Action/StealthModeAction.cs | 6 +++--- Assets/BossRoom/Scripts/Server/Game/Character/AIBrain.cs | 2 +- .../Scripts/Shared/Game/Entity/NetworkCharacterState.cs | 6 +----- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Assets/BossRoom/Scripts/Client/Game/Character/ClientCharacterVisualization.cs b/Assets/BossRoom/Scripts/Client/Game/Character/ClientCharacterVisualization.cs index d3eae3c1b..b023aa312 100644 --- a/Assets/BossRoom/Scripts/Client/Game/Character/ClientCharacterVisualization.cs +++ b/Assets/BossRoom/Scripts/Client/Game/Character/ClientCharacterVisualization.cs @@ -252,7 +252,7 @@ private void OnCharacterAppearanceChanged(int oldValue, int newValue) SetAppearanceSwap(); } - private void OnStealthyChanged(byte oldValue, byte newValue) + private void OnStealthyChanged(bool oldValue, bool newValue) { SetAppearanceSwap(); } @@ -261,7 +261,7 @@ private void SetAppearanceSwap() { if (m_CharacterSwapper) { - if (m_NetState.IsStealthy.Value != 0 && !m_NetState.IsOwner) + if (m_NetState.IsStealthy.Value && !m_NetState.IsOwner) { // this character is in "stealth mode", so other players can't see them! m_CharacterSwapper.SwapAllOff(); diff --git a/Assets/BossRoom/Scripts/Server/Game/Action/StealthModeAction.cs b/Assets/BossRoom/Scripts/Server/Game/Action/StealthModeAction.cs index 6cead3f08..ef4aef9d7 100644 --- a/Assets/BossRoom/Scripts/Server/Game/Action/StealthModeAction.cs +++ b/Assets/BossRoom/Scripts/Server/Game/Action/StealthModeAction.cs @@ -25,7 +25,7 @@ public override bool Start() if (!movement.IsPerformingForcedMovement()) { movement.CancelMove(); - } + } return true; } @@ -40,7 +40,7 @@ public override bool Update() { // start actual stealth-mode... NOW! m_IsStealthStarted = true; - m_Parent.NetState.IsStealthy.Value = 1; + m_Parent.NetState.IsStealthy.Value = true; } return !m_IsStealthEnded; } @@ -66,7 +66,7 @@ private void EndStealth() m_IsStealthEnded = true; if (m_IsStealthStarted) { - m_Parent.NetState.IsStealthy.Value = 0; + m_Parent.NetState.IsStealthy.Value = false; } // note that we cancel the ActionFX here, and NOT in Cancel(). That's to handle the case where someone diff --git a/Assets/BossRoom/Scripts/Server/Game/Character/AIBrain.cs b/Assets/BossRoom/Scripts/Server/Game/Character/AIBrain.cs index c8b51220b..67b85da54 100644 --- a/Assets/BossRoom/Scripts/Server/Game/Character/AIBrain.cs +++ b/Assets/BossRoom/Scripts/Server/Game/Character/AIBrain.cs @@ -91,7 +91,7 @@ public bool IsAppropriateFoe(ServerCharacter potentialFoe) if (potentialFoe == null || potentialFoe.IsNpc || potentialFoe.NetState.NetworkLifeState.Value != LifeState.Alive || - potentialFoe.NetState.IsStealthy.Value != 0) + potentialFoe.NetState.IsStealthy.Value) { return false; } diff --git a/Assets/BossRoom/Scripts/Shared/Game/Entity/NetworkCharacterState.cs b/Assets/BossRoom/Scripts/Shared/Game/Entity/NetworkCharacterState.cs index e63394a58..9cdaadffd 100644 --- a/Assets/BossRoom/Scripts/Shared/Game/Entity/NetworkCharacterState.cs +++ b/Assets/BossRoom/Scripts/Shared/Game/Entity/NetworkCharacterState.cs @@ -51,11 +51,7 @@ public void InitNetworkPositionAndRotationY(Vector3 initPosition, float initRota /// /// Indicates whether this character is in "stealth mode" (invisible to monsters and other players). /// - /// - /// FIXME: this should be a bool, but NetworkedVarBool doesn't work at the moment! It's serialized - /// as a bit, but deserialized as a byte, which corrupts the whole network-var stream. - /// - public NetworkVariableByte IsStealthy { get; } = new NetworkVariableByte(0); + public NetworkVariableBool IsStealthy { get; } = new NetworkVariableBool(); [SerializeField] NetworkHealthState m_NetworkHealthState;