===============================================================================
  FORTS LIVE STREAM  --  HOST A BROADCAST
  Designed by   BitrotDeamon (Destruco , IAmDestructoMan) and  Claude
  Download      www.forts-tools.com
===============================================================================

YOU ARE HOSTING, NOT WATCHING
-----------------------------

This package is for the person running a broadcast -- the one playing the match
or carrying it. If you only want to WATCH a match, you want the OTHER download,
the viewer, from www.forts-tools.com. Nothing here is needed to watch.

WHAT IT IS
----------

One person plays a Forts match. Other people watch it in their own copy of the
game, on their own machines, while the match is still going on -- roughly a
minute behind, in real time. This package is the two programs the playing
machine runs to make that happen.

There is nothing to install. Two small programs, two settings files, and one
port. No runtime to download, nothing added to the game, and no change to how
the person playing plays.

WHICH PROGRAM DOES WHAT
-----------------------

  relay.exe     the meeting point. Takes the match from the player and hands
                it to everyone watching. This is the ONLY program anything has
                to connect TO, and so the only one a port has to reach. It
                normally runs on the player's machine, but it does not have to
                -- see PORT FORWARDING below.

  host.exe      sits on the player's machine and sends the match to the relay
                as it is played. It only reads the folder the game saves
                matches into. It never touches the game.

Keep each .ini file next to its own program -- that is where each program looks
for it.

RUNNING IT
----------

  1. Run run_host.cmd. Two windows open. One says it is waiting for a match;
     the other prints the address watchers need.
  2. Start the match as normal.
  3. Give the watchers that address -- they put it in their own viewer. They can
     join at any time and always see the match from its beginning.

Each window says what it is doing in plain words: whether a match is being sent,
and how many people are watching.

The sender stops about a minute after a match ends, so run run_host.cmd again
for the next match.

===============================================================================
  PORT FORWARDING  --  READ THIS ONE
===============================================================================

Everything here uses ONE port, and by default it is TCP 47800.

The important part, because it is the thing people get wrong:

  * ONLY the machine running relay.exe needs a port opened. Nothing else does.
  * Everybody else -- the player, and every watcher -- only makes OUTGOING
    connections, which need nothing opened, nothing forwarded and no change to
    any router.

So there is exactly one machine to set up, and it is whichever machine runs
relay.exe. That is normally the player's machine.

The port number must be the SAME in all the settings files: port in host.ini,
port in relay.ini, and port in each watcher's observer.ini. If they disagree,
watchers sit at "Connecting" forever and nothing says why.

-- On the same home network (everyone in the same house) --

No port forwarding is needed at all. You only have to let Windows accept the
connection on the machine running relay.exe:

  Windows Defender Firewall -> Advanced settings -> Inbound Rules
    -> New Rule... -> Port -> TCP -> 47800 -> Allow the connection

Windows often asks this the first time you run relay.exe, as a pop-up about
allowing the program on your network. Saying yes there does the same job. If you
said no by accident, add the rule by hand as above.

Watchers then use the player machine's LOCAL address, in the form 192.168.x.x.
The relay's own window prints the address to use, so read it off there rather
than hunting for it.

-- Over the internet (watchers somewhere else) --

Now the relay machine has to be reachable from outside, and that is what port
forwarding means. On the router that machine sits behind:

  1. Give the relay machine a fixed local address, so the rule cannot drift
     onto a different machine later. Most routers call this DHCP reservation
     or static lease.
  2. Add a port forwarding rule:
       protocol       TCP
       external port  47800
       internal port  47800
       internal IP    the relay machine's local address, e.g. 192.168.0.10
  3. Keep the Windows firewall rule above as well. Forwarding gets the
     connection to the machine; the firewall decides whether it is let in.
     Both are needed, and only one of them being done is the usual reason this
     appears not to work.

Watchers then use the relay machine's PUBLIC address -- the one a "what is my
IP" page shows you when you look it up on the relay machine, NOT the 192.168.x.x
one.

Three things worth knowing before you rely on it:

  * Most home connections change their public address from time to time. If
    watchers could connect yesterday and cannot today, check the address first.
    A free dynamic-DNS name avoids having to tell everyone again each time.
  * Some connections cannot be forwarded at all. If your provider puts you
    behind their own shared address -- often called CGNAT -- no rule on your
    router will help. Two ways round it: ask your provider for a normal public
    address, or run relay.exe on a machine that can already accept connections,
    such as a cheap rented one, and point both the player and the watchers at
    that. The relay does not have to be near the player.
  * Forwarding a port means anyone who knows your address can connect to it.
    This one only ever hands out a match that is being played, but if that
    matters to you, close the rule when you are not using it, or run the relay
    somewhere else.

===============================================================================

WHAT EACH MACHINE NEEDS
-----------------------

  * The player's machine needs nothing special at all. host.exe only reads the
    folder the game saves matches into -- it never opens or changes the game.
  * Everyone must be on the SAME version of the game. Steam updates on its own,
    so this can change without anyone doing anything.
  * Each watcher needs their own installed and OWNED copy of the game, with
    Steam running. That is their side, and the viewer package covers it.

If a folder in any of your paths has an accented letter, save the settings file
as ANSI (Notepad: File > Save As > Encoding). Modern Notepad saves UTF-8, and
the program will tell you if that is what went wrong rather than just saying the
folder is not there.

===============================================================================
  www.forts-tools.com
===============================================================================
