新增FishNet文档

This commit is contained in:
2026-09-20 15:53:11 +08:00
parent c403145db9
commit 179c282405
431 changed files with 15476 additions and 0 deletions
@@ -0,0 +1,100 @@
---
description: >-
PlayFlow handles the server hosting, matchmaking, & lobbies so you can focus
on your game.
cover: ../../../../.gitbook/assets/playflow-cover.png
coverY: 0
layout:
width: default
cover:
visible: true
size: full
title:
visible: false
description:
visible: false
tableOfContents:
visible: true
outline:
visible: false
pagination:
visible: true
metadata:
visible: false
---
# PlayFlow Cloud (Recommended)
<div align="center" data-full-width="false"><figure><img src="../../../../.gitbook/assets/animated-server-signals.webp" alt="" width="250"><figcaption></figcaption></figure></div>
<p align="center"><strong>PlayFlow</strong> is the <mark style="color:$primary;">easiest</mark> way to <strong>build</strong>, <strong>deploy</strong>, and <strong>scale</strong> multiplayer games globally, it's a fantastic tool for any multiplayer games that might have need of dedicated servers. Their outstanding support, reliable service, and competitive pricing make PlayFlow our personal recommendation. They have a powerful API with many useful features that make them stand-out. </p>
<p align="center"><mark style="color:$info;">Deploy your first server in under 30 seconds for free. No credit card required.</mark></p>
<div align="center" data-full-width="false"><figure><img src="../../../../.gitbook/assets/animated-down-arrow.webp" alt=""><figcaption></figcaption></figure></div>
<h2 align="center"><strong>Instant scaling with global deployment</strong></h2>
<p align="center"><mark style="color:$info;">Effortlessly scale in real time with no surprise costs during traffic surges, and deploy worldwide in seconds using Unity, containers, or your control panel.</mark></p>
<table data-view="cards" data-full-width="false"><thead><tr><th align="center"></th><th align="center"></th></tr></thead><tbody><tr><td align="center"><strong>15+</strong></td><td align="center">Global Regions</td></tr><tr><td align="center"><strong>&#x3C;20ms</strong></td><td align="center">Average Latency</td></tr><tr><td align="center"><strong>1M+</strong></td><td align="center">Players Served</td></tr></tbody></table>
***
<h3 align="center">More key benefits of PlayFlow</h3>
<p align="center"><mark style="color:$info;">The PlayFlow Unity SDK provides a powerful and convenient way to manage your game servers, lobbies, and matchmaking directly within the Unity Editor and your game’s C# scripts.</mark></p>
<p align="center"><mark style="color:$info;">Find out more about PlayFlow's robust features below!</mark></p>
***
<h2 align="center"><i class="fa-square-dollar">:square-dollar:</i></h2>
<h2 align="center"><strong>Better pricing than the competition</strong></h2>
<p align="center"><mark style="color:$info;">No hidden fees. Transparent pricing — paying only for what you use. You can use their cost estimator to get an idea of what running your game might cost you directly from their website. Check out their full pricing page</mark> <a href="https://www.playflowcloud.com/#pricing"><mark style="color:$primary;">here</mark></a><mark style="color:$info;">.</mark></p>
***
<h2 align="center"><i class="fa-users">:users:</i></h2>
<h2 align="center"><strong>Matchmaking &#x26; lobby system</strong></h2>
<p align="center"><mark style="color:$info;">Complete game lobby system and matchmaking included so you can match-up your players by skill, region, or your own rules.</mark></p>
***
<h2 align="center"><i class="fa-comments-question-check">:comments-question-check:</i></h2>
<h2 align="center"><strong>Generous free tier &#x26; support that listens</strong></h2>
<p align="center"><mark style="color:$info;">Build fast, playtest often. All without pulling out your credit card. <strong>PlayFlow</strong> offers the quickest way to test your game online, directly from the Unity editor, and you can do so for free!</mark> </p>
<p align="center"><mark style="color:$info;">Get help from real people with fast replies, and feedback that actually shapes the platform.</mark></p>
***
<h2 align="center"><i class="fa-arrow-up-right-dots">:arrow-up-right-dots:</i></h2>
<h2 align="center">Real-time metrics &#x26; <strong>powerful control panel</strong></h2>
<p align="center"><mark style="color:$info;">Experience seamless monitoring with the advanced dashboard for complete visibility. Instantly track server health, player counts, CPU/memory usage, and network traffic. Features include real-time performance tracking, customizable alerts, log aggregation, and player activity monitoring for optimal performance.</mark></p>
***
<h2 align="center"><i class="fa-list">:list:</i></h2>
<h2 align="center">And still more!</h2>
<p align="center"><mark style="color:$info;">Yet more compelling features,</mark> <strong>including</strong><mark style="color:$info;">...</mark></p>
<table data-view="cards"><thead><tr><th align="center"></th><th align="center"></th><th align="center"></th><th data-hidden data-card-cover data-type="image"></th></tr></thead><tbody><tr><td align="center"><i class="fa-timer">:timer:</i></td><td align="center">&#x3C;5min</td><td align="center">Getting Started Time</td><td></td></tr><tr><td align="center"><i class="fa-chart-column">:chart-column:</i></td><td align="center"><strong>Auto-Scaling</strong></td><td align="center">Intelligent demand-based scaling</td><td></td></tr><tr><td align="center"><i class="fa-circle-dollar-to-slot">:circle-dollar-to-slot:</i></td><td align="center"><strong>Online Cost Estimator</strong></td><td align="center">Instantly Forecast Project Costs</td><td></td></tr></tbody></table>
<p align="center"><i class="fa-browser">:browser:</i> <a href="https://www.playflowcloud.com/">Website</a> <i class="fa-rocket-launch">:rocket-launch:</i> <a href="https://documentation.playflowcloud.com/quickstart">Quick Start</a> <i class="fa-book-open">:book-open:</i> <a href="https://documentation.playflowcloud.com/quickstart">Documentation</a> <i class="fa-unity">:unity:</i> <a href="https://documentation.playflowcloud.com/unity">PlayFlow SDK</a> <i class="fa-gear-complex">:gear-complex:</i> <a href="https://documentation.playflowcloud.com/api-reference/servers/list-game-servers">API Reference</a></p>
@@ -0,0 +1,99 @@
---
description: >-
Simple tutorial showing how easy PlayFlow makes it to host a server for your
WebGL game.
---
# Easy WebGL hosting with PlayFlow
## How PlayFlow makes WebGL hosting easy
For seamless WebGL gaming experiences in web browsers, secure WebSocket connections are crucial, but configuring them can be complex. Often, developers end up managing certificates and networking issues, which can be time-consuming. **With PlayFlow,** however, you only need to enable a simple option to handle these concerns effortlessly.
## Before we begin...
This tutorial assumes you've read the [getting-started-with-playflow.md](getting-started-with-playflow.md "mention") tutorial already. In the following steps we will convert our project support WebGL.
{% stepper %}
{% step %}
### Install Bayou
For FishNet connections on WebGL we will need to use a web supported transport; there are multiple available, but this tutorial will be using [Bayou](../../../../fishnet-building-blocks/transports/bayou.md). Head over to the Bayou Github repo and download the most recently released `unitypackage` file and then import it into your project.
{% embed url="https://github.com/FirstGearGames/Bayou/releases/latest" %}
<figure><img src="../../../../.gitbook/assets/bayou-latest-release.png" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% step %}
### Add Bayou to your Network Manager
Now that **Bayou** is imported into your project, you can select your [NetworkManager](../../../../fishnet-building-blocks/components/managers/network-manager.md) and add the component to it.
<figure><img src="../../../../.gitbook/assets/bayou-added-to-networkmanager.png" alt=""><figcaption></figcaption></figure>
{% hint style="info" %}
If you have more than one [transport](../../../../fishnet-building-blocks/transports/) on your **NetworkManager**, such as [Tugboat](../../../../fishnet-building-blocks/transports/tugboat.md), then you will need to add the [TransportManager](../../../../fishnet-building-blocks/components/managers/transportmanager/) component, and drag Bayou into its **Transport** field to set it as the active one.
{% endhint %}
{% endstep %}
{% step %}
### Enable WSS
In the Bayou component, enable the **Use WSS** option. This will tell Bayou to use Web Socket Secure. Doing this will show a bunch of **SSL Configuration** options below, but we don't need to do anything with them for this setup.
<figure><img src="../../../../.gitbook/assets/bayou-wss-enabled.png" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% step %}
### Build your PlayFlow server
Open the PlayFlow Cloud Window from the Unity toolbar (**PlayFlow → Playflow Cloud**).
Click the **Upload Server** button to build and upload your Unity server.
<figure><img src="../../../../.gitbook/assets/playflow-uploading-server.png" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% step %}
### Set the correct PlayFlow port protocol
Open the [PlayFlow dashboard](https://app.playflowcloud.com/) in your browser and navigate to the **Configuration** tab. Edit or add your port and choose the **TCP** protocol and be sure to **Enable TLS**.
<figure><img src="../../../../.gitbook/assets/playflow-tcp-tls.png" alt=""><figcaption><p>Choosing the correct protocol for WebGL</p></figcaption></figure>
{% endstep %}
{% step %}
### Start a PlayFlow server
Now head over to the **Server** tab in PlayFlow and create your server instance.
<figure><img src="../../../../.gitbook/assets/playflow-create-webgl-server.png" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% step %}
### Prepare your client build
If you click on your server instance's **Details**, you will see a **Host** and **External Port** that you will be able to connect your clients to. Open Unity, select the Bayou component, and enter these into the **Client Address** and **Port** fields respectively.
<div><figure><img src="../../../../.gitbook/assets/playflow-webgl-address-port.png" alt=""><figcaption></figcaption></figure> <figure><img src="../../../../.gitbook/assets/bayou-webgl-fields-entered.png" alt=""><figcaption></figcaption></figure></div>
{% endstep %}
{% step %}
### Building your WebGL client
Now let's build the WebGL client. In your Unity build profiles, be sure to switch to the **Web Platform** and then build your game. Once that's done you can zip the built files and upload it to your chosen hosting site and run your game in the browser!
<figure><img src="../../../../.gitbook/assets/zipped-webgl-files.png" alt=""><figcaption></figcaption></figure>
For this test we have created a project on Itch.io and uploaded the client build to it.
<figure><img src="../../../../.gitbook/assets/itch.io-uploaded-webgl-game.png" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}
## Success!
Just like that, we were able to create a server and have our clients in the web browser securely connect to it. If you want to check out more of their features, you can check out their documentation here: [https://documentation.playflowcloud.com/](https://documentation.playflowcloud.com/)
You are also encouraged to join their <i class="fa-discord">:discord:</i> Discord server here: [https://discord.gg/P5w45Vx5Q8](https://discord.gg/P5w45Vx5Q8)
@@ -0,0 +1,214 @@
---
description: Step-by-step tutorial for getting up and running with PlayFlow Cloud.
---
# Getting Started with PlayFlow
{% embed url="https://www.youtube.com/watch?v=TyvBHUlYP64" %}
***
## Written tutorial
This guide assumes you have some or all of your game already written using FishNet and are now ready to use PlayFlow to implement a dedicated server. You can also use PlayFlow throughout the development process as its one-click deployment makes it easy to setup a temporary server for testing.
## Before we begin...
{% stepper %}
{% step %}
### Starting project
If you don't have a project already setup but want to follow this tutorial, you can use the [getting-started](../../../../tutorials/getting-started/ "mention") FishNet tutorial project. The files for it can be downloaded here:
<a href="https://github.com/maxkratt/fish-networking-getting-started/releases/download/using-syncvars-to-sync-colors/using-syncvars-to-sync-colors.unitypackage" class="button primary" data-icon="down-to-line">Getting Started Project</a>&#x20;
{% endstep %}
{% step %}
### Install the PlayFlow SDK
Now that we're ready to start, let's install [PlayFlow Cloud](https://www.playflowcloud.com/). You can directly import it with the following git URL:
```url
https://github.com/PlayFlowCloud/PlayFlow-Multiplayer-Unity-SDK.git
```
Simply add this through the Unity Package Manager and you'll be ready to continue!
{% hint style="info" %}
If you need more detailed instructions for this step, check out **PlayFlow's** own tutorial page dedicated to it here.
<a href="https://documentation.playflowcloud.com/guides/installation" class="button secondary" data-icon="rocket">Installation Guide</a>
{% endhint %}
{% endstep %}
{% step %}
### Add the necessary Unity modules
The next thing we need to do is ensure our Unity installation has the correct modules for building a server. Install the **Linux Build Support** modules for your Unity version in the Unity Hub.
{% hint style="info" %}
Exact details on the required modules depending on your Unity version can be found here:
<a href="https://documentation.playflowcloud.com/guides/unity-modules" class="button secondary" data-icon="unity">Unity Modules Setup</a>
{% endhint %}
{% endstep %}
{% step %}
### Add Tugboat
Select the [NetworkManager](../../../../fishnet-building-blocks/components/managers/network-manager.md) in your project and add the [Tugboat](../../../../fishnet-building-blocks/transports/tugboat.md) component if it isn't already there (If you are using a different [transport](../../../../fishnet-building-blocks/transports/), that is also fine).
Enable the **Reuse Address** checkbox, this will be needed for our server to work correctly.&#x20;
<div align="center"><figure><img src="../../../../.gitbook/assets/playflow-tutorial-tugboat-reuse-address.png" alt=""><figcaption></figcaption></figure></div>
The other two fields we'll be paying attention to are the _Port_ and _Client Address_ ones. For now you can leave the default settings, we'll remember the port number for later and we'll use the _Client Address_ field in our client build to input the URL of our hosted server.
{% endstep %}
{% step %}
### Manage Auto Start
We will want FishNet to automatically start as a server in the server build we make. FishNet will actually do this by default with the [#start-on-headless](../../../../fishnet-building-blocks/components/managers/server-manager.md#start-on-headless "mention") option on the [ServerManager](../../../../fishnet-building-blocks/components/managers/server-manager.md). If you disabled this, be sure to manage starting the server itself, or simply re-enable it.
If we have set the [networkhudcanvas.md](../../../../fishnet-building-blocks/prefabs/networkhudcanvas.md "mention") _Auto Start Type_ to something other than **Disabled**, then we will want to disable it now, since we want our server to only behave as a server.
<figure><img src="../../../../.gitbook/assets/setting-autostart-type.png" alt=""><figcaption><p>Switch Auto Start Type to Disabled</p></figcaption></figure>
{% endstep %}
{% endstepper %}
Once that's all done we can move on to using PlayFlow Cloud!
## Deploying your game with PlayFlow
{% stepper %}
{% step %}
### Create your PlayFlow account
Now that PlayFlow is installed, let's go to the website and setup our dashboard.
Go to the [PlayFlow Cloud website](https://app.playflowcloud.com/) and sign-up using your email, or log in with your GitHub or Google account. If asked, confirm your email address to complete the setup.
{% endstep %}
{% step %}
### Create a game studio
You'll now be prompted to create a Game Studio. Game Studios make it easy to organize your game projects and work smoothly with your team.
Enter a name for studio and select either the **Hobby** or **Pro** plan, you can read more about the plan types [here](https://documentation.playflowcloud.com/fundamentals/plan-instance-types). For this tutorial we will be using the **Hobby** plan, but don't worry, you can always change the plan and even the name after it's created.&#x20;
Once you've done that, click **Create Studio** and you'll be good to continue.
{% hint style="info" %}
If you've chosen the **Pro** plan, you will also be able to manage **Team Collaboration** after your studio is created.
{% endhint %}
{% endstep %}
{% step %}
### Create a new project
Now that you've created your first Studio you'll be prompted to choose it and then we can move forward with creating a new project.
Click the **Create New Project** button and let's enter the details of your project.
* [x] **Project Name:** give your project any fitting name you'd like.
* [x] **Game Engine:** Select <i class="fa-unity">:unity:</i> _**Unity**_ as the **Game Engine** as that's what we are usin&#x67;**.**
* [x] **Game Type:** You can choose the game type that fits your project best, for this guide we'll simply choose <i class="fa-puzzle-piece-simple">:puzzle-piece-simple:</i> _**Other.**_
You can now click **Create Project** to proceed,
{% endstep %}
{% step %}
### Explore the dashboard
With your new project created and selected, you can check out the **PlayFlow** dashboard for it.
PlayFlow has a lot of powerful features and makes it very easy for you, the developer of your game, to view the logs, metrics, server details and more. The PlayFlow dashboard can also be used to directly upload your game's server builds and manage server instances.
<figure><img src="../../../../.gitbook/assets/playflow-tutorial-dashboard.png" alt=""><figcaption></figcaption></figure>
Once you're done looking around, we'll jump into setting up our server build and running it.
{% endstep %}
{% step %}
### Link the PlayFlow SDK to your project
Now let's link our Unity Project to the PlayFlow one we've just created.&#x20;
1. Open the **Overview** page in the PlayFlow dashboard.
2. Find the **API Keys** section and click the **View API Keys** button. Then copy the **PlayFlow API Key** to your clipboard.
3. Now go to the Unity Editor and open the PlayFlow window from the Toolbar at **PlayFlow → PlayFlow Cloud**.
4. Inside the _Token_ field, paste the **PlayFlow API Key** you copied.
<figure><img src="../../../../.gitbook/assets/playflow-tutorial-sdk-window.png" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% step %}
### Build and upload the server
You should now specify the scene that the server should start in with the **Server Scene** field. You can set it manually by selecting the chosen scene through the dropdown or you can make PlayFlow use the **Build Settings' Scene List** instead, by enabling that option.
{% hint style="info" %}
Don't forget to add your scenes to Unity's build settings scene list!
{% endhint %}
You can also customize the other settings in the PlayFlow Cloud window, such as the **Development Build** or **Build Version**.
When you're happy with those, you can press the **Upload Server** button to have PlayFlow automatically build and upload a headless Linux server build of your game. This will take a brief moment, and then you will have a log in the editor console saying the build uploaded successfully.&#x20;
If needed, you can browse the files of the build and delete it directly from the PlayFlow Dashboard under the Builds tab; pressing the **View Builds** button in the PlayFlow window will open this directly for you.
{% endstep %}
{% step %}
### Setup the PlayFlow port
Now we will setup the port to use in the PlayFlow dashboard. Open up the website and head to the **Configuration** tab and then **Network Ports** section. Click the **Add Your First Port** button and fill in the fields.
<figure><img src="../../../../.gitbook/assets/playflow-tutorial-add-new-port.png" alt=""><figcaption></figcaption></figure>
* [x] **Port Name:** We can enter a simple name for it here, we'll just call ours `getting_started_udp`.
* [x] **Port Number:** This field should be filled in with the port we have entered in our Transport's _Port_ field. Since we are using Tugboat, the default is `7770`, so enter that now.
* [x] **Protocol:** This is the protocol used by your transport, Tugboat uses UDP, so leave that as the option.
* [x] **Description (Optional):** This field is optional and self-explanatory.
Once those are entered, click the **Add Port** button to finish this step.
{% endstep %}
{% step %}
### Create the server
Now we are ready to start our server, head over to the Servers tab and click the **Create Your First Server** button.
<figure><img src="../../../../.gitbook/assets/playflow-tutorial-start-server.png" alt=""><figcaption></figcaption></figure>
A window will pop-up letting you customize the settings for this server, we've changed the **Name** to `FishNet Getting Started`, you can of course choose any name you like as well as customizing the other settings to better suit your needs. Once you are happy, press **Create** Server.
You should now see the server in the Servers tab and you can see its details or stop it directly from here.
<figure><img src="../../../../.gitbook/assets/playflow-tutorial-launching-servers.png" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% step %}
### Connect to the server
Click on the **Details** button to see the details of the server. You can view the Details, Metrics, and Logs of the server here; we will look at the **Details → Network** section and copy the _Host_ and the _External Port_ fields.
<figure><img src="../../../../.gitbook/assets/playflow-tutorial-server-details.png" alt=""><figcaption></figcaption></figure>
In the Unity Editor, select the Tugboat component (or other transport you may be using).
* [x] Enter the IP Address you copied from the **Host** field into the Transport's _Client Address_ field.
* [x] Enter the P**ort** you copied into the Transport's _Port_ field.
{% endstep %}
{% step %}
### Test the game
You can now run the game or build and run it and connect as a client. Your game should connect to the PlayFlow server we setup and work correctly!
{% endstep %}
{% endstepper %}
## Take the Next Steps!
Well done! You've now learned how to setup and deploy your server using PlayFlow. If you want to check out more of their features, you can check out their documentation here: [https://documentation.playflowcloud.com/](https://documentation.playflowcloud.com/)
You are also encouraged to join their <i class="fa-discord">:discord:</i> Discord server here: [https://discord.gg/P5w45Vx5Q8](https://discord.gg/P5w45Vx5Q8)