Freejoin for Assetto Corsa early access

Allows creating servers where clients can join any time. Both server and client must be using the mod.

See here for comments.

Limitations:
- You can pick your car+skin only from free slots on the server, that the server has pre-selected to be available.
- When connecting the driver name sometimes does not change correctly.
- When a player disconnects his name remains assigned to the disconnected car.
- On the server list the connected client counter does not work right.

Download: version 1.22, see install instructions in readme.

Improvements in this version:

1.22:
- Fixed client displaying all servers as passworded
- Server now adds, enables and disables sessions automatically depending on track_cycle setting
 (set length/laps to 0 in cycle to disable session)

How to use (client):

Client troubleshooting:

After an AC update, freejoin stopped working.

If an AC update overwrites the modded files with originals you need to re-install the modded files. In some cases it is also possible a Freejoin update is required if this does not fix the issue.



Running a server:

Configuring a server:

server_cfg.ini example

Configure server normally using server_cfg.ini. The "Cars" entry is ignored. If using TRACK_CYCLE setting under [FREEJOIN] then TRACK, session lengths and race laps are overridden from the TRACK_CYCLE setting. Also RACE_OVER_TIME setting is ignored if using RESTART_AFTER_RACE_SECONDS.

The freejoin tag to the server name is added automatically as are other required settings on first run.

Under [FREEJOIN] entry in server_cfg.in you can use following settings:

[FREEJOIN]
RESTART_AFTER_RACE_SECONDS=80
ALLOW_RACE_JOIN=1
MOTD=motd.txt
TRACK_CYCLE=imola,default,1,1,3;vallelunga,bmw,1,1,2;
ADMIN_PASSWORD=secret

RESTART_AFTER_RACE_SECONDS: Restarts the server and proceeds to next track in TRACK_CYCLE after set amount of seconds when the first player finishes.

ALLOW_RACE_JOIN: Allow players to join during race session (Always can join during practice and qualifying)

MOTD: Set message of the day displayed in the server info, should be a plain text file. Can be changed while server is running.

TRACK_CYCLE: Set track cycle. Syntax is: track_name,cars_ini_name,practice_time,qualifying_time,race_laps;...
For example:

imola,default,10,30,5;vallelunga,bmw,10,30,10;monza,bmw,10,40,5
First Imola with 10 minute practice, 30 minute quali, 5 laps race, cars from cars_default.ini
Then Vallelunga with 10 laps race and cars from cars_bmw.ini, finally Monza with 40 minute quali and 5 laps race.

The second parameter is the name of car list under cfg directory. ie. "default" searches for "cfg/cars_default.ini". This file must contain a list of carname;skinname pairs which are used to generate entry_list.ini automatically. The server zip file comes with the default ini and you can create any number of them to configure in the track cycle.

If session length or race laps is zero that session is disabled completely. Any sessions missing from the cfg are added automatically, with a default WAIT_TIME value.

ADMIN_PASSWORD: Set administrator password for server. Join the server using this password to become an admin.
Admin commands:

Linux server notes:

The Freejoin server requires ability to send some UDP packets to clients as if they are coming from AC server. On Linux server it requires SO_REUSEADDR flag on the UDP socket. The run_server binary included in the zip file enables this flag using pthreads, but it can currently only work with the x86 server binary so it must be used even on x64 server. The server.py handles all this automatically but it may require some x86 libraries from the server.

Server troubleshooting:

Testing the server works

To test that everything is working fine on the server you should define an admin password, join the server with it and type !ping in the chat. You should get a "pong!" response back. If you do not and/or you get some UDP related errors on the server log then possibly something is wrong with the server config or on linux the pthreads hook has not worked correctly.

When I double click server.py a dialog flashes and disappears.
I get a syntax error when running server.py

Make sure you are using version Python 3.x. In many Linux distributions you need to run the server.py with python3 command, in Windows you may need to uninstall python 2.x versions or run with full path to python 3 exe.

My server appears in server list but displays "Server not responding" in red in the server info.

Make sure you have run the server with the python script and not directly with the server executable. Also make sure your server firewall is correctly configured for the HTTP port used by Freejoin (AC server HTTP port plus one)

I get errors about missing cfg files/not being able to start a process.

Make sure you are running the server.py from correct path where the server binary/executable is located.

Version history:

1.22:
- Fixed client displaying all servers as passworded
- Server now adds, enables and disables sessions automatically depending on track_cycle setting 
  (set length/laps to 0 in cycle to disable session)
1.21:
- Compatibility fixes for server & client
- Freejoin settings in server moved under [FREEJOIN] from [SERVER]
- entry_list.ini is no longer used to configure cars
- Server auto-restart after time period of race end (RESTART_AFTER_RACE_SECONDS setting)
- Clients should now be sent to lobby after race ends (with RESTART_AFTER_RACE_SECONDS)
- Custom track cycle for auto-restart with settings for prac,quali time & race laps (TRACK_CYCLE setting)
- Announcements in chat about server restarts
- Admin mode for server with administration commands for: changing track, next race, user list, kick user
- Server info is refreshed when returning from game to lobby
- Various fixes
1.12c:
- Fixed slot reservation time on linux server.
1.12b:
- Compatibility with linux server.
1.12:
- Compatibility with AC v0.9.11.
1.11:
- Bugfixes.
1.1:
- Filtering for servers.
- MOTD support.
- Other stuff.
1.0:
- Using special HTTP server for passworded servers and other features.
0.0001:
- First version.