Contents |
Goal
The easiest way to play multiplayer spring on linux is to use a lobby client. See SetupGuide for instructions. If you for some odd reason decide not to use a lobby client, feel free to use the instructions below, but I don't see any good reason to do so.
The spring engine currently supports network play very well, however the setup without a lobby client isn't very well documented and because of this it's now documented here. This wikipage will try to help you to setup your network server (don't muddle this guide with the java server which also exists).
When do I need this documentation?
- When you want to play with more than only 1 human player, so NOT 1:1
- 1:1 matches can be setup like this:
- Create a game using: /usr/games/bin/spring, then select -> commanders -> smalldivide -> next wait a few seconds, you should see that you are the server now and that your taspring binary is waiting for connections. now do the next step:
- invoke the second computer (client) with "spring -c" afterwards you have to type the ip of the other pc and your done
- When you want to add some AI enemies (computer controlled players) you have to do some things different... read on...
The Server Setup
In the current svn taspring-linux-svn-0.72-r3 we include the unity-lobby which can be found in:
/usr/games/bin/unity-lobby
Use this program to create your profile (here called "myprofile")
You find your profile then in:
~/.unity-lobby/profiles/myprofile/
Important: Now use unity-lobby to setup your game:
- map
- add (for example 1) computer controlled players (AI based)
- join yourself to the game
- now join all other human players (say 1 other) by joining yourself (in this case 1 more time) again!
- don't forget to setup your allies and teams
Your current setup:
- 1 AIs
- 2 Human players
Press start in unity-lobby (it's in the upper right corner) BUT exit the game right after you started the game.
Now comes the tricky part:
Go into ~/.unity-lobby/profiles/myprofile/ and edit the "script.txt" which looks quite similar to the script below (altough it has been modified already to reflect a working configuration.
This script.txt contains 1x AI and 2x human players:
[GAME]
{
Mapname=Archers_Valley_v1.smf;
StartMetal=2000;
StartEnergy=2000;
MaxUnits=500;
GameType=xtape.sd7;
GameMode=0;
StartPosType=0;
MyPlayerNum=1;
NumPlayers=2;
NumTeams=3;
NumAllyTeams=2;
HostIP=192.168.100.75;
HostPort=8452;
[PLAYER0]
{
name=melix;
Spectator=0;
team=2;
}
[PLAYER1]
{
name=qknight;
Spectator=0;
team=1;
}
[TEAM0]
{
TeamLeader=0;
RgbColor=0.352941176471 0.352941176471 0.882352941176;
Handicap=0;
AllyTeam=0;
Side=Arm;
AiDLL=/usr/share/games/taspring-linux-svn/AI/Bot-libs/AAI.so;
}
[TEAM1]
{
TeamLeader=0;
RgbColor=0.78431372549 0.0 0.0;
Handicap=0;
AllyTeam=1;
Side=Arm;
}
[TEAM2]
{
TeamLeader=0;
RgbColor=1.0 1.0 1.0;
Handicap=0;
AllyTeam=1;
Side=Arm;
}
[ALLYTEAM0]
{
NumAllies=0;
}
[ALLYTEAM1]
{
NumAllies=0;
}
}
The important lines are:
- HostIP=192.168.100.75;
- HostPort=8452;
- NumPlayers=2;
- name=qknight;
- Add this for every player
- [PLAYER1]
- {
- name=qknight;
- Spectator=0;
- team=1;
- }
Again, now in detail what you have to do:
- Set the HostIP to the servers IP address and add the HostPort line.
- Set NumPlayers to 2 (for 2 human players, AI does not count)
- Set the correct name for each Player
After all your changes are done start the game like this:
/usr/games/bin/spring /home/joachim/.unity-lobby/profiles/myprofile/script.txt
or use -w for window mode:
/usr/games/bin/spring -w /home/joachim/.unity-lobby/profiles/myprofile/script.txt
The Client Setup
Now copy the script.txt file from the server to the client. We have to change only one thing:
- MyPlayerNum=1; has to be MyPlayerNum=0; or vice versa, depending on the setup you do.
Now start the game the same way you did with the server:
/usr/games/bin/spring /my/absolute/path/to/script/script.txt
Pitfalls
When calling the spring binary with the script.txt directive always use full paths NOT and I repeat NOT relative paths:
~/script.txt <- would be a relative path name /home/joachim/script.txt <- would be an absolute or full path name
