1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
|
<?xml version="1.0"?>
<FILE TITLE="Network game">
<CHAP TITLE="Basics">
<TEXT>
Since release 5.4.0, Liquid War includes network support, that's
to say that people can play over a LAN (Local Area Network).
However, due to limitations in Liquid War's legacy code,
and also because of the lack of time I have, it might be a little
tricky to set up a network game at first. So please read this
section carefully.
</TEXT>
<TEXT>
You should keep in mind that:
</TEXT>
<LIST>
<ELEM>
DOS only releases of Liquid War do not include network support,
only Windows and GNU/Linux versions will allow you to set up a
network game.
</ELEM>
<ELEM>
The game should run fine on any LAN, but there's no garantee the
game will be playable on the Internet. Indeed if your "ping delay"
is not good enough, the game will be awfully slow. Bandwidth
is not an issue, since Liquid War rarely needs more than 2 Kb/sec.
</ELEM>
<ELEM>
You'll need to know what an IP address is.
</ELEM>
<ELEM>
You don't need to set up a network game to run a multiplayer game.
Liquid War was originally a multiplayer game without network support.
Network support is here only for people who don't feel comfortable
when playing at 6 on the same keyboard 8-)
</ELEM>
</LIST>
</CHAP>
<CHAP TITLE="Getting started">
<PART TITLE="What do you need?">
<TEXT>
You'll basically need 2 computers connected on the same LAN.
We'll call them computer A and B. You might be able to play
over the Internet too, but the game can be harder to set up
and - which is worse - very slow.
</TEXT>
<TEXT>
You'll also need to know the IP address of computer A.
Type "ipconfig" under Windows or "ifconfig" as root under GNU/Linux to
get this information if you don't have it.
</TEXT>
</PART>
<PART TITLE="Starting the server">
<TEXT>
Liquid War uses a very traditionnal client/server approach.
Basically, the server gets informations from all the clients
and then dispatches the collected information to everybody.
</TEXT>
<TEXT>
So you'll need to start a server on computer A by running
"liquidwar-server" on GNU/Linux or "lwwinsrv.exe" on windows.
This is a console application,
ie it does not set up any graphic mode.
</TEXT>
<TEXT>
Here's a small example of a server start on GNU/Linux:
</TEXT>
<CODE>
$ liquidwar-server
How many teams will connect to this server?
</CODE>
<TEXT>
At this point you must enter a number between 2 and 6, and then
press "ENTER". In this example we will answer 4.
The server really needs to know how many teams will be
in the game: when enough teams are connected, the game starts.
It's possible to skip this question by typing
"liquidwar-server -4" instead of a plain "liquidwar-server".
</TEXT>
<CODE>
Listening on port 8035...
Waiting for 4 teams...
</CODE>
<TEXT>
Now the server is ready to accept clients. By default it
listens to clients on port 8035. You could change this behavior
setting by calling "liquidwar-server -port 8061" for
instance, but let's use the default port to make things easier.
</TEXT>
</PART>
<PART TITLE="Starting the clients">
<TEXT>
Start the client on computer A normally by typing
"liquidwar" on GNU/Linux or
double-click "lwwin.exe" on Windows.
</TEXT>
<TEXT>
Go to the "Teams" menu and select 2 teams, red and blue for instance.
If you don't know how to do this, then try and play Liquid War on
a single computer first.
</TEXT>
<TEXT>
Now come back to the main menu,
and a "Net Game" button should be available. Click it.
Now you should be able to:
</TEXT>
<LIST>
<ELEM>
Start the game.
</ELEM>
<ELEM>
Change the nickname.
</ELEM>
<ELEM>
Change the IP address of the server.
</ELEM>
<ELEM>
Change the default communication port.
</ELEM>
</LIST>
<TEXT>
Since the server is also running on the same machine (A),
you can leave the default IP address as is (127.0.0.1).
Change the nickname to "A".
</TEXT>
<TEXT>
Now you are ready to start the second client on computer B.
Like with computer A, you'll have to:
</TEXT>
<LIST>
<ELEM>
Select 2 teams, green an yellow this time.
</ELEM>
<ELEM>
Select "Net Game" in the main menu.
</ELEM>
<ELEM>
Change the nickname to "B".
</ELEM>
</LIST>
<TEXT>
But this time you'll also need to change the server address,
since the client is not running on the same computer than the
server.
</TEXT>
<TEXT>
At this point, you are almost ready to play. Simply click
on "Start game" on computer A and then on computer B.
The server console should display the following:
</TEXT>
<CODE>
Waiting for 4 teams...
Connection from 127.0.0.1:3098
Accepted "A"
Waiting for 2 teams...
Connection from 192.168.1.2:3101
Accepted "B"
Talking to "A"
Talking to "B"
Game start
</CODE>
<TEXT>
And the game should start on both computers A and B.
</TEXT>
</PART>
<PART TITLE="Restart a new game">
<TEXT>
Once the game is over, you can start another network game on
the clients without touching the server, because the server
automatically restarts and waits for players to connect.
</TEXT>
<TEXT>
To restart the server - if you want to change its settings for
instance, just go to the console where it's running and press
CTRL-C.
</TEXT>
</PART>
</CHAP>
<CHAP TITLE="Options">
<PART TITLE="Server options">
<TEXT>
You can pass options to the server using the command line.
The following parameters are accepted:
</TEXT>
<LIST>
<ELEM>
"-n" where "n" is a number between 2 and 6 : with this option
you can tell the server how many teams will connect to the
game. Beware, there can be several teams on the same computer,
so if you want to have a computer with 2 players on it and 2
other computers with a single player, then you need to use the
"-4" option.
</ELEM>
<ELEM>
"-lag n" where "n" is an integer : with this option, you can
control the lag used at startup. Normally, Liquid War handles
this parameter automatically, but you might want to force it
to a given value.
</ELEM>
<ELEM>
"-port n" where "n" is an integer : allows you to change
the IP port used by the server to listen to the clients.
if you omit this parameter, the default port is (8035) is
used.
</ELEM>
<ELEM>
"-netlog" : if you use this option, the server will dump
all the network traffic on the standard output. This is
usefull for debugging.
</ELEM>
</LIST>
</PART>
<PART TITLE="Client options">
<TEXT>
The "-netlog" option works for the client too. Otherwise,
all the options can be set from the "Net Game" menu.
</TEXT>
<TEXT>
Note that when you play a network game, the settings such
as those found in the "Rules" menu must be the same on
every computer. However, Liquid War does this automatically.
But a consequence is that after a network game, your settings
might have changed if you were not on the machine from which
the settings have been taken and then dispatched to every player.
</TEXT>
</PART>
</CHAP>
<CHAP TITLE="About Liquid War's network implementation">
<PART TITLE="Basics">
<TEXT>
Liquid War uses TCP sockets, and a single-threaded server.
This implies that:
</TEXT>
<LIST>
<ELEM>
The game can sometimes get blocked if you play on Internet.
</ELEM>
<ELEM>
The server can't talk simultaneously with several clients.
</ELEM>
</LIST>
<TEXT>
I needed to use TCP sockets, since LW's algorithm can not cope
with any data loss and it's not a reasonnable to try and anticipate
what the map would be like if the player did not move etc...
</TEXT>
<TEXT>
I did not implement any multithreaded stuff since I'm lazy and
however, clients need to have informations about all the other before
something can be done. However, implementing a mutltithreaded
server could have advantages over the current solution.
</TEXT>
</PART>
<PART TITLE="What is this lag stuff anyway?">
<TEXT>
In Liquid War, all the clients send their key presses to the server,
and then the server dispatches this information to everyone.
This has to be done for every round.
</TEXT>
<TEXT>
You can easily imagine that if a player has a poor connection, with
a very long "ping delay", it can take quite a long time to send
the information to the server, and then get it back.
</TEXT>
<TEXT>
So what Liquid War does is that at the beginning of the game, the
server sends a couple of "blank" key strokes to the clients.
This way, clients receive data from the server before thay have
sent any. The number of key strokes sent at the beginning of the
game is called the "lag".
</TEXT>
<TEXT>
So if it takes 200 msec to send and then receive data from the
server (approx the time returned by the "ping" command) then
with a lag of 5, you can theorically play at a rate of 25 rounds/sec.
</TEXT>
<TEXT>
On one hand, setting the lag to a high value will avoid many network
errors and allow you to play at a very fast pace, but the big drawback
is that there will be quite a long time between the instant you send
a key stroke to the server and the moment it comes back to you.
On the other hand, setting the lag to a low value will limit
dratically he number of rounds per second.
</TEXT>
<TEXT>
However, since release 5.4.1, the "lag" is modified automatically
and should adapt itself to the situation. I've not been able to
test it in real conditions yet, but it should work 8-)
</TEXT>
<TEXT>
Still, setting the lag to a sensible default value can save you
some trouble. Indeed, by default, Liquid War will choose a value (5),
but it can not guess if you are playing on Internet or on a
100 MBit LAN, and it can take quite a long time before Liquid War
automatically finds the right value. To know the right value
which should be used with the "-lag" option, simply play a few
games and watch the average lag (which is displayed on the server
console every minute) at the end of the game.
</TEXT>
</PART>
</CHAP>
<CHAP TITLE="Troubleshooting">
<PART TITLE="General information">
<TEXT>
Network support in 5.4 is still experimental in many ways,
so you might get weird behaviors. Basically, if you have a problem,
just do the following:
</TEXT>
<LIST>
<ELEM>
Stop and restart the server when something goes wrong.
To stop it, use CTRL-C.
</ELEM>
<ELEM>
Check out that you have entered the correct IP addresses.
</ELEM>
<ELEM>
Try and start the client and the server using the "-netlog" option
to have an idea about what's happening.
</ELEM>
<ELEM>
Send me a bug report at "ufoot@ufoot.org" so that I can fix the
bugs if there are some.
</ELEM>
</LIST>
</PART>
<PART TITLE="Bugs in 5.4.x corrected in 5.4.2">
<TEXT>
Liquid War 5.4.0 and 5.4.1 were very hard to play over the Internet.
The reason is that the network routines did not do enough error
checking, and therefore there were very often errors when sending
and/or receiving the map to the server. Hopefully, this bug should not
appear anymore in 5.4.2 or any other recent release.
</TEXT>
</PART>
</CHAP>
</FILE>
|