> ## Documentation Index
> Fetch the complete documentation index at: https://docs.playflowcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start - Godot

> Step-by-step tutorial for getting up and running with Godot on PlayFlow Cloud

# Getting Started with Godot on PlayFlow

This guide assumes you have some or all of your game already written using Godot 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.

<Info>
  **Godot 4.x** - This guide uses Godot 4.4, but any 4.x version should work. We'll be using WebSocket networking for cross-platform compatibility.
</Info>

## Prerequisites

Before you start, make sure you have:

* **Godot 4.x** installed with the Linux export templates
* A **PlayFlow Cloud account** (created in the first step below)
* A Godot project with multiplayer networking, or you can follow the [multiplayer game tutorial](/guides/godot-first-multiplayer-game) to build one from scratch

## Before We Begin

<Steps>
  <Step title="Starting Project">
    If you don't have a project already setup but want to follow this tutorial, you can create a complete multiplayer game from scratch using our comprehensive guide.

    <Card title="Create Your First Multiplayer Game" icon="gamepad-2" href="/guides/godot-first-multiplayer-game">
      Complete tutorial for building a multiplayer game in Godot with PlayFlow
    </Card>
  </Step>

  <Step title="Configure Server Auto-Start">
    Configure your game to automatically start as a server in headless builds. In your main multiplayer manager script, add server detection:

    ```gdscript theme={null}
    func _ready() -> void:
        if OS.has_feature("dedicated_server"):
            start_server()
    ```

    This ensures your server starts automatically when deployed to PlayFlow.
  </Step>
</Steps>

Once that's all done we can move on to using PlayFlow Cloud!

## Deploying Your Game with PlayFlow

<Steps>
  <Step title="Create Your PlayFlow Account">
    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.
  </Step>

  <Step title="Create an Organization">
    Create an Organization to hold your projects (and your team, on Pro).

    * Enter an organization name
    * Click **Create Organization**

    <Info>
      New organizations start on the **Free** plan (max 1 active server, forced `small` size, 1-hour TTL). You can upgrade to **Pro** later from **Billing** in your project settings to unlock all compute sizes, longer TTLs, and unlimited active servers.
    </Info>
  </Step>

  <Step title="Create a New Project">
    Click **Create New Project** and enter:

    * **Project Name**: Your game name
    * **Game Engine**: Godot

    Click **Create Project** to proceed.
  </Step>

  <Step title="Export Your Server Build">
    1. Go to **Project → Export** in Godot
    2. Add a **Linux/X11** export preset
    3. In the **Resources** tab, set **Export Mode** to "Export as dedicated server"
    4. **IMPORTANT**: Name your executable "Server" (required by PlayFlow)
    5. Export your project and create a .zip archive of all files

    <Info>
      The dedicated server export creates a headless build perfect for PlayFlow deployment.
    </Info>
  </Step>

  <Step title="Upload Your Server Build">
    1. In the PlayFlow dashboard, go to the **Builds** tab
    2. Click **Upload Build**
    3. Upload your .zip file containing the server executable
    4. Wait for the upload to complete

    <Info>
      PlayFlow will automatically detect and configure your Godot server build.
    </Info>
  </Step>

  <Step title="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.

    <img src="https://mintcdn.com/playflow/xqejJlsQi8e5RWr4/images/fishnet-webgl/playflow-tcp-tls.png?fit=max&auto=format&n=xqejJlsQi8e5RWr4&q=85&s=983ccef24e38d0d3f89ddc9b87d6f868" alt="PlayFlow TCP TLS Configuration" width="550" height="202" data-path="images/fishnet-webgl/playflow-tcp-tls.png" />

    * **Port Name**: `godot_websocket`
    * **Port Number**: `8080` (or your configured port)
    * **Protocol**: **TCP**
    * **Enable TLS**: **Yes** (required for "wss\://" connections from web clients)
    * **Description (Optional)**: WebSocket port for Godot multiplayer

    Click the **Add Port** button to finish this step.

    <Warning>
      **Enable TLS** is critical for web browser compatibility. Without TLS, web clients cannot connect using "wss\://" protocol.
    </Warning>
  </Step>

  <Step title="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.

    <img src="https://mintcdn.com/playflow/xqejJlsQi8e5RWr4/images/fishnet/start-server.png?fit=max&auto=format&n=xqejJlsQi8e5RWr4&q=85&s=5d451192209e900b554206565e3d08b1" alt="Create Server Dialog" width="688" height="865" data-path="images/fishnet/start-server.png" />

    A window will pop-up letting you customize the settings for this server. You can change the **Name** to "Godot Game Server", or 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.

    <img src="https://mintcdn.com/playflow/xqejJlsQi8e5RWr4/images/fishnet/launching-servers.png?fit=max&auto=format&n=xqejJlsQi8e5RWr4&q=85&s=dad30ded62235272a3f189c97d3d9f22" alt="Launching Servers View" width="1382" height="397" data-path="images/fishnet/launching-servers.png" />
  </Step>

  <Step title="Connect to the Server">
    Click on the **Details** button to see the details of the server. Look at the **Details → Network** section and copy the Host and External Port.

    <img src="https://mintcdn.com/playflow/xqejJlsQi8e5RWr4/images/fishnet/server-details.png?fit=max&auto=format&n=xqejJlsQi8e5RWr4&q=85&s=54e15b6d99554736fec13ce21189502e" alt="Server Details" width="783" height="831" data-path="images/fishnet/server-details.png" />

    Configure your Godot client with the PlayFlow server details:

    **In your connection script:**

    ```gdscript theme={null}
    func connect_to_server(host: String, port: String):
        var peer = WebSocketMultiplayerPeer.new()
        var url = "wss://" + host + ":" + port
        var error = peer.create_client(url)
        if error == OK:
            multiplayer.multiplayer_peer = peer
    ```

    <Info>
      **For Web Builds**: Always use "wss\://" protocol for secure WebSocket connections. For local testing, you can use "ws\://" but production deployments should use TLS.
    </Info>
  </Step>

  <Step title="Test the Game">
    1. Run your Godot project locally or export a client build
    2. Enter the PlayFlow Host and External Port in your connection UI
    3. Connect to the server
    4. Your game should connect to the PlayFlow server and work correctly!

    <Tip>
      **Testing Multiple Clients**: Enable **Debug → Customize Run Instances → Enable Multiple Instances** in Godot to test multiple clients connecting to your PlayFlow server.
    </Tip>
  </Step>
</Steps>

## Take the Next Steps!

Well done! You've now learned how to setup and deploy your Godot server using PlayFlow.

## Resources

* **PlayFlow Documentation**: [docs.playflowcloud.com](https://docs.playflowcloud.com/)
* **PlayFlow Discord**: [discord.gg/P5w45Vx5Q8](https://discord.gg/P5w45Vx5Q8)
* **Godot Documentation**: [docs.godotengine.org](https://docs.godotengine.org/)
* **Godot Multiplayer**: [docs.godotengine.org/en/stable/tutorials/networking](https://docs.godotengine.org/en/stable/tutorials/networking/)

## Next Steps

<CardGroup cols={3}>
  <Card title="Complete Multiplayer Tutorial" icon="gamepad-2" href="/guides/godot-first-multiplayer-game">
    Build a complete multiplayer game from scratch
  </Card>

  <Card title="Lobby System" icon="users" href="/unity/lobby-overview">
    Add lobbies to your Godot game
  </Card>

  <Card title="Matchmaking" icon="shuffle" href="/unity/matchmaking">
    Implement matchmaking for competitive play
  </Card>
</CardGroup>

<Info>
  PlayFlow's lobby and matchmaking systems are engine-agnostic REST APIs (`/api/v3/lobbies`), so they work from Godot too. The linked pages use Unity examples, but the same HTTP endpoints apply — call them from GDScript with `HTTPRequest`, sending your key in the `api-key` header.
</Info>

## Common Issues

<AccordionGroup>
  <Accordion title="Server not starting automatically">
    Ensure your server detection script uses `OS.has_feature("dedicated_server")` and that the "Export as dedicated server" option is enabled in your export preset.
  </Accordion>

  <Accordion title="Web clients can't connect">
    * Verify TLS is enabled in PlayFlow port configuration
    * Ensure you're using "wss\://" protocol for web clients
    * Check that the port (8080) matches between your server code and PlayFlow configuration
    * Verify firewall rules aren't blocking connections
  </Accordion>

  <Accordion title="Players not spawning or synchronizing">
    * Check that MultiplayerSpawner is properly configured
    * Verify MultiplayerSynchronizer is set up on player scenes
    * Ensure players are being added to the correct groups
    * Check that spawn functions are called when peers connect
  </Accordion>

  <Accordion title="Connection timeout or failed">
    * Verify the server URL and port are correct
    * Check that the PlayFlow server instance is running
    * For local testing, use "ws\://" instead of "wss\://"
    * Ensure your networking code handles connection failures gracefully
  </Accordion>
</AccordionGroup>
