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 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 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 diff --git a/Assets/BossRoom/Scripts/Client/Game/Character/ClientCharacterVisualization.cs b/Assets/BossRoom/Scripts/Client/Game/Character/ClientCharacterVisualization.cs index ced1319c4..23793453e 100644 --- a/Assets/BossRoom/Scripts/Client/Game/Character/ClientCharacterVisualization.cs +++ b/Assets/BossRoom/Scripts/Client/Game/Character/ClientCharacterVisualization.cs @@ -261,7 +261,7 @@ private void OnCharacterAppearanceChanged(int oldValue, int newValue) SetAppearanceSwap(); } - private void OnStealthyChanged(byte oldValue, byte newValue) + private void OnStealthyChanged(bool oldValue, bool newValue) { SetAppearanceSwap(); } @@ -271,7 +271,7 @@ private void SetAppearanceSwap() if (m_CharacterSwapper) { var specialMaterialMode = CharacterSwap.SpecialMaterialMode.None; - if (m_NetState.IsStealthy.Value != 0) + if (m_NetState.IsStealthy.Value) { if (m_NetState.IsOwner) { 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 a44f7448d..c747c708e 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; 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/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! 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 f5d0d7c5b..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. +# Multiplayer Samples Co-op Changelog -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] - 2021-04-07 -## [0.1.0-experimental] - 2021-04-07 +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. -### This is the experimental release of *Boss Room: Small scale coop 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..da848ead0 100644 --- a/Packages/com.unity.multiplayer.samples.coop/README.md +++ b/Packages/com.unity.multiplayer.samples.coop/README.md @@ -1,25 +1,40 @@ ![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. + +> __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 ``` +![](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 +43,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. @@ -36,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` @@ -49,30 +63,35 @@ 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. +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. -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. +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. -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. +> Checkout our Photon-Realtime setup guide, here: +> [Boss Room Photon Setup Guide](Documentation/Photon-Realtime/Readme.md) + +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. 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). +--------------- -## Contributing +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. -> __IMPORTANT__: -> This project uses Git Large Files Support (LFS). See the [link with Git LFS installation options](https://git-lfs.github.com/). +## Contributing The project uses the `git-flow` branching strategy, as such: - `develop` branch contains all active development @@ -83,4 +102,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/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 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 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. 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!