TEXT   20

liquidwar network

Guest on 17th August 2022 02:06:41 PM

  1. Liquid War (v5.6.4) - Network game
  6. Basics
  7. ======
  10.   Since release 5.4.0, Liquid War includes network support, that's to say that
  11.   people can play over a LAN (Local Area Network). However, due to limitations
  12.   in Liquid War's legacy code, and also because of the lack of time I have, it
  13.   might be a little tricky to set up a network game at first. So please read
  14.   this section carefully.
  16.   You should keep in mind that:
  18.   * DOS only releases of Liquid War do not include network support, only
  19.     Windows and GNU/Linux versions will allow you to set up a network game.
  21.   * The game should run fine on any LAN, but there's no garantee the game will
  22.     be playable on the Internet. Indeed if your "ping delay" is not good
  23.     enough, the game will be awfully slow. Bandwidth is not an issue, since
  24.     Liquid War rarely needs more than 2 Kb/sec.
  26.   * You'll need to know what an IP address is.
  28.   * You don't need to set up a network game to run a multiplayer game. Liquid
  29.     War was originally a multiplayer game without network support. Network
  30.     support is here only for people who don't feel comfortable when playing at
  31.     6 on the same keyboard 8-)
  35. Getting started
  36. ===============
  39.   What do you need?
  40.   -----------------
  42.     You'll basically need 2 computers connected on the same LAN. We'll call
  43.     them computer A and B. You might be able to play over the Internet too, but
  44.     the game can be harder to set up and - which is worse - very slow.
  46.     You'll also need to know the IP address of computer A. Type "ipconfig"
  47.     under Windows or "ifconfig" as root under GNU/Linux to get this information
  48.     if you don't have it.
  50.   Starting the server
  51.   -------------------
  53.     Liquid War uses a very traditionnal client/server approach. Basically, the
  54.     server gets informations from all the clients and then dispatches the
  55.     collected information to everybody.
  57.     So you'll need to start a server on computer A by running
  58.     "liquidwar-server" on GNU/Linux or "lwwinsrv.exe" on windows. This is a
  59.     console application, ie it does not set up any graphic mode.
  61.     Here's a small example of a server start on GNU/Linux:
  63.     $ liquidwar-server
  64.     How many teams will connect to this server?
  66.     At this point you must enter a number between 2 and 6, and then press
  67.     "ENTER". In this example we will answer 2. The server really needs to know
  68.     how many teams will be in the game: when enough teams are connected, the
  69.     game starts. It can also be a good idea to answer 6 systematically and then
  70.     force game start by clicking the "Start now" button within the client. It's
  71.     possible to skip this question by typing "liquidwar-server -2" instead of a
  72.     plain "liquidwar-server".
  74.     Use "-2" to get rid of this question.
  75.     Register on "www.ufoot.org/metaserver/" (y/n)?
  77.     Now if we answer "y", then the server will automatically contact the
  78.     "meta-server" and it will be listed on
  79.     http://www.ufoot.org/liquidwar/v5/metaserver.php3
  81.     This can be convenient for people who want to find other gamers to play
  82.     with on the Net. For now, let's answer "n", we'll test this meta-server
  83.     stuff later 8-)
  85.     Use "-private" to get rid of this question.
  86.     2002-06-03 16:43:00: Listening on port 8035...
  87.     2002-06-03 16:43:00: Waiting for 2 teams...
  89.     Now the server is ready to accept clients. By default it listens to clients
  90.     on port 8035. You could change this behavior setting by calling
  91.     "liquidwar-server -port 8061" for instance, but let's use the default port
  92.     to make things easier.
  94.   Starting the clients
  95.   --------------------
  97.     Start the client on computer A normally by typing "liquidwar" on GNU/Linux
  98.     or double-click "lwwin.exe" on Windows.
  100.     Go to the "Teams" menu and select 2 teams, a red human and a blue CPU for
  101.     instance. If you don't know how to do this, then try and play Liquid War on
  102.     a single computer first. It's important to notice that by default the "blue
  103.     CPU" won't connect on the network game. It's possible to allow bots to
  104.     connect on network games, but they are disabled by default.
  106.     Now come back to the main menu, and a "Net Game" button should be
  107.     available. Click it. Now you should be able to:
  109.     * Start the game.
  111.     * Change the IP address of the server.
  113.     * Change the communication port.
  115.     * Set a password.
  117.     * Search for internet games automatically.
  119.     Since the server is also running on the same machine (A), you can leave the
  120.     default IP address as is (
  122.     Now you are ready to start the second client on computer B. Like with
  123.     computer A, you'll have to:
  125.     * Select 2 teams, green an yellow this time.
  127.     * Select "Net Game" in the main menu.
  129.     But this time you'll also need to change the server address, since the
  130.     client is not running on the same computer than the server.
  132.     Now click on "Start game" on computer A. The server should play a "system
  133.     beep", which is usefull if you run a server and want to be notified of
  134.     client connections without watching the console all the time, and it should
  135.     display messages like this:
  137.     2002-06-03 16:44:48: Connection from ""
  138.     2002-06-03 16:44:48: Team "Napoleon" on client "" accepted
  139.     2002-06-03 16:44:49: Client "" accepted
  140.     2002-06-03 16:44:49: Waiting for 1 team...
  142.     And on the client you should see a screen which says "Waiting for 1
  143.     team(s)" with the list of connected players below (Napoleon). You do not
  144.     need to click on the "Start now" button.
  146.     Now click on "Start game" on computer B. The server should display messages
  147.     like this:
  149.     2002-06-03 16:49:14: Connection from ""
  150.     2002-06-03 16:49:14: Team "Henri IV" on client "" accepted
  151.     2002-06-03 16:49:15: Client "" accepted
  152.     2002-06-03 16:49:15: Client "" ready
  153.     2002-06-03 16:49:15: Client "" ready
  154.     2002-06-03 16:49:15: Sending info to ""
  155.     2002-06-03 16:49:15: Sending info to ""
  156.     2002-06-03 16:49:16: Game start
  158.     And at that point, the game should start 8-)
  160.   Restart a new game
  161.   ------------------
  163.     Once the game is over, you can start another network game on the clients
  164.     without touching the server, because the server automatically restarts and
  165.     waits for players to connect.
  167.     To stop the server - if you want to change its settings for instance - just
  168.     go to the console where it's running and press CTRL-C.
  172. Using the meta-server
  173. =====================
  176.   Basics
  177.   ------
  179.     The meta-server is a piece of software which is running on my web site, and
  180.     allows servers to register themselves so that client can get a list of
  181.     available servers.
  183.     It's written in PHP and is _very_ basic but I believe it's enough for what
  184.     has to be done: maintain a list of running servers.
  186.     The source code for the meta-server is included in the source package of
  187.     Liquid War, so you might run such a server yourself if you want to.
  188.     However, by default, servers will register themselves on my web site, and
  189.     will be listed on http://www.ufoot.org/liquidwar/v5/metaserver.php3
  191.   How to register a server
  192.   ------------------------
  194.     Launch the server, and when you get the question:
  196.     Register on "www.ufoot.org/metaserver/" (y/n)?
  198.     answer "y".
  200.     Note that if you're behind a proxy or a firewall, the server might be
  201.     unable to register itself. Clients might also have problems to connect
  202.     themselves on your server if there's a machine which does NAT (Network
  203.     Address Translation) between you and the meta-server.
  205.   How to find a server
  206.   --------------------
  208.     In the main menu, click on "Net Game" and then "Search for internet games".
  210.     Now you should see a list of available servers. You can click on the items
  211.     in the list to get more informations about a given server. Once you have
  212.     chosen a server, click on "Join now".
  214.     Now you get on a "Waiting for teams" screen. You might be interested in
  215.     using the "Start now" button. Indeed, if you are 4 players connected on a
  216.     server that accepts up to 6 players, maybe you'll want to start the game
  217.     right away without waiting for 2 more players. In this case, every player
  218.     must click "Start now". A "*" character will replace the "-" in the players
  219.     list when a player clicks on "Start now". When all the players are
  220.     displayed with a "*a, the game starts.
  222.     You can also chat with other players by entering text in the area above the
  223.     "Send message" button, and then click on this button. Keep in mind that
  224.     this is a very primitive chat and that the best way to chat efficiently is
  225.     IMHO to play in windowed mode and have an IRC client at hand.
  227.     Note that you can also get the list of available servers from
  228.     http://www.ufoot.org/liquidwar/v5/metaserver.php3 There you'll also find a
  229.     little chat-box which will allow you to send exchange messages with other
  230.     players.
  234. Options
  235. =======
  238.   Server options
  239.   --------------
  241.     You can pass options to the server using the command line. The following
  242.     parameters are accepted:
  244.     * "-n" where "n" is a number between 2 and 6 : with this option you can
  245.       tell the server how many teams will connect to the game. Beware, there
  246.       can be several teams on the same computer, so if you want to have a
  247.       computer with 2 players on it and 2 other computers with a single player,
  248.       then you need to use the "-4" option.
  250.     * "-lag n" where "n" is an integer : with this option, you can control the
  251.       lag used at startup. Normally, Liquid War handles this parameter
  252.       automatically, but you might want to force it to a given value.
  254.     * "-port n" where "n" is an integer : allows you to change the IP port used
  255.       by the server to listen to the clients. if you omit this parameter, the
  256.       default port is (8035) is used.
  258.     * "-log file.log" : dumps all informations in "file.log" instead of using
  259.       the standard output.
  261.     * "-public" : skips the "Register on ..." question, and registers the
  262.       server automatically on the meta-server, so that clients can find it
  263.       easily.
  265.     * "-private" : skips the "Register on ..." question, and does not register
  266.       the server at all.
  268.     * "-comment This_is_a_comment" : associates a comment to the server, which
  269.       will be displayed by the meta-server. Note that the character "_" will be
  270.       replaced by spaces. This makes command line parsing easier. I'm lazy 8-)
  272.     * "-password xxx" : associates a password to the server. With this option,
  273.       clients will need to give the right password to be able to connect on the
  274.       server.
  276.     * "-callback cmd" : with this option, the command "cmd" will be launched
  277.       whenever someone connects on an empty server. For instance, if you want
  278.       to run a permanent server and want to know when someone connects but do
  279.       not wish to permanently keep an eye on the server's log, you might use
  280.       this option and put in "cmd" a command that automatically sends you a
  281.       mail. You might also use a command that fires a popup window. It's up to
  282.       you. 2 sample scripts are available in the "misc" directory of the Liquid
  283.       War source distribution. One is "misc/liquidwar_notify.sh" and works on
  284.       UNIX platforms, and the other one is "misc/lwpopup.js", which is
  285.       automatically used by "misc/lwserver.bat", and works on Windows.
  287.   Common options
  288.   --------------
  290.     These options work on both client and server, even if they are rather
  291.     "server-oriented".
  293.     * "-metaserver url" : redefines the URL of the meta-server. Usefull if you
  294.       want to use your own meta-server.
  296.     * "-netlog" : if you use this option, the server will dump all the network
  297.       traffic on the standard output. This is usefull for debugging.
  299.     * "-nobeep" : Disables the system beeps that the application might fire.
  300.       These beeps are mostly used on the server to notify clients connections.
  304. About Liquid War's network implementation
  305. =========================================
  308.   Basics
  309.   ------
  311.     Liquid War uses TCP sockets, and a single-threaded server. This implies
  312.     that:
  314.     * The game can sometimes get blocked if you play on Internet.
  316.     * The server can't talk simultaneously with several clients.
  318.     I needed to use TCP sockets, since LW's algorithm can not cope with any
  319.     data loss and it's not a reasonnable to try and anticipate what the map
  320.     would be like if the player did not move etc...
  322.     I did not implement any complex multithreaded stuff since I'm lazy and
  323.     however, clients need to have informations about all the other before
  324.     something can be done. However, implementing a mutltithreaded server could
  325.     have advantages over the current solution.
  327.   What is this lag stuff anyway?
  328.   ------------------------------
  330.     In Liquid War, all the clients send their key presses to the server, and
  331.     then the server dispatches this information to everyone. This has to be
  332.     done for every round.
  334.     You can easily imagine that if a player has a poor connection, with a very
  335.     long "ping delay", it can take quite a long time to send the information to
  336.     the server, and then get it back.
  338.     So what Liquid War does is that at the beginning of the game, the server
  339.     sends a couple of "blank" key strokes to the clients. This way, clients
  340.     receive data from the server before thay have sent any. The number of key
  341.     strokes sent at the beginning of the game is called the "lag".
  343.     So if it takes 200 msec to send and then receive data from the server
  344.     (approx the time returned by the "ping" command) then with a lag of 6, you
  345.     can theorically play at a rate of (1/0.2)*6=30 rounds/sec.
  347.     On one hand, setting the lag parameter to a high value will avoid many
  348.     network errors and allow you to play at a very fast pace, but the big
  349.     drawback is that there will be quite a long time between the instant you
  350.     send a key stroke to the server and the moment it comes back to you. On the
  351.     other hand, setting the lag to a low value will limit drastically he number
  352.     of rounds per second, but make the game more "responsive".
  354.     However, since release 5.4.1, the "lag" is modified automatically and
  355.     should adapt itself to the situation. I've not been able to test it in real
  356.     conditions yet, but it should work 8-)
  358.     Still, setting the lag to a sensible default value can save you some
  359.     trouble. Indeed, by default, Liquid War will choose a value (6), but it can
  360.     not guess if you are playing on Internet or on a 100 Mbit LAN, and it can
  361.     take quite a long time before Liquid War automatically finds the right
  362.     value. To know the right value which should be used with the "-lag" option,
  363.     simply play a few games and watch the average lag (which is displayed on
  364.     the server console every minute) at the end of the game.
  366.   Performance issues
  367.   ------------------
  369.     Liquid War uses a "light" server, and one of the advantages of this
  370.     solution is that it allows you to run the server on low-end computers. I
  371.     personnally run a permanent server on a 486 DX2, and it runs like a charm.
  373.     The only thing you have to take care of when running a server is bandwidth.
  374.     Don't worry, you won't need a 10Mbit connection, basically, each clients
  375.     sends and receives 12 bytes of data at each round. If you add TCP/IP
  376.     headers and the facts that stuff will probably be bundled in bigger
  377.     packets, a client must deliver about 15 Kbit/sec (up and down) for a game
  378.     that runs at 100 frames/sec. A 56K V90 modem is enough for this.
  380.     So if you run a server with 2 clients connected, the server will need to
  381.     deliver 30 Kbit/sec in both ways. A 56K V90 modem _can_ do that, but your
  382.     provider needs to be a good one 8-)
  384.     And if you run a server with 6 clients, you simply won't be able to reach
  385.     the 100 frames/sec with a 56K V90 modem. It will necessarly drop to
  386.     something less than 30 frames/sec, and is likely to drop to about 15
  387.     frames/sec. OK this is not a big deal, since few Internet games run at more
  388.     than 30 frames/sec, but well, if the server has troubles receiving/sending
  389.     data, everyone will wait, and the fun will go away.
  391.     As a conclusion: if you have the choice, choose the friend who has the best
  392.     bandwidth to run the server, without even considering the power of his
  393.     computer.
  397. Troubleshooting
  398. ===============
  401.   General information
  402.   -------------------
  404.     Network support in 5.4 and 5.5 is still experimental in many ways, so you
  405.     might get weird behaviors. Basically, if you have a problem, just do the
  406.     following:
  408.     * Stop and restart the server when something goes wrong. To stop it, use
  409.       CTRL-C.
  411.     * Check out that you have entered the correct IP addresses.
  413.     * Try and start the client and the server using the "-netlog" option to
  414.       have an idea about what's happening.
  416.   Bugs in 5.4.x corrected in 5.4.2
  417.   --------------------------------
  419.     Liquid War 5.4.0 and 5.4.1 were very hard to play over the Internet. The
  420.     reason is that the network routines did not do enough error checking, and
  421.     therefore there were very often errors when sending and/or receiving the
  422.     map to the server. Hopefully, this bug should not appear anymore in 5.4.2
  423.     or any other recent release.
  427. About security
  428. ==============
  431.   Network games passwords
  432.   -----------------------
  434.     As you might have noticed, under the box where you can enter the password,
  435.     a little notice explains that you must choose a "weak" password. Now you'll
  436.     tell me -> people keep on explaining me that passwords must be something
  437.     complex like "aS\r!Y9p" and now I'm told to use "hello", what's up?
  439.     OK, keep in mind Liquid War is a game. This password stuff is just a way to
  440.     be able to play with your friends only and keep on using the meta-server's
  441.     services. Liquid War does not encrypt data and I can see no good reason to
  442.     do it for, so the password is stored and sent to the server in clear, as
  443.     plain text.
  445.     The consequence is that if you use a valuable password - for instance the
  446.     one you use to log in on your computer - the guy who runs the server will
  447.     see your password in the log file if he wishes to. Therefore, use something
  448.     weak, something that if someones finds out what it is, you won't really
  449.     care. So "hello" is a wise choice.
  451.   Is Liquid War likely to have security holes?
  452.   --------------------------------------------
  454.     Yes.
  456.     Any program is likely to have security holes, especially when it's
  457.     networked. However, I have good reasons to think that Liquid War is safe
  458.     enough for a game. At least I find it safe enough to run a permanent public
  459.     server on my personnal computer 8-)
  461.     FYI, here are some things which I think make Liquid War rather safe to run:
  463.     * Liquid War does not store anything on your hard drive that would have
  464.       been received from the network. The maps are kept in RAM. So you won't
  465.       download any virus playing Liquid War on Internet.
  467.     * Liquid War does not transmit any sort of code on the network. All the
  468.       transmitted bytes represent plain data. So you're not likely to execute
  469.       any arbitrary code - virus, worm - when playing on the Net.
  471.     * Liquid War receives network packets in static buffers, and if the
  472.       received data is too big, it is truncated. One consequence is that Liquid
  473.       War has a bunch of "limits". You can't send hudge maps over the network,
  474.       you can't have long nicknames, and so on. But another consequence is that
  475.       if you try to send garbage in the buffer, it will be truncated. Liquid
  476.       War will protest with a "network error" message and the connection will
  477.       be closed, but there will be no easy exploit possible here.
  479.     * Liquid War does not use the sprintf, strcpy and strcat functions, which
  480.       are known as being rather unsecure since they can lead to buffer
  481.       overflows. Instead, it uses the equivalent functions snprintf, strncpy
  482.       and strncat. On platforms where these functions are supported natively,
  483.       the game will use the default system functions, otherwise it will use a
  484.       free implementation by Mark Martinec. FYI, Windows does not support
  485.       snprintf-like functions natively, that is, it's a piece of crap.
  487.     * Liquid War is Free Software, so I'm not likely to have put backdoors in
  488.       it myself, since anyone can look at the source code 8-)
  490.     However, I have not - and I know nobody who has - audited Liquid War for
  491.     security holes. So there might be some. Therefore you should respect a few
  492.     things while running Liquid War:
  494.     * Never run Liquid War as root or administrator. This is obvious but I
  495.       still mention it. If you want to run a Liquid War daemon on UNIX, run it
  496.       as user "nobody" or something approaching. If "root" or "administrator"
  497.       does not make sense on your system (DOS, Win98...) then I assume you're
  498.       not _really_ concerned about security anyway 8-P
  500.     * If you run a server 7/7 24/24, use the "-log" option to log everything in
  501.       a file. This way you'll keep a trace of network activity, and if
  502.       something goes wrong, you might get a chance to see it.
  504.     * If you use passwords in network games, *never* choose a valuable
  505.       password. Use something simple like "hello" or "goodbye".
  507.     * Keep in mind that Liquid War is a game, and not a bullet proof
  508.       professionnal server.
  510.     Last point: you should be aware that version 5.4.5 of Liquid War has been
  511.     proved to be vulnerable to a local buffer overflow, and one should run at
  512.     least 5.5.9 to get rid of this problem. FYI by the time the exploit was
  513.     found on 5.4.5, 5.5.9 was already out 8-) See
  514.     http://www.securityfocus.com/bid/8629 and
  515.     http://www.securityfocus.com/bid/9453 for more informations.
  517.   Can people cheat when playing on the Net?
  518.   -----------------------------------------
  520.     No.
  522.     Or at least, not really. In fact, you can still find the following types of
  523.     lamers:
  525.     * A guy who lets the CPU play at his place. He'll loose anyway because the
  526.       CPU is definitely not a great Liquid War Master 8-)
  528.     * A guy who tweaks the game and gets all his bots fight anyone he wishes.
  529.       That's mean.
  531.     * A guy who manages to let you have a 500msec lag while he does not have
  532.       any lag at all.
  534.     Apart from this, I can hardly see any way to cheat. Why? Because the Liquid
  535.     War server does not store any information about the game. It's not aware of
  536.     who wins, who looses, it knows nothing. The only thing it does is to
  537.     transmit key presses between client computers.
  539.     This way, if someone plays with a tweaked release of Liquid War, thinking
  540.     he will fool you, then he will fool you on his computer only... On your
  541.     computer, everything will be fine. After some time, your screen and his
  542.     screen will have nothing in common, and both players are likely to think
  543.     they have won. Except the lamer will stay a lamer.
  545.     This also explains why it's required to play with the very same versions of
  546.     the game during network games. If you plug a 5.5.2 with a 5.5.1, after a
  547.     minute the screens will be completely different on each client, since there
  548.     are subtle differences between the 5.5.1 and the 5.5.2 engine. However, you
  549.     shouldn't be able to do this, since a network error will stop you before
  550.     you can start to play.
  552.     Additionnally, versions 5.5.5 and higher have a checksum system. Every 100
  553.     rounds, each client calculates a checksum with its local map, and sends it
  554.     to the server. If the checksum is incorrect, the server will log a message
  555.     like:
  557.     Checksum error on client ""
  559.     If you see this, then you're in one of the following situations:
  561.     * There's a bug in the game
  563.     * A lamer tries to cheat
  565.     FYI, all releases from 5.4.0 to 5.5.4 have a bug which causes clients to
  566.     desynchronize after a while...

Raw Paste

Login or Register to edit or fork this paste. It's free.