FS-UAE Net Play

This document explains how to use the net play feature of FS-UAE. The net play server can be download from the download page (If you are using the development series of FS-UAE, you should download the server from the development series download page instead).

Support forum thread is here: http://eab.abime.net/showthread.php?t=63289

You might want to use the net play support in FS-UAE Launcher to initiate the net play session instead of doing it manually.

Synchronization

The emulation is designed to never get out of sync across clients, but in case it does, it will be detected by the server immediately, because:

  • A checksum of the Amiga memory contents is sent to the server for every frame (chip, slow and fast mem).
  • Random number generator synchronization is checked for every frame.

These measures do not prevent desync in any way, but are designed to detect desyncs even before humans would notice. It is there important to run with exactly the same setup on all clients:

  • Kickstart must be identical. If not, the server will detect that memory contents differ on startup and abort the game.
  • The amiga model, accuracy setting and amount of memory etc must be identical.
  • Same number of floppy drives, and exactly the same floppy images inserted into the drives (please use checksums to verify that they are the same). Remember that floppy overlay files override original disk content!

Example: If two players are trying to play Pinball Dreams, the game might boot just fine up right until the main menu, and you get a desync there. If this happens, it is because (different) highscores were stored on disk 2, and the Amiga just read the highscores into memory. I’ll say it again: use the (exact) same disks!

There can of course exist bugs which allow desyncs to happen. Please report issues to the support forum, but first ensure that your setup is identical.

Important notes

You should use net play with floppy based games for now. Hard drive support in net play is not tested, and there are probably synchronization issues due to threads being use for hard drive emulation.

Remember to make sure setup is identical! An important thing to remember is that FS-UAE stored floppy overlay files. If there exists floppy overlay files for a specific ADF/IPF file, this file must exist and be identical for each client.

Synchronized floppy swapping

You can swap floppies in the floppy drives during net play. If one player changes floppy, the same change will be done simultaneously for all players.

The floppy images themselves are not transferred across the network, so it is important that all players have the same floppy image list. The paths themselves do not need to the identicial, but floppy_image_1 must point to a disk file with identical checksum for all players. Same for all other floppy image list entries.

Synchronized state saving and restoring

You can use state saving and restoring during net play. There are several use cases for save states which must be discussed separately:

  1. Saving a state during game play to restore later during the same session. When saving a state while in net play, every player will then get a compatible save state in the given save state slot, so when later during the same session, restoring the same state should work without issues.
  2. Restoring a state which was saved in an earlier play session. If the state was saved with the same players present, everyone should have a compatible save state in the same slot (unless overwritten), and restoring the state should work.
  3. Restoring a state which is not shared by all players. This one is a bit more difficult. It should be possible to manually copy one or more save states from one player to the others, and then restore this state during net play. However, some paths are stored in the state file (floppy image paths, etc). This should work if the paths used for floppies (etc) are the same for all players. This can be achieved by using (identical) relative paths in your configuration or (identical) paths with $-prefixes (or even absolute paths if the files are stored in the exactly same location for all players).

Lag and smooth play

FS-UAE should work pretty well in this regard, by now. But playing on a wireless network is not recommended. It will work, but if there is some packet loss, the emulation will jitter, and the input lag will increase for this player.

It is important to keep packet loss to a minimum. For technical reasons, network communication must be ordered and guaranteed, so TCP is used and not UDP. When packet loss occurs, TCP will incur delays which will impact the performance of the player with lag. Other players will not be affected unless the delays are extreme. Here are some tips:

  • Avoid wireless networks. Packet loss will degrade smoothness and increase input lag. Even more important: avoid running the server on a wireless link. This can degrade performance for all clients.
  • Do not saturate the Internet link with data. Pause (or limit) torrents etc. FS-UAE itself does not use much bandwitch, but a satured link will have packet loss.

To minimize input lag, FS-UAE will control / alter the frame rate based on information from the server. This means that full video sync is not compatible and will automatically be disabled.

User interface and Chat

While using net play beta, can can press the Tab key to write a text message for other players to see. Also, a HUD will appear displaying the player tags of all connected players along with emulation lag (in ms) and ping time to server (in ms – round trip trime) for each player.

Server setup

One player must start the server, either locally, or on another computer. The server requires Python (>= 2.6) to be installed. It is now compatible with Python 3. To start the server with the defaults (2 players, port 25000), run:

python fs-uae-game-server-1.2.0.py

To start the server with other settings, you can run:

python fs-uae-game-server-1.2.0.py --port=9876 --players=3

The server will then wait until all players are connected until proceeding. When a client is connected, it will wait to start the game until all clients are ready and it gets a go from the server.

The server address/port must be directly connectable by all clients, so modify firewall / router setup as needed.

Client setup

There is no graphical user interface to launch net play (yet anyway). To connect to a server, you must use the following options (either from config, or command line).

netplay_server = ip adress or host name

The following options can be specified, but are not required:

Use custom port instead of 9999:

netplay_port = 9876

Use a custom tag (“nick name”) while playing. Will show up in the HUD:

netplay_tag = ABC

If the server is started with a password, you must specify the same password for the clients:

netplay_password = password

Keyboard input is shared by all players. Permissions for input is a feature that could be implemented later, but for now, you’ll have to trust your opponents to play fair. Generally, all input is shared, so it is possible for two players to control the same “joystick”. One player could use directional control, and the other could control the fire button.

When using joysticks, yoy most likely want to have opposite setups, for example. one player would have

joystick_port_0_mode = joystick
joystick_port_1_mode = joystick
joystick_port_0 = name of player 1's joystick
joystick_port_1 = nothing

While the second player would have

joystick_port_0_mode = joystick
joystick_port_1_mode = joystick
joystick_port_0 = nothing
joystick_port_1 = name of player 2's joystick

It is important that the Amiga thinks the same devices are connected, so all players should have the same values for joystick_port_0_mode and joystick_port_1_mode (these settings will be synchronized anyway, but with different settings, it can be a bit random which one “wins”).

If you want to play two-player lemmings with one mouse each, you should have the following configs:

joystick_port_0_mode = mouse
joystick_port_1_mode = mouse
joystick_port_0 = mouse
joystick_port_1 = nothing

and

joystick_port_0_mode = mouse
joystick_port_1_mode = mouse
joystick_port_0 = nothing
joystick_port_1 = mouse

Here is a command-line example to start net play:

fs-uae lotus2.fs-uae --netplay-server=192.168.1.5 --netplay-tag=ABC

Issues which may occur

If an unrecoverable error occurs, the server will stop, and all clients (FS-UAE) will continue running the emulation in offline mode. The most likely errors are:

  • Game out of sync (should be avoidable).
  • A player quit FS-UAE.
  • Network communication problem.

If a connection is lost, there is no mechanism for reconnecting / resuming gameplay. This is possible to implement (and the protocol include a mechanism for this), but it isn’t fully implemented yet.

Net play server

The net play server can be download from the FS-UAE download page (If you are using the development series of FS-UAE, you should download the server from the beta download page instead).

Planned or possible features

  • FS-UAE calculates and sends checksums of disk and other relevant information to the server on startup, so the server can verify that the game should be able to proceed without desyncs.
  • Access control rights. The server can be set up with rules regarding which player can send specific input events etc.
  • Ability to reconnect on network problems would be nice. Requires all protocol data to be sequenced so communication can be properly resumed (re-send data etc).
  • A game setup user interface with lobby etc would be nice (will not be part of FS-UAE but can be implemented as a separate program).

1 thought on “FS-UAE Net Play

  1. Pingback: FS-UAE Amiga Emulator: Komfortable Guru Meditation | Superlevel

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.