Thanks for the replies!
Thanks to GoogleFrog for the advice about using a script. Following that lead I was able to host a few offline LAN games using a single Ethernet cable directly connecting two PCs. These games ran perfectly fine. All UI appeared and worked properly and there was no desync. The Client only needs to use a simple script.txt (a slightly modified copy of the Hosts), but the Host needs to configure everything inside the script (AllyTeams, Teams, Players, ModOptions, AI, Chicken, IP of Interface, Port, etc.).
Here is how my LAN experience can be reproduced:
Requirements:
- A functional LAN. In my case PC1 as 10.30.0.1 and PC2 as 10.30.0.2 with an ethernet cable connecting them.
- A copy of Zero-K Portable .zip (to avoid damaging your Steam installation)
- My firewall is turned off, but if yours is turned on you might need to allow inbound connections on the Port selected for the battle Server.
Steps:
- Download Zero-K portable from itch.io (https://zerok.itch.io/zero-k).
- Unzip into a folder.
- In zero-k-portable\engine\win64 will be several Spring engine versions. Open the newest one, copy all files, paste into Zero-K portable folder. When prompted, do NOT replace any files already in the Zero-K folder.
- Open "springsettings.cfg" in Notepad. Find the line "Fullscreen=0" and replace the 0 with a 1 or else the window will not be aligned properly.
- Create a new blank file called "script.txt" in the Zero-K folder.
- Client and Host place different contents in "script.txt"
The Hosts IP Address should be the IP Address of the interface which will be used for the connection.
The Port should be anything in the range 1024-49000 (to avoid errors) and must be the same for both users.
Hosts "script.txt" file:
[game]
{
[allyteam1]
{
numallies=0;
}
[team1]
{
teamleader=0;
rgbcolor=0.99609375 0.546875 0;
allyteam=1;
}
[modoptions]
{
}
[allyteam0]
{
numallies=0;
}
[team0]
{
teamleader=0;
rgbcolor=0.99609375 0.546875 0;
allyteam=0;
}
[player0]
{
name=Bob;
rank=0;
isfromdemo=0;
team=0;
}
[player2]
{
name=Alice;
rank=0;
isfromdemo=0;
team=1;
}
numplayers=1;
gamestartdelay=0;
myplayername=Bob;
gametype=zk;
ishost=1;
hostip=10.30.0.1;
mapname=TitanDuel 2.2;
startpostype=2;
hostport=8000;
numusers=2;
nohelperais=0;
}
The clients file should all be the same except for changing "isHost=1" to "isHost=0", and changing the "myplayername" to whatever name the Host already wrote for you, in this case "Alice".
Clients "scripts.txt" file:
[game]
{
[allyteam1]
{
numallies=0;
}
[team1]
{
teamleader=0;
rgbcolor=0.99609375 0.546875 0;
allyteam=1;
}
[modoptions]
{
}
[allyteam0]
{
numallies=0;
}
[team0]
{
teamleader=0;
rgbcolor=0.99609375 0.546875 0;
allyteam=0;
}
[player0]
{
name=Bob;
rank=0;
isfromdemo=0;
team=0;
}
[player2]
{
name=Alice;
rank=0;
isfromdemo=0;
team=1;
}
numplayers=1;
gamestartdelay=0;
myplayername=Alice;
gametype=zk;
ishost=0;
hostip=10.30.0.1;
mapname=TitanDuel 2.2;
startpostype=2;
hostport=8000;
numusers=2;
nohelperais=0;
}
Once both users have the same Zero-K game folder (with the only differences being in the script.txt files), both players click and drag "script.txt" onto "spring.exe" (which are now in the same folder). The Host should do this right before the Clients, who will otherwise timeout in 10 seconds.
Zero-K should now open with both players connected to the same battle.
Only problem I noticed was that all units in-game have "Player: Bob" in their description for some reason, but both users still play on entirely separate teams (if configured to by the Host) so its not a big deal.
You might be right that the best solution to make this more user friendly would be to create some kind of application (maybe a .jar) for Hosting games and configuring battles, which then generates a valid script.txt for spring.exe to host the Zero-K battle. Then the Clients would need only a username, IP, and port.
I might try my hand at making such an applications in time.
My ideal solution would be to run a local instance of whatever lobby server software is being used for Zero-K's public lobbies, and redirect Chobby to that. In that case selecting maps, teams, spectators, AIs, and Chickens would be really easy, but maybe that will remain a fantasy.
I'll keep messing around with the Zero-K Infrastructure to see what I can do with it. I'll post again if I figure out more.