Skip to main content

Launchingserverpopup

Based on game build 714014 | Last updated: 2026-03-09

Overview

LaunchingServerPopup is a screen that informs the user that the dedicated server process is starting or performing world generation. It displays a dynamic, animated message and provides a cancellation button on non-console platforms. It integrates with TheNet to poll the server process status and triggers callbacks upon success or failure.

Usage example

local LaunchingServerPopup = require "screens/launchingserverpopup"
local serverinfo = { ... } -- server configuration data

TheFrontEnd:PushScreen(
LaunchingServerPopup(
serverinfo,
function(info) print("Server started successfully:", info) end,
function() print("Server failed to start") end
)
)

Dependencies & tags

Components used: None identified
Tags: None identified

Properties

PropertyTypeDefault ValueDescription
serverinfotablenilServer configuration data passed into the constructor; forwarded to callbacks.
successCallbackfunctionnilCallback invoked when the server process becomes ready (status == 3).
errorCallbackfunctionnilCallback invoked if an error occurs during server startup.
launchtimenumberGetStaticTime()Time when the popup was instantiated (used for timing, not exposed externally).
errorStartingServersbooleanfalseInternal flag indicating an error occurred external to TheNet status.
blackImagenilFull-screen darkening overlay background.
prootWidgetnilRoot widget container for popup content.
bgWidgetnilBackground container from TEMPLATES.CurlyWindow.
bg.fillImagenilDecorative fill image inside the popup background.
titleTextnilTitle label (currently unused; empty string).
textTextnilMessage text showing progress ("Launching Server..." or "Server WorldGen...").
menuMenunilCancel button menu (only present on non-console platforms).
buttonstablenilList of button definitions used to construct menu.
default_focusWidgetnilInitially focused widget (the menu if enabled).
timenumber0Accumulated time delta used to drive animation of the ellipsis dots.
progressnumber0Animation state index (1–3) controlling how many dots appear.

Main functions

OnUpdate(dt)

  • Description: Updates the popup state each frame. Polls TheNet:GetChildProcessStatus() to determine server state and updates UI (e.g., animates ellipsis dots). Handles success, error, and progress states.
  • Parameters: dt (number) — Delta time in seconds since the last update.
  • Returns: Nothing.
  • Error states: Invokes errorCallback if TheNet:GetChildProcessError() returns true or self.errorStartingServers is set; invokes successCallback when status == 3.

OnControl(control, down)

  • Description: Handles input events; specifically, allows pressing the cancel control to trigger shutdown on non-console platforms.
  • Parameters:
    control (number) — Control code (e.g., CONTROL_CANCEL).
    down (boolean) — Whether the control key is pressed (true) or released (false).
  • Returns: true if handled, otherwise false.
  • Error states: Only triggers OnCancel() if ENABLE_CANCEL_BUTTON is true, control == CONTROL_CANCEL, and down == false.

OnCancel()

  • Description: Handles user-initiated cancellation of server launch. Stops all dedicated servers and removes the popup screen.
  • Parameters: None.
  • Returns: Nothing.

SetErrorStartingServers()

  • Description: Sets the internal errorStartingServers flag to true, causing the next OnUpdate loop to treat the startup as failed.
  • Parameters: None.
  • Returns: Nothing.

Events & listeners

  • Listens to: None identified
  • Pushes: None identified