Loading...
  OR  Zero-K Name:    Password:   

Help Wanted: Zero K Offline LAN Server

4 posts, 734 views
Post comment
Filter:    Player:  
sort
I understand that this is a niche request but any help or information is appreciated.
Please correct me on whatever I am getting wrong, thanks!

My goal:
- Find some method of hosting a Zero-K game without an internet connection using local servers and local network.

What I have so far:
- I have compiled Zero K Infrastructure locally. (https://github.com/ZeroK-RTS/Zero-K-Infrastructure)
- But I am unsure how to use it, specifically ZkLobbyServer, which sounds like exactly what i'm looking for.
- A Linux VM running Uberserver, connected to my LAN. (Pingable)
- The Steam version and Portable .zip versions of Zero-K.
- SpringLobby as an almost-functional Lobby Client.

As far as I know:
- Zero-K has no in-build method of connecting to a Skirmish via IP Address.
- Zero-K uses Lobbies to orchestrate multiplayer games.
- The official Zero-K lobby servers run on Uberserver. (https://github.com/spring/uberserver)
- Chobby serves as the Lobby Client for Zero-K.

chobby_config.json file:
{
"server" : {
"address" : "zero-k.info",
"port" : 8200,
"serverName" : "Zero-K",
"protocol" : "zks"
},
"game" : "zk"
}

I have edited chobby_config.json (and deleted LuaMenu folder, which is derived from chobby_config.json) to redirect Zero-K to my Uberserver by typing the local IP instead of "zero-k.info".

Uberserver detects a connection from Zero-K, which is printed to the server log, but does not login the user, despite valid credentials (visible in server.db). Zero-K says "Connecting..." for 30 seconds before retrying to connect. This goes on forever.

Zero-K's infolog.txt prints this every 30 seconds after connecting to Uberserver:
"[t=00:00:09.157264][f=-000001] [liblobby] Error: No such function: TASServer, for command: TASServer 0.36 * 8201 0"
Maybe this points towards a protocol mismatch? I'm not sure how to verify or fix.

Interestingly, the deprecated (afaik) SpringLobby program connects to Uberserver perfectly fine using the same credentials. It can use chat and host new lobbies. The problem with SpringLobby is that I cant seem to get it to run Zero-K properly. The actual game never properly starts.

I have also tried to figure out ZkLobbyServer, which is available as part of Zero-K Infrastructure (https://github.com/ZeroK-RTS/Zero-K-Infrastructure). I have compiled it, but it compiles into .dll files only, nothing directly executable. I haven't found any information online about what program, if any, could implement these .dll files to potentially host a lobby server.

Questions:
1) Are there files or configurations that must be applied to Uberserver which would allow it to work with Zero-K?
2) Is SpringLobby capable of working with modern Zero-K?
3) How is ZkLobbyServer supposed to be used?

Any information to point me in the right direction is MUCH appreciated!

Thanks for any input! If I can figure this out I will post a full explanation on how to reproduce a functional server.
+0 / -0
quote:
- Zero-K has no in-build method of connecting to a Skirmish via IP Address.

Not quite. Steam Coop works by telling the host the names of player to expect, then having Steam abstract a P2P connection so it just looks like connecting to an IP address. The easiest way of enabling LAN multiplier (up to the functionality of Steam Coop) would be to add some sort of UI for setting up players on the host computer and having a UI to enter an IP address to connect to for the clients. No lobby server code would come into it.

The main drawback of Steam Coop is the lack of game modes. I wasn't going to spend time duplicating the entire lobby server when hosting on it works fine. The main purpose was to enable the coop campaign. This isn't an intrinsic limitation though, it would just take work to set up.

The hosting system is well abstracted in the sense that the whole thing passes through a startscript. The entirety of the game is determined by the contents of this script. The _script.txt file contains the last game you started. Starting the appropriate spring.exe of an engine subfolder with a script file as an argument (and with the directory set to the root ZK directory) will make the game happen with that script. We used to drag script.txt onto spring.exe to reconnect to game. Calling one of a few Spring callouts with a string containg the same format of script will relaunch into that game from within the same exe - this is how the ZK lobby works.

Connecting requires this information: https://github.com/ZeroK-RTS/Chobby/blob/master/libs/liblobby/lobby/lobby.lua#L87
(The password is a one-time password the server sends to the clients when it lets them know it is time to connect, to prevent people connecting to the game using other peoples names, causing confusion and ending up on the wrong team)

Hosting (and local singleplayer) looks like generating a script that defines the game: https://github.com/ZeroK-RTS/Chobby/blob/master/libs/liblobby/lobby/interface_skirmish.lua#L53
Clients get the information about the game from the host. The campaign generates a script elsewhere to setup all the campaign stuff.

Setting up your own scripts and running them seems like a decent thing to test. From there some sort of lobby UI to do this could be created.

quote:
1) Are there files or configurations that must be applied to Uberserver which would allow it to work with Zero-K?

Unlikely. There is/was an Uberserver protocol in the lobby in parallel that was/is for BAR purposes, but they seem to have made their own server now so it is probably unmaintained. In any case, ZK was never tested with it.

quote:
2) Is SpringLobby capable of working with modern Zero-K?

Maybe, if you're just trying to host a game then I don't think ZK does anything more than the old servers. The fact that Steam Coop worked prettymuch immediately means that the battle rooms on the lobby server aren't setting any special options. You will have to make it use the correct engine version though.

quote:
3) How is ZkLobbyServer supposed to be used?

I haven't worked on it, but it's so large and integrated with everything then I expect it is meant to be used as the main ZK site and lobby. It doesn't look standalone to me.
+0 / -0
I can confirm that it's possible to host a game on LAN by running some of the projects in Zero-K-Infrastructure since I did so for testing a while ago. That git repository alone is sufficient to host a game of modern Zero-K using Chobby.

My only source was https://zero-k.info/mediawiki/Zero-K:Developing#Modifying_infrastructure.2Ftools,
unfortunately I didn't write down the exact projects needed though it should be fairly straightforward if you've successfully compiled everything (I have a memory of needing to run both ZkLobbyServer and ZeroKLobby but that could have been an artifact of what I was testing at the time).
+0 / -0
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.
+1 / -0