Enable the player proxy by default and give lobbies an empty save

The player proxy now listens on 34197 by default. New hosts default to
the port range 34200-34299 so they don't hand that port to instances,
and the controller logs an error and runs without the proxy if the port
is taken, as hosts with the old range only skip it when the controller
already holds it.

Lobby instances start the save lobby.zip, created on first start as a
one tile map with no autoplace and with the freeplay scenario replaced by
an empty one. This uses the new chooseSave instance hook, which lets
plugins pick or create the save to start, and setSaveScenario from
@clusterio/host, which sets the scenario the save patcher keeps loading.
Map gen settings can't use a width and height of 0 for this, as Factorio
takes 0 to mean an unlimited map.

The address players reach the proxy on moves from lobby.public_address
to controller.player_proxy_public_address. When it's set the player_auth
login page lists it once for the instances behind the proxy instead of
their own addresses, and lobbies with player_auth loaded get a button
that opens the web interface login dialog.
This commit is contained in:
Danielv123 committed 2026-10-29 20:54:11 +01:00
1 parent 3ae486143d
commit a5bd43637e
23 files changed
+391 -121

No files matched your search

+5 -3
View File
@@ -222,7 +222,7 @@ Disabled when null.
Must be greater than 0.
Requires a restart of the controller to take effect.
Defaults to null.
Defaults to 34197, the default port of Factorio servers.
### controller.player_proxy_default_instance_id
@@ -401,11 +401,13 @@ Defaults to "localhost".
### host.factorio_port_range
UDP ports the host hands out to instances that don't have factorio.game_port set.
Written as a comma separated list of ports and/or ranges of ports separated with a dash, for example "34100-34199" or "34100, 34200-34210".
Written as a comma separated list of ports and/or ranges of ports separated with a dash, for example "34200-34299" or "34100, 34200-34210".
A port is picked when the instance is started and remembered in factorio.host_assigned_game_port, so an instance keeps the same port as long as it is still free.
Starting an instance fails if all ports in the range are taken.
Defaults to "34100-34199".
Defaults to "34200-34299", which leaves out 34197 used by controller.player_proxy_port.
Host configs created by older versions of Clusterio have "34100-34199" saved, which includes 34197.
Ports in use by another process are skipped when assigning, so this only conflicts if the host is started before a controller on the same machine.
### host.factorio_username
+5 -3
View File
@@ -15,13 +15,15 @@ Players then only need to know one address, and instances that are stopped are s
## Enabling the proxy
Set [controller.player_proxy_port](configuration.md#controllerplayer_proxy_port) to the UDP port to accept players on and restart the controller:
The proxy listens on UDP port 34197, the default port of Factorio servers, unless [controller.player_proxy_port](configuration.md#controllerplayer_proxy_port) is changed.
Set it to null to turn the proxy off:
npx clusteriocontroller config set controller.player_proxy_port 34197
npx clusteriocontroller config set controller.player_proxy_port null
Make sure the port is reachable from the Internet and is not in the `host.factorio_port_range` of a host running on the same machine as the controller.
Make sure the port is reachable from the Internet.
The controller connects to the game port of the instances from the address the host connected to the controller from, so the game ports of the instances must be reachable from the controller.
Instances behind the proxy should have `visibility.public` turned off in their `factorio.settings`, otherwise they are listed in the server browser with their own address in addition to the proxy.
If the port is taken, for example by an instance of a host on the same machine, the controller logs an error and runs without the proxy.
## How players are routed