9.0 KiB
Boss Room - Co-op multiplayer RPG built with Unity Netcode for GameObjects
Solutions architects are available on Discord and forums to help you work through issues you may encounter when using Boss Room. |
---|
Boss Room is a fully functional co-op multiplayer RPG made with Unity Netcode. It is built to serve as an educational sample that showcases certain typical gameplay patterns that are frequently featured in similar networked games.
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 for more legal information.
See ART_NOTES.md for more information on the art of Boss Room.
IMPORTANT:
- Boss Room has been developed and tested on these Platforms (Windows, Mac, iOS, and Android).
- Tested on iPhone 6 and Pixel 3.
- Boss Room is compatible with the latest Unity LTS version.
- Make sure to include standalone support for Windows/Mac in your installation.
Getting the project
- The pre-release version can be downloaded from the 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 to clone locally
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 for Windows and Mac instructions.
Registering the project with Unity Gaming Services (UGS)
This project leverages several services from UGS to facilitate connectivity between players. In order to use these services inside your project, one must first create an organization inside Unity Dashboard, and enable both the Relay and Lobby services. Otherwise, Boss Room can still be used without UGS.
Opening the project for the first time
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.
- The first time you open the project Unity will import all assets, which will take longer than usual - it is normal.
- Once the editor is ready, navigate to the Project window and open the Project/Startup scene.
- 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 your computer, using either ParrelSync or builds or choose to connect to a friend over the internet. See how to test for more info.
Local multiplayer setup
First we need to build an executable.
To build an executable, press File/Build Settings in the menu bar, and then press Build.
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
Multiplayer over internet
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 relay. Boss Room provides an integration with Unity Relay.
Checkout our Unity Relay setup guide here
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. Make sure your host's address listens on 0.0.0.0 (127.0.0.1 is for local development only).
Dedicated Server
Boss Room has a dedicated server mode, allowing you to use it as a headless server with no player running on it. To run it:
Local testing
- Switch your editor to the Dedicated Server build target.
- Hit play. Boss Room will bypass the main menu and enter directly the character select scene and wait for players.
- On a clone or build, connect your client to 127.0.0.1 with default port.
A build can be uploaded to a dedicated server hosting provider (for example Multiplay).
On Multiplay, please use these launch parameters: -port=$$port$$ -logFile $$server_log_dir$$/Engine.log
For more info on dedicated servers and why you'd want to use this, see our docs site!
Exploring the project
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 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 overview of the project's architecture please check out our ARCHITECTURE.md.
For a deep dive in Unity Netcode and Boss Room, visit our doc and Unity Multiplayer Resources sections.
Bite-size Samples
This repository contains a collection of bitesize sample projects and games that showcase different sub-features of NGO. You can review these samples with documentation to understand APIs and features better.
Contributing
The project uses the git-flow
branching strategy, as such:
develop
branch contains all active developmentmain
branch contains release versions
To get the project on your machine you need to clone the repository from GitHub using the following command-line command:
git clone https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git
IMPORTANT: You should have Git LFS installed on your local machine.
Please check out CONTRIBUTING.md for guidelines on submitting issues and PRs to BossRoom!
For further discussion points and to connect with the team, join us on the Unity Multiplayer Networking Discord Server - Channel #dev-samples