Multiplayer developer guide

From FreeSpace Wiki
Jump to: navigation, search

Developing FSO's multiplayer is filled with challenges. This is meant to be a partial guide to help SCP members set up a testing environment. This guide assumes that the developer is using Knossos, but the same results can be achieved with the command line. Also, a single computer can be used for multiple instances of FSO.


There is no known network-based hard limit on the number of instances that can connect on a single computer: just make sure that the instances are all using different ports.


PXO

It is recommended to use PXO since it cuts out the guess work of copying the IP address correctly into FSO settings. To register, go to https://pxo.nottheeye.com/ and create an account. Verify your email. If your verification email does not show up, please contact Taylor, the PXO admin.


Once your email is verified, you can copy and paste the username and password from the PXO profile page into the multi tab of your FSO settings. (with the standard keyboard shortcuts)

  • Note: this is not the user name and password you use to log into the PXO website, but the login given to you by the PXO server on your PXO profile. Double check that PXO is enabled and then go to the ready room in multi mode. You should be able to get to log into the PXO chat.


Setting Up a Server And Port Forwarding

In order for your game to be visible to others, your chosen port must be forwarded. Prior to FSO 21.0, FSO could only connect to the server if it was on port 7808. Otherwise it would just not be visible to any clients, but any port selected through knossos can now be used.


FSO now has the ability to attempt to forward ports automatically, although it often fails. To check if your game is visible to clients, a PXO enabled game server will show up on the PXO server list, accessible by PXO admins. An in-game indicator of game visibility is planned but not yet implemented.


If you look up the instructions for forwarding a port on your router, it should be a simple set of changes. Again, port 7808 is no longer required, but that is the default port.


Issues with NAT

If you have unexplained issues getting a server to show up, check to see if your ISP uses carrier grade NAT. If your ISP uses it, your ports cannot be properly forwarded.


It may be better, in this case, to turn PXO off and to set simply set the local IP address and port in the the multi tab of the settings screen in the following format: 192.168.0.1:7808

  • Using the local IP address will circumvent issues with your ISP locally, but you will be unable to host games with players on another network.
  • The mDNS (LAN library) implementation in FSO will also hopefully circumvent issues with NAT for local instances.
  • PXO is a per pilot setting (although only one PXO login is stored in FSO's config at a time). If you want to only connect to PXO during non-testing games, creating a few new non-pxo pilots may be an option to consider.


Setting up instances

As previously mentioned more than one instance of FSO multiplayer can run on a machine. In order to accomplish this, open your knossos settings and set your port to the forwarded port. Don't forget to hit save. Run your chosen mod in windowed mode, and then go to the multiplayer pilots mode in the pilot select screen. Then go to the ready room.


You should see the PXO chat screen. On the bottom right, you can press continue and then on the next screen start a server. You may want to add a password in case the testing should not be interrupted, but I have never had a problem with other players entering my servers.


Now, go to knossos settings again and select a different port. This port does not have to be forwarded. Every once in a while, knossos may ignore your changes, and you may get an error message when trying to connect your second instance. Please repeat this step until that bug no longer occurs. This should not happen more than once, and the likelihood of the bug goes down when you explicitly type the port number instead of relying on the knossos/FSO default.


Open the same mod, but select a different pilot. (there is a bug involving the mission log if there are pilots with duplicate names, it is being worked on) Once you are past the PXO screen, you should see your server up and running.


Select and server and join, and enjoy your round of testing!