Skip to content

Latest commit

 

History

History
134 lines (93 loc) · 4.82 KB

README.md

File metadata and controls

134 lines (93 loc) · 4.82 KB

LiveSplit Server

LiveSplit Server is a LiveSplit component that allows for other programs and other computers to control LiveSplit.

Install

Consider using the latest development build of LiveSplit available at http://livesplit.org/LiveSplitDevBuild.zip. This includes the server component and any new features since the last release that applications may depend on.

Alternatively:

Setup

Add the component to the Layout (Control -> LiveSplit Server). In Layout Settings, you can change the Server Port and view your local IP Address.

Control

You MUST start the Server before programs can talk to it (Right click on LiveSplit -> Control -> Start Server). You MUST manually start it each time you launch LiveSplit.

Layout Settings

Port

Port is the door (1 of thousands) on your computer that this program sends data through. Default is 16834. This should be fine for most people, but depending on network configurations, some ports may be blocked. See also https://en.wikipedia.org/wiki/Port_%28computer_networking%29

Local IP

Local IP is the address of your computer on your network. It is needed for other computers or phones on your network to talk to yours. Programs on your computer should be able to use "localhost".

Note that this is NOT your public IP with most network configurations. In most cases, it means nothing if it is seen on stream. DO NOT search "what is my IP" on stream as that will show you your public IP.

The local IP is the "IPv4 Address" of the first connected network adapter. This is normally what clients need, but software (such as virtual machines or VPNs) may add network adapters which can appear first. If in doubt, open Command Prompt and run ipconfig. The device you are looking for is probably either "Ethernet adapter Ethernet" or "Wireless LAN adapter Wi-Fi".

Using Across the Internet

To make a public server, consider learning to set up a web server and use what you learn. It is probably wiser, safer, and easier to use an IRC bot or something else though. Look at "Known Uses" or ask around.

Known Uses

Made something cool? Consider getting it added to this list.

Commands

Commands are case sensitive and end with a carriage return and a line feed (\r\n). You can provide parameters by using a space after the command and sending the parameters afterwards (<command><space><parameters><\r\n>).

A command can respond with a message. The message ends with a carriage return and a line feed, just like a command.

Here's the list of commands:

  • starttimer
  • startorsplit
  • split
  • unsplit
  • skipsplit
  • pause
  • resume
  • reset
  • initgametime
  • setgametime TIME
  • setloadingtimes TIME
  • pausegametime
  • unpausegametime
  • setcomparison COMPARISON

The following commands respond with a time:

  • getdelta
  • getdelta COMPARISON
  • getlastsplittime
  • getcomparisonsplittime
  • getcurrenttime
  • getfinaltime
  • getfinaltime COMPARISON
  • getpredictedtime COMPARISON
  • getbestpossibletime

Other commands:

  • getsplitindex
  • getcurrentsplitname
  • getprevioussplitname
  • getcurrenttimerphase

Commands are defined at ProcessMessage in "ServerComponent.cs".

When using Game Time, it's important that you call "initgametime" once. Once "initgametime" is used, an additional comparison will appear and you can switch to it via the context menu (Compare Against > Game Time). This special comparison will show everything based on the Game Time (every component now shows Game Time based information).

Example Clients

Python 2

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("localhost", 16834))
s.send("starttimer\r\n")

Java 7+

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.Socket;

public class MainTest {

	public static void main(String[] args){
    String hostName = "localhost";
		int portNumber = 16834;

		String str = "starttimer\r\n";

		try (Socket socket = new Socket(hostName, portNumber);
				OutputStreamWriter osw = new OutputStreamWriter(socket.getOutputStream(), "UTF-8")) {
			send(str, osw);			

		} catch (Exception e) {
			// TODO: handle exception
			System.err.println(e.getMessage());
		}
    }
	
    static void send(String str, OutputStreamWriter o) throws IOException {
		o.write(str, 0, str.length());
		o.flush();
	}

}