In other languages: English

Multijugador

From Official Factorio Wiki
Jump to navigation Jump to search


Players colored preview.png

Además del modo para un solo jugador, Factorio también ofrece un modo multijugador, permitiendo a muchos Jugadores cooperar y ayudarse mutuamente, o trabajar en contra de cada uno en PvP. Esta página documenta cómo configurar una partida multijugador, cómo unirse a una, y las funciones de administración para gestionar tanto el servidor como a otros Jugadores. Por defecto, las partidas multijugador ejecutan el escenario de juego cooperativo Modo libre donde todos los Jugadores trabajan juntos para lanzar un cohete con un satélite al espacio. Otros escenarios, incluyendo mapas PvP, están disponibles para descargar desde el foro de Mapas y Escenarios.

Configurando una partida multijugador

Una partida multijugador.

Es posible unirse a una partida multijugador, alojarla mientras juegas o alojarla en un servidor dedicado. Las partidas multijugador pueden ser anunciadas a otros jugadores en la misma red LAN o globalmente.

Para comenzar a jugar una partida multijugador, selecciona el botón Multijugador del menú principal. Luego, elige una de estas opciones para alojar y jugar:

Albergar una nueva partida: Especifica el escenario deseado, ajusta la configuración del generador de mapas, y establece las etiquetas del servidor. Las etiquetas del servidor determinan cómo se anunciará tu partida a otros jugadores. Puedes elegir entre:

    • Público: Tu partida aparecerá en la lista de partidas públicas.
    • Steam: Habilita o deshabilita la función “Unirse al juego” a través de Steam.
    • LAN: Tu partida aparecerá en tu red local.

Alojar una partida guardado: Elige una partida guardada de la lista y establece las etiquetas del servidor como se indicó anteriormente.

Para unirte a una partida existente, elige una de estas opciones: Buscar partidas públicas: Busca y únete a cualquier partida pública que cumpla con tus criterios. Buscar partidas LAN: Únete a cualquier partida que se aloje en tu red local. Conectar con dirección: Únete a cualquier partida ingresando la dirección IP del servidor. Esta opción es útil si el anfitrión no utiliza ninguna etiqueta de servidor.

Notas y consejos:

  • Todas las instancias del juego deben ser exactamente iguales teniendo la misma version del juego y mods.
  • Los servidores de Factorio usan el puerto 34197. El puerto puede ser cambiado en el archivo de configuración.
  • Factorio utiliza Sólo UDP. El juego crea su propia capa de "entrega confiable" basada en el protocolo UDP para lidiar con problemas de reordenamiento de pérdida y reordenamiento de paquetes.
    • Asegúrate de configurar correctamente el reenvío de puertos (apertura de puertos/port forwarding) de tu router para el puerto 34197.
    • Asegúrate de que tu router no aleatorice el puerto de origen en los paquetes salientes desde el 34197. Algunos routers lo hacen y requieren una configuración adicional para evitarlo.
    • Asegúrate de que no haya ningún firewall o antivirus bloqueando los paquetes UDP.
  • El límite duro para el número de jugadores es 65,535. Sin embargo, el límite práctico para esto es mucho menor, algunos streamers populares han logrado conectar a cientos de jugadores en una misma partida.

Servidor dedicado/headless

A partir de la versión 0.12.0 de Factorio, se puede iniciar un servidor dedicado (o headless) utilizando el parámetro --start-server en la línea de comandos. Puedes utilizar el parámetro --help para obtener una lista completa de los parámetros que Factorio acepta.

En el modo headless:

  • No se inicializan los gráficos (inicia más rápido, consume menos memoria, funciona en servidores sin interfaz gráfica)
  • El juego comienza inmediatamente y carga el archivo de guardado que se ha colocado como argumento en los parámetros
  • El servidor no tiene personaje en el juego
  • El juego se pausa mientras no hay jugadores conectados (aunque esto puede ser anulado usando la opción no-auto-pause en el archivo server-settings.json)
  • La partida se guarda al salir (y se guarda automáticamente de forma normal)

A partir de la versión 0.13 se espera que --start-server sea seguido por una ruta a un archivo de guardado.

Necesitaras crear tu archivo de guardado antes de iniciar el servidor, ya que el servidor dedicado REQUIERE que se proporcione un archivo de guardado. Esto se puede hacer fácilmente utilizando el parámetro de la línea de comandos --create. Por ejemplo:

./bin/x64/factorio --create ./saves/partida.zip       # Esto crea un nuevo archivo de guardado como si hubieras hecho click en el botón ''Nuevo Juego'' en la interfaz grafica
./bin/x64/factorio --start-server ./saves/partida.zip # Esto inicia un servidor que alojará el archivo creado con el comando anterior

Hay varios archivos de configuración JSON que Factorio puede utilizar para cambiar la configuración del servidor y del mapa:

  • map-gen-settings para establecer parámetros utilizados por el generador de mapas como ancho y alto, frecuencia y tamaño de los parches de mineral, etc. (Añadido en versión 0.13)
  • map-settings para controlar la propagación de la contaminación, la expansión y evolución de los biters, y más (Añadido en la versión 0.15)
  • server-settings consolida múltiples opciones de la línea de comandos en un solo archivo (Añadido en la versión 0.14.12)

Los archivos de ejemplo para cada uno de estos parámetros están incluidos en el subdirectorio data, y también son visibles en el GitHub de Wube aquí: https://github.com/wube/factorio-data


Los parámetros --map-gen-settings y --map-settings deben ser utilizados junto a --create cuando creas un nuevo mapa. Por ejemplo:

./bin/x64/factorio --create saves/partida.zip --map-gen-settings my-map-gen-settings.json --map-settings my-map-settings.json

Iniciar el servidor de factorio requiere que especifiques la ubicación del archivo server-settings.json que se encuentra por defecto en la carpeta data de factorio. Por ejemplo para iniciar factorio utilizando la partida más reciente, ejecutarías:

./bin/x64/factorio --start-server-load-latest --server-settings ./data/server-settings.json

En Windows puede ser útil iniciar el servidor con un archivo .bat. El archivo debe poseer el siguiente contenido:

start /wait .\bin\x64\factorio.exe --start-server-load-latest --server-settings .\data\server-settings.json

Mira Command_line_parameters para más parámetros de la línea de comandos.

Configurando un servidor de Factorio en Linux

Nota: Factorio ahora require glibc versión 2.18, pero CentOS/RHEL 7 solo viene con la versión 2.17 por lo que esta guía ya no funcionara sin compilar manualmente glibc 2.18.

Esta guía paso a paso ha sido verificada en instalaciones nuevas de CentOS 7 y RHEL 7, pero debería ser aplicable con pocas o ninguna modificación en la mayoría de las distribuciones.

Esta guía asume que instalarás el servidor headless en /opt/factorio, ajusta las rutas según tu propia configuración. También sugerimos que ejecutes el servidor de Factorio como un usuario separado para fortalecer la seguridad de tu instalación.

Ten en cuenta que hay dos paquetes distintos para Linux que se pueden usar para ejecutar un servidor headless. El primero es la descarga habitual de Linux, que contiene el juego completo. El otro es el paquete especial headless. El paquete headless no contiene archivos que son irrelevantes para un servidor puro, como gráficos y sonidos. Tampoco está vinculado a bibliotecas que pueden no estar presentes en una máquina de servidor, como Xlib, libGL o libasound. Esta opción debe seleccionarse si se ejecuta en un servidor alojado por terceros.

Esta guía no toca el tema del firewall/reenvío de puertos ya que esto se puede hacer de varias maneras en Linux (asegúrate de leer cómo se hace esto como administrador de Linux en tu distribución).

Instalación básica

  • Descarga el paquete seleccionado, ya sea el juego completo o el paquete headless, y sube el paquete Linux tar.gz o tar.xz al directorio /tmp de tu servidor.
  • Extrae el paquete en /tmp a /opt/factorio
$cd /opt/

$sudo tar -xzf /tmp/factorio.tar.gz # utiliza el nombre de archivo correcto, Incluye el número de versión de factorio.
$sudo tar -xJf /tmp/factorio.tar.xz # si descargaste un archivo .tar.xz (ver 0.15.x)
  • Agrega un nuevo usuario a tu sistema y asigna la propiedad del directorio factorio a el mismo (por favor, no lo ejecutes como usuario root, puede ser necesario sudo)
$useradd factorio
$chown -R factorio:factorio /opt/factorio
  • Prueba el binario
$su factorio
$/opt/factorio/bin/x64/factorio --start-server savename

¡Mientras falle diciendo que no puede encontrar/abrir savename.zip estás listo! Solo sube una partida desde tu propia computadora y colócala en el directorio /opt/factorio/saves, o usa el argumento --create ./saves/newgame.zip.

Cómo publicar en el servidor de emparejamiento una partida alojada en un servidor

Para publicar la partida en el servidor de emparejamiento, Factorio necesita recibir más información que solo la ubicación del archivo de guardado. Esta información se proporciona en un archivo de configuración del servidor.

Para crear un archivo de configuración del servidor, mira el archivo de ejemplo ubicado en data/server-settings.example.json en el Directorio de la aplicación de Factorio. La forma recomendada es hacer una copia de este archivo de ejemplo y editar la copia.

Los siguientes valores pueden ser cambiados:

Name
Este será el nombre bajo el cual el servidor aparecerá en la lista de partidas publicas.
Description
Una descripción de tu servidor. Puede contener hasta 5000 caracteres. MP server description.
Tags
Una lista de etiquetas de juego.
Max Players
Te permite limitar el número de jugadores que pueden estar conectados al servidor al mismo tiempo. Si no quieres límite, simplemente establece max_players en 0.
  • Visibilidad para el buscador de partidas publicas: Puede ser público, LAN u oculto.
    • Public: El servidor aparecerá en la lista de servidores públicos. Esto requiere que se completen las credenciales de inicio de sesión a continuación.
    • LAN: El servidor no aparecerá en la lista de servidores públicos, pero estará disponible a través del botón Jugar en LAN.
    • Hidden: Los clientes tendrán que conectarse usando la dirección IP del servidor.
  • Credenciales de usuario utilizando un nombre de usuario y contraseña o token de autenticación (encontrado en el sitio web de factorio o en player-data.json); Estos son necesarios si deseas hacer público el servidor. De lo contrario, pueden dejarse vacíos.
    • Por razones de seguridad, se recomienda usar el token de autenticación ya que este documento se almacena como texto plano. Aunque se debe tener en cuenta que un token de autenticación también es una información sensible, y se te aconseja mantenerlo en secreto.
  • Contraseña del servidor
    • El nombre del campo es game_password
  • Si verificar o no la identidad del usuario

(Hay valores adicionales en la v0.14 de factorio.)

Detalles técnicos de la implementación

El equipo de desarrollo ha publicado notas sobre algunos detalles técnicos relacionados con el modo multijugador en varias entradas del blog Friday Facts:

Registros DNS SRV

Factorio admite Registros DNS SRV desde la versión 1.1.67.

Esto hace mas facil tener varios servidores de Factorio en un mismo host y permitir que los usuarios se conecten a ellos con subdominios distintos en lugar de tener que ingresar números de puerto.

El nombre del servicio es _factorio y solo admite el protocolo _udp.

Ejemplo:

Dominio: wube.software
IP:     192.0.2.2
Puerto:   34197

Registro DNS:
srv-target     IN A   192.0.2.2 
_factorio._udp IN SRV 0 0 34197 srv-target.wube.software.

Ahora cuando un cliente de Factorio se conecte a wube.software se conectará en realidad a srv-target.wube.software:34197

Captura de pantalla de ejemplo:

Screenshot of SRV record settings Cloudflare dashboard.png

Entradas del registro:

  • Factorio registrará un mensaje “DNS SRV lookup returned […]” cuando encuentre un registro SRV para el dominio proveído
  • Con el registro detallado, Factorio también registrará “DNS SRV lookup for [domain] didn’t return any usable records” cuando no haya ningún registro SRV

Miscellaneous Tips

  • The key for console commands is also used initiate chat in multiplayer. To execute a command instead of chatting, you need to type /c before the command. Commands executed are visible to all players. Additionally, the multiplayer game must have been started with commands allowable for commands to work.
  • Set the player's color using the command
/color r g b

r, g and b are for red, green and blue respectively (possible values are between 0 and 1, use this site to convert colors to rgb numbers).

  • To give yourself admin access, you need to create a server-adminlist.json in the same directory as factorio-current.log. The file should contain a list of admins, like so: [ "user1", "user2" ]

This file will be created if you promote a player through the console.

Joining a Multiplayer game

As of version 0.13, players no longer necessarily have to port-forward to play with others. Players may join each other through Steam, or by just the port-forwarded host.

Players wishing to join a game may do so in multiple ways:

  • Joining by directly inputting a public IP and port into Factorio.
  • Selecting the server from the active public server menu.
  • Joining through Steam's services.
  • Playing a local LAN game.

Joining by IP

To join a multiplayer game by IP, you will need to know the public IP of a valid server. You can find this through social media, websites, or by word of mouth. After acquiring the IP and port, simply go to play -> Multiplayer -> Connect to server, and provide all the information it asks for.

If the server has been set up correctly to accept public connections, you should be able to join the game.

Joining via server list

Factorio's devs keep a list of all public servers that declare themselves to the service, allowing players to join directly through Factorio. Most of these servers will be password-requiring, but many completely public servers can be connected to. To join via server list, go to Play -> Multiplayer -> Browse public games. Provide your Factorio.com login if asked, and a list of public servers will appear. Simply select one.

Joining through Steam

Steam provides a "game invite" system, simply use that to join. You can find more info about how to use steam in it's documentation. This is the most recommended way for the average player to use multiplayer with their friends, as it allows Steam to handle everything.

Joining a local LAN game

If you have some friends on the same internet connection as you (in the same building or network), you may play a LAN game. Simply go to Play -> Multiplayer -> Play on LAN.

Connecting to a Server Behind NAT

Factorio requires that the server (in client-server mode) have a publicly accessible IP address or that all players are on the same LAN. If you are behind NAT, you must set up port forwarding (see above for port number) or use virtual LAN software such as Hamachi or Evolve.

Multiplayer games will be launched in client-server mode (also multiplayer forwarding mode). In this mode, all clients send their network traffic to the server and the server forwards the traffic to the other clients. The advantage of this is that it allows games where some players are inside a LAN and others are outside. The disadvantage may be slightly more lag as packets must travel an extra hop (through the server).

PvP

In PvP mode, players can be on different forces. Each force can have one (free-for-all) or more players (teams). Each force has its own independent research progression. Additionally, each force's Military units and structures will attack other players as enemies, unless a cease fire is set. Note that, depending on the scenario, cease fires may be unidirectional — setting a cease fire with an opposing force does not guarantee a cease fire from them in return.

To start a PvP game, you can select the 'PvP' scenario from the 'Play' menu, or download a custom scenario which also supports PvP.

After downloading a PvP scenario, you need to move it to your application directory, and create the multiplayer game using the scenario.

  1. Download the scenario and place the scenario directory in the scenarios directory within your user data directory.
  2. Launch Factorio
  3. Click Play
  4. Click Multiplayer
  5. Click Scenario
  6. Choose the PvP scenario you want and click Create
  7. Choose latency and other settings, then click Play
  8. Other players can now join the game

Forces

Forces can be manually created via the console. This allows any map/scenario to be used for PvP. This may not be as convenient as a pre-made PvP scenario, as there will be no way for players to turn on/off cease fires other than through the console.

Each created force has its own research progression and different forces may attack each other.

The console commands for setting up and controlling forces are below:

game.create_force("Name")
--Creates the force "Name"

game.players["Player_name"].force = game.forces["Name"]
--Sets this player to the new force

game.forces["Name"].set_cease_fire("Other_force_name", true)
--Sets the new force ceasefire to the "other force"

game.forces["Name"].set_spawn_position({x = 10, y = 20}, game.surfaces[1])
--Sets the spawn position of the force

game.print(#game.forces)
--Prints the number of forces

for name, force in pairs (game.forces) do
   game.print(name)
end
--Prints the name of all the forces

The ability of players and entities belonging to one force to interact with structures belonging to another, non-friendly force is limited. However, some types of interactions are still possible:

Manual pickup from belts
Players can pick up items traveling along a transport belt that belongs to an opposing force. Note however that this can't be automated: Inserters will not take items from an opposing force's belts.
Belt network connection
Belts will connect to each other regardless of force membership, so it's possible to extend an opposing force's belt line, and items will flow to them. It is also possible to side-load into, and place items onto (with inserters) an opposing force's belt line.
Fluid network connection
Pipes (and storage tanks, and pumps, &c) will connect to each other regardless of force membership. For example, it's possible to pump fluids out of or into a storage tank belonging to an opposing force.
Power leeching
Players can draw power from an opposing force's electric network, by building structures inside the coverage area of a power pole belonging to an opposing force. Power poles that you build next to a power pole belonging to an opposing force will automatically connect to it, but will be impossible to connect or disconnect manually.

History

Narrative history

Because of the potentially immense amount of activity on a map, the game engine utilizes a lock step architecture. All instances of the game run full simulations of the entire world and only player actions are transferred across the network.

Multiplayer games were introduced to Factorio with version 0.11.0. The only connection method available was peer-to-peer mode which meant every player had to be able to directly communicate with every other player. In version 0.12.4, a client-server mode of communication was introduced in which the server (either a dedicated one or the player who hosted the game) relays messages to all peers. This means that direct connection between all players is no longer necessary. As of version 0.13, P2P connecting is completely removed.

As of version 0.12.0, the game features "latency hiding" mechanics where the game simulates some of the player's actions locally to make some common interactions (such as moving the player's character) more fluid. Not every action is a part of latency hiding – most notably, car or train driving and shooting are not a part of it.

Version history

Maintainer note: The following history may not be fully up to date, or comprehensive. Factorio's multiplayer has undergone a great deal of small changes since its inception, however this history will provide a rough overview.

  • 0.14.14:
    • Added multiplayer server option "Autosave only on server".
    • Deconstructing/canceling deconstruction sets the "last user" on an entity.
    • Decreased the size of connection accept message with lot of mod which could help some people with 50+ mod multiplayer games.
  • 0.14.13:
    • Reconnecting to multiplayer game that the player is already in (due to being dropped, most often) instantly closes the previous connection and connects the player.
  • 0.14.11:
    • Multiplayer user names can only consist of letters, and -_. characters.
  • 0.14.10:
    • Disabled 32bit (x86) multiplayer. All hosts and members must be running the 64bit (x86_64) version of the game.
  • 0.14.8:
    • More than 10 players in one game will reduce the rate the game is saved to the server.
  • 0.14.6:
    • Username is now set to username setting, not email.
  • 0.14.5:
    • Added AFK Auto kick interval to multiplayer host settings (with never as default).
  • 0.14.3:
    • When save of scenario is loaded in multiplayer, it's scenario is saved in user scenarios.
    • Added /time command to print the current map age.
    • Added option to host multiplayer game with scenario (it only had new game/load game there).
  • 0.14.2:
    • Can specify limit of upload speed when hosting.
  • 0.14.0:
    • Server doesn't stop/slow down the game when some client is too slow, stops communicating or saves the game longer than the server.
    • Players automatically quit game after 3 desyncs.
    • Removed the option to enable/disable latency hiding, it is always on on clients (and off on the server).
  • 0.13.10:
    • Server stdout messages now contain time stamps and message-type tags
  • 0.13.2:
    • Limit multiplayer player name to 60 characters.
  • 0.13.0:
    • Improved Multiplayer game UX
    • Server games are published to the server and clients can browse existing games.
    • Removed multiplayer peer-to-peer mode.
    • Building sound is played also for other players in multiplayer.
  • 0.12.30:
    • Mod checksums are calculated when the game starts and are compared with other peers when joining a multiplayer game. This is to ensure everyone has exactly the same mod in order to prevent desyncs caused by local changes made to mod files.
  • 0.12.28:
    • Added --port to specify which network port the game should use, when hosting with --start-server or --mp-load-game.
  • 0.12.27:
    • The report of different mods when trying to connect to multiplayer game is now scroll-able when needed.
    • Better message when the server leaves a multiplayer game
  • 0.12.11:
    • Added --no-auto-pause: When running as a server, --no-auto-pause will prevent stopping the game when no players are connected.
  • 0.12.9:
    • Added resume button to multiplayer game menu
  • 0.12.7:
    • New command line options for the headless server: --disallow-commands and --peer-to-peer
  • 0.12.5:
    • Multiplayer broadcast (heartbeats) is done via a single message when not using peer2peer.
    • Further optimizations in size of the Multiplayer heartbeat (message sent every tick).
    • LatencyState is suspended when player is killed (and waiting for respawn) in Multiplayer.
  • 0.12.4:
    • Simple mechanism for multiplayer relaying via the server.
    • Less annoying glitches when running and shooting in multiplayer with latency hiding.
  • 0.12.0:
    • Multiplayer latency hiding (gives impression that some common tasks are performed immediately)
    • Factorio can run as a dedicated server without graphics.
    • Basic PvP: New forces can now be created and merged back together; a cease-fire can be agreed upon between forces
    • IPv6 support for multiplayer.
    • DNS names can be used when connecting to multiplayer game.
    • Player's logistic filters are now remembered after respawn in multiplayer
    • Smaller multiplayer heartbeat packet size.
  • 0.11.19:
    • Multiplayer dropping threshold is doubled during map upload / download.
  • 0.11.17:
    • Autosaves in multiplayer are performed at the same time by all clients (interval is set by hosting player).
    • Progress bar is shown when non-responsive peers are about to be dropped from the game in the Multiplayer.
    • Progress bar is shown when other peers in multiplayer are saving map.
  • 0.11.16:
    • Revived character (after dying in multiplayer) are placed on the spawn point instead of the center of the map.
  • 0.11.2:
    • Mods that don't affect game state are not needed to be synchronized when playing multiplayer game or replaying game.