1Liquid War(6)                    Games Manual                    Liquid War(6)
2
3
4

NAME

6       liquidwar - a unique multiplayer wargame
7

SYNOPSIS

9       liquidwar [-vh]
10

DESCRIPTION

12       Liquid  War is a multiplayer wargame. Its rules are very simple but yet
13       original.
14

OPTIONS

16       -v Displays the version number.
17
18       -h Displays copyright and various information.
19
20       ...
21          There are many other command lines options, which are described fur‐
22          ther in this document.
23

WARNING

25       As Liquid War is a cross-platform program (it also runs on DOS and Win‐
26       dows), I could reasonably not provide groff UNIX-style documentation to
27       Windows  user.  Therefore,  Liquid  War's documentation is available in
28       many formats, including HTML, PostScript and PDF.
29       I believe these formats are easier to read  than  this  man  page.   So
30       check  out  the  /usr/share/doc/liquidwar-doc-5.6.4 directory (from the
31       liquidwar-doc package), for this is where HTML and other  documentation
32       files  should  be.  Otherwise, if you are a die-hard man page user, you
33       may continue with this document 8-)
34
35

Rules

37   The Liquid War concept
38       Liquid War is a wargame. But it is different from common wargames.
39
40       When playing Liquid War, one has to eat one's opponent.  There  can  be
41       from  2  to 6 players. There are no weapons, the only thing you have to
42       do is to move a cursor in a 2-D battlefield. This cursor is followed by
43       your  army, which is composed by a great many little fighters. Fighters
44       are represented by small colored squares. All the fighters who have the
45       same  color  belong  to  the same team. One very often controls several
46       thousands fighters at the same time. And when fighters  from  different
47       teams meet, they eat each other, it is as simple as that.
48
49
50   How do teams react?
51       Teams  are composed of little fighters. These fighters all act indepen‐
52       dently, so it can happen that one single fighters does  something  dif‐
53       ferent from what all the other do.
54
55       The main goal of these fighters is to reach the cursor you control. And
56       to do that, they are in a way quite clever, for they choose the  short‐
57       est  way  to  reach  it.  Check  it  if  you want, but it is true, they
58       *really* choose *the* shortest way to reach the  cursor.  That  is  the
59       whole point with Liquid War.
60
61       But  these  fighters are not perfect, so when they choose this shortest
62       way, they do as if they were alone on the battlefield.  That's  to  say
63       that if there is a fighter blocking their way, they won't have the idea
64       to choose another way, which is free from fighters but would have  been
65       longer otherwise. So fighters can be blocked.
66
67
68   Who eats whom?
69       When  two  fighters from different team meet each other, they first try
70       to avoid fighting, and they dodge. But if there is no way for  them  to
71       move,  they  get angry and attack the guy which is blocking them. Some‐
72       times, they attack each other and both loose health. But it can  happen
73       that  a  fighter  is  attacked  by  another  one,  which is himself not
74       attacked at all.
75
76       Here is an example of this behaviour: A blue fighter and a red  fighter
77       both want to move to their right, for that would be the shortest way to
78       reach their cursor if there was nobody on the battlefield. But they are
79       blocked  by other fighters. If, for instance, the red fighter is on the
80       right and the blue fighter on the left, it is  the  red  fighter  which
81       will be eaten.
82
83       When a fighter is attacked, he first looses health, that is to say that
84       he gets darker. When his health reaches 0, his  color  changes  and  he
85       becomes  a  member of the team by which he has been attacked. Therefore
86       the number of fighters on the battlefield always remains the same.
87
88       When fighters of a same team get stuck together and block  each  other,
89       then they regenerate, that is to say that they get brighter.
90
91       However, I think the best way for you to understand the way it works is
92       to try the game...
93
94
95   Basic strategy
96       When I play Liquid War, I always try to surround my opponents,  and  it
97       usually works.
98
99       By  the  way, the computer has no strategy at all, he is a poor player,
100       and if you get beaten by him, it means you have to improve  yourself  a
101       lot!
102
103       But  still,  the  computer  doesn't  do  one thing which I've seen many
104       beginners doing: he never keeps his cursor motionless right in the mid‐
105       dle of his own fighters, for this is the best way to loose.
106
107
108   More strategy
109       Here are some more tips, kindly submitted by Jan Samohyl.
110
111       *  Try  to cut your opponent off walls and surround him completely with
112          your troops; when trying to penetrate his forces  inside  a  tunnel,
113          keep  your  troops at the wall (and force them ocassionaly to attack
114          off the wall). I think this is a biggest weakness  of  the  computer
115          AI, that it doesn't know this.
116
117       *  When  luring your troops to outflank an enemy, always move your cur‐
118          sor through the enemy, not the other way around.
119
120       *  To penetrate very narrow tunnels, stand back for  a  while  and  let
121          some  enemy  troops come from the tunnel to you. Then surround them,
122          destroy, repeat.
123
124       *  I have observed that with more than 2 players (6), the  game  diffi‐
125          culty  depends on the map in the following way: If the playing field
126          is completely empty, without any holes (topologically equivalent  to
127          full  circle),  the  game  is  the  easiest, because you can just go
128          through the middle to outflank your opponent. If there is  a  single
129          large  obstacle  (ie.  playfield is topologically equivalent to ring
130          (the area between two nested circles)), the game is the most  diffi‐
131          cult,  because  you have to choose one direction for the attack, and
132          cannot simply defend the other direction. For other maps,  it  seems
133          to  really  depend  on  their similarity to one of these two extreme
134          situations (and army size, of course, because it changes  the  rela‐
135          tive  size  of obstacles). Also, if you would later add another cur‐
136          sor, this property would probably disappear (maybe then  games  with
137          n+1 obstacles would be the hardest ones with n cursors).
138
139       *  If  you  want a particularly challenging computer game (at least for
140          some maps), use several players, max out attack,  min  out  defense,
141          max out base health (opposite would be harder, but game then changes
142          to the large cloud of black troops, so you don't see  anything)  and
143          give winner an advantage.
144
145
146
147   The winner is...
148       The  clever guy who has got the greatest number of fighters in his team
149       at the end of the game. Or the  one  who  exterminates  all  the  other
150       teams!
151
152

Authors

154   Thom-Thom
155       Liquid War rules have been invented by Thomas Colcombet.
156
157       He  was  trying  to  find algorithms to find the shortest path from one
158       point to another, and found the Liquid War algorithm. Then it  came  to
159       his mind that a game could be build upon this algorithm, and Liquid War
160       was born. He programmed the first two versions of Liquid War using Bor‐
161       land  Pascal  for DOS, and gave me some information about the algorithm
162       so that I could re-program it.
163
164
165   U-Foot
166       I'm the guy who  programmed  the  latest  versions  of  Liquid  War.  I
167       enhanced the algorithms, and did quite a bunch of work to have the game
168       playable by (almost) anyone, that's to say create a correct GUI.
169
170       If you want to join me, here's all the information you'll ever need:
171
172       Christian Mauduit
173
174       E-mail: ufoot@ufoot.org
175       Web site: http://www.ufoot.org
176
177       GnuPG public key: FD409E94 - http://www.ufoot.org/gnupg.pub
178       GnuPG fingerprint: 4762 1EBA 5FA3 E62F 299C  B0BB DE3F 2BCD FD40 9E94
179
180       Snail mail: 32 rue Jean Moulin  95100 Argenteuil  FRANCE
181
182
183   Other contributors
184       As Liquid War is now free software, protected by  the  GPL,  anyone  is
185       allowed to view, edit, modify, re-compile the source code, and distrib‐
186       ute it, as long as Liquid War is still distributed under the GPL.
187
188       Here's a list of the contributors:
189
190       *  Alstar: drew a map, which is now included in the main distribution.
191
192       *  Peter Wang: ported Liquid War to GNU/Linux.
193
194       *  Cort Danger Stratton : helped me setting up network support.
195
196       *  Tim Chadburn : wrote midi files for the game. His  contribution  has
197          been  truely appreciated since it's rather hard to find GNU GPL com‐
198          pliant artwork. He also wrote documentation  and  helped  with  midi
199          support in general.
200
201       *  Jan Gretschuskin : contributed 11 maps, and made the German transla‐
202          tion. So if you run Liquid War with German menus, you know  who  you
203          have   to   thank   ->   Jan!  8-)  Also  do  not  forget  to  visit
204          http://www.game-factor.de
205
206       *  Mouse : contributed a map.
207
208       *  Rene Stach : drew 3 maps.
209
210       *  Roderick Schertler : implemented HTTP 1.1 support.
211
212       *  Ryan D. Brown : ported Liquid War to Mac OS X.
213
214       *  Eduard Bloch : maintained the Debian package, and helped with German
215          support.
216
217       *  Michael Terry : provided a .desktop file for better integration with
218          Gnome, KDE and other UNIX desktop environments.
219
220       *  Kasper Hviid : contributed many maps, with their own  textures,  and
221          made   the   Danish  translation.  Great  work,  also  available  on
222          http://levels.2v1.cz/index.html
223
224       *  David Redick : wrote an external random map generator, available  on
225          http://xdavidx.sqrville.org/lwmapgen/index.html
226
227       *  Alexandre Pineau : maintains the Debian package.
228
229       *  Michael Wagner : translated the web site in German.
230
231       *  Peter Williams : fixed the "too many opened socket" server bug.
232
233       *  Jan Samohyl : submitted strategy tips.
234
235       *  Gavin : wrote the Liquid War fanfic.
236
237       *  Dave Vasilevsky : fixed the Mac OS X port.
238
239       *  2 of omega : contributed a map.
240
241       *  666-REFIZUL-666 : created many maps (distributed separately).
242
243       *  Thomas Klausner : fixed Makefile for FreeBSD
244
245       *  Joan Dolc : helped with Mac OS/X port
246
247
248       Many  other people helped me by submitting bug reports and patches, and
249       I want to thank them for their precious help. Thanks to all the  Debian
250       people too, who nicely maintain the Liquid War .deb package.
251
252

Mailing lists

254   liquidwar-user
255       Description
256
257       This  list  is  for  general discussions about Liquid War. Here you can
258       make suggestions, submit bug  reports,  ask  for  help,  find  players,
259       etc...  Basically,  any  question  or remark which concerns the game is
260       welcomed on this list.
261
262
263       Practical informations
264
265       You can't send messages to the list without subscribing. The only  rea‐
266       son  for  this  is  that  it's  one of the only way to block spam effi‐
267       ciently. I first thought it could be OK to allow anyone  to  post,  but
268       liquidwar-user  seems  to have be harvested by robots, so now I need to
269       restrict posters. However, I insist on the fact that  anyone  can  sub‐
270       scribe,  and  the  subscription to the list is not moderated. So if you
271       are a human being and not a stupid spam robot, you're  welcome  on  the
272       list 8-)
273
274       Here's a list of usefull URLs:
275
276       *  To   (un)subscribe:  http://mail.nongnu.org/mailman/listinfo/liquid
277          war-user
278
279       *  To   consult   archives:    http://mail.nongnu.org/pipermail/liquid
280          war-user/
281
282       *  To post on the list: liquidwar-user@nongnu.org
283
284
285
286
287   Chat and IRC
288       Web-based chat-box
289
290       I  have  have  set  up  a  web-based chat-box which is accessible here:
291       http://www.ufoot.org/liquidwar/v5/metaserver.php3
292
293       It's not as good as a good old IRC channel but not  everybody  can  use
294       IRC (because of firewalls and the likes), and I like the idea that peo‐
295       ple can chat and have the list of available servers in one  single  web
296       page.
297
298
299       IRC channels
300
301       I  personnally  spend some time on irc.freenode.net so you might use it
302       to find other players - though I'm not really an IRC  addict...  ...not
303       yet at least!
304
305       Here are the channels I recommend:
306
307       *  #liquidwar  : Liquid War dedicated channel, to find players and chat
308          while playing.
309
310       *  #netgame_players : general channel for  players  who  want  to  play
311          Internet  games  - Free Software and/or Open Source games of course,
312          we're on freenode.net 8-)
313
314
315
316

Fanfic

318   What's this?
319       Quoting Gavin: "I wrote a liquid war fanfic some time ago [...] I wrote
320       it  after  a  friend  claimed  that  there wasn't any liquid war fanfic
321       because it wasn't possible."
322
323       So here it is, a Liquid War  fanfic,  enjoy!  (and  special  thanks  to
324       Gavin)
325
326
327   The Battle of Emberlificoted
328       ...
329
330       The  General presided over his massing army in his seat, or rather hov‐
331       ering ring, of power. It dipped slightly as he flew low over his troops
332       marching  through  the viscous marsh-like terrain. They were like chil‐
333       dren: obedient, loyal, and they ate a lot.
334
335       Glancing at the status panel mounted in front of him he  grimaced;  the
336       other  five  armies:  Yellow, Green, Orange, Turquoise, and, of course,
337       Red, were also readying armies of a similar size to his own. His violet
338       clones would have to fight hard and eat well to win this day.
339
340       Today  would  not be a battle of luck, the General mused, it would be a
341       battle of tactics, of alliances, and of betrayal. Every clone was iden‐
342       tical  -  that  was  the  general  idea behind clones - and the terrain
343       seemed strangely symmetrical; it would not give advantage to any of the
344       six  armies  amassed today. Glancing at the hologram of the battlefield
345       projected in front of him the General noted that he would have to  move
346       quickly,  Orange  and  Yellow were too close for comfort, though fortu‐
347       nately Baron Red's army of eponymous coloured clones was the furthest.
348
349       General Violet's fingertips were sweaty even before  they  touched  the
350       four  main  control  keys  in front of him. They were labeled 'W', 'A',
351       'D', and, of course, the full retreat button - very useful for mislead‐
352       ing  foes  and  ambushing  them  as  they  pursued - 'S'. The keys were
353       arrange in a roughly equilateral triangular pattern; with  'S'  forming
354       the  base and being adjacent to both 'A' and 'D', 'W' formed the tip of
355       the triangle.
356
357       A long breath left his parched lips as at last he made his move.
358
359
360       ...
361
362       "Dammit!" he screamed moments later. He had  misjudged  Captain  Yellow
363       and  Commander  Orange;  he had expected one at least to attack immedi‐
364       ately, one he could have handled. They were working together -  foiling
365       his attempt to shoot between them to near the center of the battlefield
366       to gain a better vantage point. Yellow had shot down towards him,  cut‐
367       ting off his advance, and now Orange had sealed his escape route. "It's
368       not over yet" muttered the General. He opened a voice channel with Com‐
369       mander Orange:
370
371       "Very clever. Flawed, but still clever."
372
373       "Flawed?" came the reply.
374
375       "Yes flawed, when the good Captain is finished devouring my army who do
376       you think he will turn to next?",  bluffed  the  General  -  his  hands
377       worked quickly as he manoeuvred his hovering control ring, all that his
378       troops ever saw of him, carefully towards the weakest  section  of  his
379       attackers.  If  he  could just break out a few units he could soon turn
380       the tide against both Yellow and Orange.
381
382       "We have an alliance..." Orange's voice was unsure now.
383
384       Time for some sarcasm to through her even more off balance, thought the
385       General,
386
387       "I  gathered", he spoke softly, slowly, and with too much meaning. Then
388       closing the channel he turned his attention back to his escape.
389
390
391       ...
392
393       "Yes!" wooped the ecstatic figure of the General. Fifty or  so  of  his
394       troops  had  broken free undetected and were even now working their way
395       cautiously towards the camps of the Yellow army, only the  front  lines
396       were  still actively fighting; this opening gambit of Yellow and Orange
397       had turned into a stale siege and Yellow's army had pitched tent.
398
399       General Violet steered his hovering guidance ring to the center of  the
400       Yellow camp. His troops struck, both those who had got behind the lines
401       and those who were still besieged. Yellow reacted too slowly  and  sud‐
402       denly found that her army, was shrinking back from the onslaught. There
403       was nowhere to run to, and bye now her only ally - Commander  Orange  -
404       had abandoned her to her fate; he was too busy engaging Sir. Turquoise,
405       who had managed to escape from the slaughter that the Baron had  caused
406       to  the Turquoise ranks and was even now valiantly attacking the flanks
407       of the Orange troops.
408
409       A glance at the status panel showed that Yellow's life force was fading
410       quickly: 8%, 3%, 1%, Gone.
411
412       The  General  smiled,  he always enjoyed getting the first kill, and by
413       now his armies life force had grown and his clones had replicated. With
414       his,  now,  formidable  fighting force it was no problem to engulf both
415       Sir. Turquoise and Commander Orange's brawling  armies  and  annihilate
416       them. Once again his army grew in size and power. Now if only the Baron
417       didn't notice that..., thought the General.
418
419
420       ...
421
422       "Too late!" yelped the General, now thrown into panic, as  he  saw  the
423       approaching  Baron.  His army had also grown in size and power - having
424       fatally injured the Turquoise army within the opening  moments  of  the
425       battle,  and  having  finally managed to catch the elusive fleeing form
426       of, or what remained of, Emperor Green.
427
428       Gripping the controls harder the  General  thought  quickly,  his  army
429       doesn't  so  completely outnumber me that this is already over, however
430       unless I can cause him to make a mistake that allows  me  to  take  the
431       upper hand then I will inevitably lose. Maybe I can...
432
433       This  thought  was  terminated  and  replaced by another as the Baron's
434       angry red troops broke through the undergrowth that had  covered  their
435       movements  and started to surround the General's army. The thought that
436       now throbbed through the panic-stricken mind of General Violet was sim‐
437       ply 'Run!'.
438
439       Even as he signaled the retreat and made for what seemed to be the only
440       possible means of escape the Baron's blood red control ring appeared at
441       the  opening. The General knew it was over, even before the host of red
442       beings appeared at the opening.
443
444       There was no escape. His life force was almost depleted and he was sur‐
445       rounded. Then it was that the Baron decided to communicate:
446
447       "Too bad. It was a good game"
448
449       The  General  blinked, gaped, and was generally gobsmacked. Just before
450       his life force completely failed and  his  own  weary  eyes  closed  in
451       defeat he snarled,
452
453       "What!? This is not a game!" were the General's dying words.
454
455
456
458   Introduction
459       This  section  describes  how the GUI works. Since programming advanced
460       GUIs with Allegro is not so easy - standard  C  programming  definitely
461       lacks flexibility -, and also since it's somewhat hard for me to figure
462       out what is user-friendly and what's not, Liquid War's  menus  are  not
463       always  self-explanatory.  I'll  just  try and do something better next
464       time!
465
466
467   Menus
468       Map menu
469
470       The map menu allows you to choose the map you are going to play  on.  A
471       map is defined by 3 things:
472
473       *  A  frame. The frame can be chosen with the slider which is below the
474          preview. The frames are automatically sorted by alphabetical order.
475
476       *  A texture for walls.
477
478       *  A texture for the zone where fighters are allowed to move.
479
480
481       In the middle of the screen, there is a preview of the level.  In  this
482       menu, the values of the parameters can be independently changed by:
483
484       *  Moving a slider.
485
486       *  Clicking on a "+" or a "-" button.
487
488       *  Typing a number.
489
490
491       On  each  side of the preview, sliders allow you to choose the two tex‐
492       tures. There is also a preview of  each  texture.  Below  this  preview
493       there  are  128 little buttons which allow you to choose single colored
494       textures.
495
496       The name of the map and its resolution are displayed in the lower  part
497       of the screen.
498
499       You'll notice that on some maps the texture selection zones simply dis‐
500       appear. This is because these maps are associated with  a  texture,  so
501       choosing a different texture is often not recommended for it won't look
502       as nice as with the right one. If you still want to override  this  be‐
503       haviour  you  can  click  on the "on/off" button just right to the "Use
504       default texture" label. This is a toggle button which will allow you to
505       use  your  own  textures even on maps that normally come with their own
506       skin.
507
508       You'll also notice that a "Random map" button is available. This button
509       generates  a  new  random  map  using  an external program, "lwmapgen",
510       developped  by   David   Redick,   available   on   http://www.cs.clem
511       son.edu/~dredick/lwmapgen/
512
513       This program supports many command line options, and if you want a very
514       precise control on the generated maps, you'll  need  to  run  it  sepa‐
515       rately. Looking at LW's log file you should be able to see the commands
516       LW issues when calling this program, this can give you ideas on how  to
517       launch  it  manually.  Alternatively  using  the  "--help"  option (for
518       instance "liquidwar-mapgen --help" under UNIX) should describe  how  to
519       use it.
520
521
522       Teams menu
523
524       This menu allows you to choose the teams which are going to play. There
525       are 6 square zones in this menu. Each of them is associated to a team.
526
527       Each team can be either:
528
529       *  Disabled ("Off")
530
531       *  Controlled by a player ("Human")
532
533       *  Controlled by the computer ("Cpu")
534
535
536       The computer plays poorly, so remember that Liquid War is  basically  a
537       multiplayer  game,  and  that the cpu control is dedicated to beginners
538       only.
539
540       You can also choose the color associated to each team  by  clicking  on
541       one of the 12 colored buttons.
542
543       Below the 12 colored buttons, there are four buttons which allow you to
544       choose your keys. Click on one of these buttons and then press the  key
545       you  want  to  define. Joystick movements and buttons are considered as
546       keys. You can disable the joystick with the button which is at the bot‐
547       tom left of the menu. Mouse input is also possible, and mouse movements
548       are considered as keys too. To define mouse control, click on the  but‐
549       ton  associated to the direction you want to control, and then move the
550       mouse. Then the button should display something like "M->". Mouse  sen‐
551       sibility  can  be set with the little slider at the bottom right of the
552       menu.
553
554
555       Graphics menu
556
557       Here you can choose the graphic options of the game.
558
559       The "Video mode" button allows you to  switch  between  fullscreen  and
560       windowed mode. This button is not available under DOS.
561
562       The "Brightness" slider allows you to set the brightness of the game.
563
564       The  "Menu  res"  slider  allows  you to set the resolution used by the
565       menus. There are currently 5 possible values,  which  depend  on  which
566       platform you're running the game on.
567
568       I personnaly think the menus look best with the 640x480 resolution, but
569       some may prefer higher resolutions. Lower resolutions  should  only  be
570       used if you have problems using SVGA video modes.
571
572       The  "Game res" slider allows you to set the resolution used during the
573       game. The allowed values are the same than those for the menus. I  rec‐
574       ommend  that  you  don't use resolution higher than 640x480, unless you
575       have a Pentium VIII running a 10GHz.
576
577       Page flipping can be toggled. It is up to you to decide wether you keep
578       this  option  or not. The main disavantage of turning page flipping off
579       is that the info bar and the battlefield can look rahter ugly  if  they
580       overlap. But if you turn page flipping on you will not easily reach the
581       166 frames per second I sometimes get on small levels with my K6-225. I
582       personnaly always turn page flipping off.
583
584       The  viewport  size defines how much of your screen will be used by the
585       battlefield.
586
587       *  If you set the slider on its left position, the batllefield will not
588          be  stectched at all. Or if is strechted, it will be by a x2 or a x4
589          factor. So this is the mode wich allows the fastest display.
590
591       *  If you set the slider ont its right position, the game will  run  in
592          fullscreen mode.
593
594       *  With  all  the  other  positions of the slider, the battlefield will
595          keep its general proportions but it will be stretched.
596
597
598       The "Waves" button allows you to toggle the wave effect. You  can  also
599       do this while playing, by simply pressing F4.
600
601
602       Sound menu
603
604       This  section allows you to set the sound volumes. There are 4 sliders,
605       which are:
606
607       *  "Sfx": sets the volume of all  the  sfx  sounds,  thats  to  say'the
608          sounds you hear when the game starts, when you loose etc...
609
610       *  "Click":  sets  the  volume  of the click, this nasty noise you hear
611          each time your press on a button.
612
613       *  "Game water": sets the volume of the blop blop blop sounds which are
614          played continuously while you are playing.
615
616       *  "Menu  water":  the same thing than "Game water" except that it con‐
617          cerns the sounds played while your are choosing options.
618
619       *  "Music": general music volume.
620
621
622
623       Rules menu
624
625       This menu is the one where you can change the rules of the game.
626
627       The "Time" slider controls the time limit. The  game  will  stop  after
628       this time is elapsed. You can pause the game by pressing the "F3" key.
629
630       By  the  way, an info bar can display the time left while you are play‐
631       ing. This info bar can be toggled during the game by pressing the  "F1"
632       key,  and you can change its location by pressing the "F2" key. It also
633       displays how many fighters there are in each team.
634
635       The "Army size" slider controls the amount of fighters there will be on
636       the  battlefield.  The  position  of  the slider reflects the amount of
637       fighters of all the teams together. If there are  4  teams,  then  each
638       player  will  have  half as many fighters than if there had only been 2
639       teams.
640
641       The "Cursor x" slider controls the speed of your cursor.
642
643       *  If it is set on the left, the cursor goes at the same speed than the
644          fighters.
645
646       *  If it is centered, the cursor goes twice faster than the fighters.
647
648       *  If  it is set on the right, the speed of the cursor is multiplicated
649          by 3.
650
651
652       Below is a "Min 160x100" box with a slider on  its  right.  This  means
653       that  maps  will automatically be magnified so that they have a size of
654       at least 160x100. Indeed, some of the maps that come  with  Liquid  War
655       were  designed  in 1995 when 486 Intel computers were common. Therefore
656       the maps were smalls. Today, these maps are not really fun to  play  on
657       fast  computers,  so  Thomas  Harte suggested this automatic magnifying
658       feature, and that was IMHO a smart idea. You can move the slider to the
659       right to make maps use a higher resolution - ie magnify them.
660
661       The  "Defaults"  button  of  the "Rules" menu will reset rules to their
662       defaults. This way you can tweak  rules  and  then  come  back  to  the
663       default  rules  whenever  you want. Note that there's also a "Defaults"
664       button in the main "Options" menu, but it  will  reset  *all*  options,
665       including player names... The advantage of the "Defaults" button in the
666       "Rules" menu is that it will only reset rules parameters, and keep  the
667       rest of your configuration options untouched.
668
669
670       Speeds menu
671
672       The "frames/s" slider allows you to limit the number of frames per sec‐
673       ond. If this slider is set on the left, there won't be  any  limit,  so
674       Liquid  War  will  repaint your screen each time the fighters move. But
675       this can be a weird behaviour if your machine is really  fast,  for  no
676       one  cares  about  100  fps per second, one can not even see them... So
677       this paramters limits the refreshment rate, so that there can  be  sev‐
678       eral  logical  moves of the fichters for only one screen refreshing. If
679       it is set on its right, the display is limite to 10 fps, so you'll have
680       to find your setting. I personnally set it right in the middle, and get
681       40 fps. If you press "F5", you'll get the number of frames per  second,
682       and  if you press "F6", you'll get the number of logical moves per sec‐
683       ond. You can also press "F7" or "F8", and you will get  the  percentage
684       of time your computer spends on calculating or displaying the level.
685
686       The "rounds/s" slider allows you to limit the number of rounds per sec‐
687       ond. If this slider is set on the left, there won't be  any  limit,  so
688       Liquid War will run as fast as possible. This setting will be of no use
689       if you use Liquid War on a slow computer or  if  you  play  with  hudge
690       maps,  but sometimes, with a high-end Pentium class computer, it's sim‐
691       ply impossible to play on small maps because things simply go too fast.
692       So  this  parameter  is here to help you and avoid the "10000 moves per
693       sec" problem.
694
695
696       Waves menu
697
698       This is where the wave parameters are set. The waves are just a graphic
699       effect,  which  is  not  really usefull. I don't often use waves, but I
700       still think they can sometimes look nice. Change  these  parameters  if
701       you  really  mean to do it, but if you don't understand what they mean,
702       it is really OK...
703
704       There are 4 different types of waves, each of them being defined by:
705
706       *  An "Ampli" parameter, to define how big the waves have to be.
707
708       *  A "Number" parameter, to define how many waves should  be  displayed
709          at the same time.
710
711       *  A "Speed" parameter, to define how fast the waves should move.
712
713
714       If  you  want  to  undestand  what the "WX", "HY", "WY", and "HX" codes
715       mean, try to pay with only one type of wave, the "Ampli"  parameter  of
716       the  3 other types of wave being set to 0 (that is to say the slider is
717       on its left position), and sea how it looks like.
718
719       The wave effects can be toggled during the game by  pressing  the  "F4"
720       key.
721
722
723       Advanced menu
724
725       This menu allows the user to change the behaviour of the fighters.
726
727       The  "Attack" slider sets the agressivity of the fighters. If it is set
728       on the right, fighters eat each other very fast. If it is  set  on  the
729       left, it takes ages to fighters to change teams.
730
731       The "Defense" slider sets the capacity that the fighters have to regen‐
732       erate themselves. The more it is on  the  right,  the  faster  fighters
733       regenerate.
734
735       The "New health" slider sets the health of the fighters which have just
736       changed teams. The more it is on the left, the  weaker  these  fighters
737       will be.
738
739       The  "Winner help" slider controls a parameter which causes fighters to
740       attack with various strength depending on how many fighters  belong  to
741       their team. Not very clear... Let's just say that:
742
743       *  If  this  slider  is set on the right, the more fighters you have in
744          your team, the more aggressive they will become.
745
746       *  If it is centered, all the fighters of every team will always attack
747          with the same strength.
748
749       *  If  it  is set on the left, the less fighters you have, the stronger
750          they will be. In this mode, games usually never end.
751
752
753       The "Cpu strength" parameter never makes the computer more  intelligent
754       than  a  monkey.  But  if  you  set  it on the right, it advantages the
755       machine outrageously and fighters controlled by the cpu will be  really
756       strong.  So  to  get  rid  of them you'll definitely need to be clever.
757       Again and again, don't forget that Liquid War was conceived as a multi‐
758       player  game  and  that  playing  against the computer is not really an
759       interesting thing to do.
760
761       The "CPU vs human" parameter allows you to control how aggressive  CPUs
762       are towards humans.
763
764       *  If  set  to  "Always", CPUs will always attack humans and will never
765          try to attack another CPU, unless there are  no  humans  left.  This
766          used to be the default behavior in previous Liquid War versions, but
767          some players remarked that it was rather unfair, so now this  is  an
768          option.
769
770       *  If  set to "Random", CPUs won't care wether their opponents are CPUs
771          or humans, they'll attack anybody. This is the default behavior.
772
773       *  It set to "Never", CPUs will  attack  each  other  before  bothering
774          human players.
775
776
777       The  "Allow  net  bots"  button can be used to allow bots to connect on
778       network games. Indeed, bots are by default disabled in  network  games,
779       since  in this case LW assumes that bots are useless (there are already
780       several human players). However, turning this option on will allow  you
781       to  connect bots within the game. It's important to note that this is a
782       per client option, this means that you can't use it to forbid access to
783       bots  to  a given network game. This option was simply created to avoid
784       confusion when connecting on network games, while still  allowing  bots
785       to connects if you really want them to.
786
787       The "Algorithm" parameter allows you to force the algorithm to standard
788       C mode. There's no real good reason you would like to  do  this,  since
789       the C algorithm is slower than the ASM one. Moreover, the ASM algorithm
790       is automatically disabled if you play against a computer which does not
791       have ASM enabled. Think of this as a testing/debugging option.
792
793
794
795   Hot keys
796       Here's a list of keys you might use while playing:
797
798       *  F1:  toggles  the  "info"  zone where the game time and the state of
799          each team is displayed.
800
801       *  F2: moves the "info" the zone arround, possible positions being top,
802          right, bottom and left.
803
804       *  F3: pauses the game. This function is disabled during network games.
805
806       *  F4:  toggles the "wave effect". Without this "wave effect", which is
807          turned on ny default,the game will run faster.
808
809       *  F5: displays the number of frames per second (*).
810
811       *  F6: displays the number of rounds per second (*).
812
813       *  F7: displays the precentage of CPU spent on the game  logic,  calcu‐
814          lating where fighters must go for instance (*).
815
816       *  F8: displays the precentage of CPU spent on graphics (*).
817
818       *  F9:  turns  on/off  the "capture" mode. In this mode, screenshots of
819          each frame are taken, and written to the hard drive as bitmaps.
820
821       *  F10: quits the game right away without any confirmation prompt, also
822          known as the "my boss is coming here!" function.
823
824
825       (*)  all  these  figures tend to be clearly false as computer go faster
826       and faster. Basically, the time  required  for  "logic"  and  "display"
827       operations  is getting shorter and shorter, and the tools I use to mea‐
828       sure it are not precise enough. Therefore I  get  approximations  which
829       might by plainly wrong.
830
831

Network game

833   Basics
834       Since release 5.4.0, Liquid War includes network support, that's to say
835       that people can play over a LAN (Local Area Network). However,  due  to
836       limitations  in  Liquid War's legacy code, and also because of the lack
837       of time I have, it might be a little tricky to set up a network game at
838       first. So please read this section carefully.
839
840       You should keep in mind that:
841
842       *  DOS only releases of Liquid War do not include network support, only
843          Windows and GNU/Linux versions will allow you to set  up  a  network
844          game.
845
846       *  The  game  should  run  fine on any LAN, but there's no garantee the
847          game will be playable on the Internet. Indeed if your  "ping  delay"
848          is  not good enough, the game will be awfully slow. Bandwidth is not
849          an issue, since Liquid War rarely needs more than 2 Kb/sec.
850
851       *  You'll need to know what an IP address is.
852
853       *  You don't need to set up a network game to run a  multiplayer  game.
854          Liquid  War  was  originally a multiplayer game without network sup‐
855          port. Network support is here only for people who  don't  feel  com‐
856          fortable when playing at 6 on the same keyboard 8-)
857
858
859
860   Getting started
861       What do you need?
862
863       You'll basically need 2 computers connected on the same LAN. We'll call
864       them computer A and B. You might be able to play over the Internet too,
865       but the game can be harder to set up and - which is worse - very slow.
866
867       You'll  also need to know the IP address of computer A. Type "ipconfig"
868       under Windows or "ifconfig" as root under GNU/Linux to get this  infor‐
869       mation if you don't have it.
870
871
872       Starting the server
873
874       Liquid  War uses a very traditionnal client/server approach. Basically,
875       the server gets informations from all the clients and  then  dispatches
876       the collected information to everybody.
877
878       So  you'll  need  to  start  a server on computer A by running "liquid‐
879       war-server" on GNU/Linux or "lwwinsrv.exe" on windows. This is  a  con‐
880       sole application, ie it does not set up any graphic mode.
881
882       Here's a small example of a server start on GNU/Linux:
883
884       $ liquidwar-server
885       How many teams will connect to this server?
886
887       At  this  point you must enter a number between 2 and 6, and then press
888       "ENTER". In this example we will answer 2. The server really  needs  to
889       know  how  many  teams  will be in the game: when enough teams are con‐
890       nected, the game starts. It can also be a good idea to answer 6 system‐
891       atically  and  then force game start by clicking the "Start now" button
892       within the client. It's possible to skip this question by typing  "liq‐
893       uidwar-server -2" instead of a plain "liquidwar-server".
894
895       Use "-2" to get rid of this question.
896       Register on "www.ufoot.org/metaserver/" (y/n)?
897
898       Now  if  we  answer "y", then the server will automatically contact the
899       "meta-server" and it will  be  listed  on  http://www.ufoot.org/liquid
900       war/v5/metaserver.php3
901
902       This can be convenient for people who want to find other gamers to play
903       with on the Net. For now, let's answer "n", we'll test this meta-server
904       stuff later 8-)
905
906       Use "-private" to get rid of this question.
907       2002-06-03 16:43:00: Listening on port 8035...
908       2002-06-03 16:43:00: Waiting for 2 teams...
909
910       Now  the  server  is  ready to accept clients. By default it listens to
911       clients on port 8035. You could change this behavior setting by calling
912       "liquidwar-server  -port  8061" for instance, but let's use the default
913       port to make things easier.
914
915
916       Starting the clients
917
918       Start the client on  computer  A  normally  by  typing  "liquidwar"  on
919       GNU/Linux or double-click "lwwin.exe" on Windows.
920
921       Go  to  the "Teams" menu and select 2 teams, a red human and a blue CPU
922       for instance. If you don't know how to do this, then try and play  Liq‐
923       uid  War  on  a single computer first. It's important to notice that by
924       default the "blue CPU" won't connect on the network game. It's possible
925       to  allow  bots  to  connect on network games, but they are disabled by
926       default.
927
928       Now come back to the main menu, and  a  "Net  Game"  button  should  be
929       available. Click it. Now you should be able to:
930
931       *  Start the game.
932
933       *  Change the IP address of the server.
934
935       *  Change the communication port.
936
937       *  Set a password.
938
939       *  Search for internet games automatically.
940
941
942       Since the server is also running on the same machine (A), you can leave
943       the default IP address as is (127.0.0.1).
944
945       Now you are ready to start the second client on computer B.  Like  with
946       computer A, you'll have to:
947
948       *  Select 2 teams, green an yellow this time.
949
950       *  Select "Net Game" in the main menu.
951
952
953       But  this time you'll also need to change the server address, since the
954       client is not running on the same computer than the server.
955
956       Now click on "Start game" on computer A. The server should play a "sys‐
957       tem beep", which is usefull if you run a server and want to be notified
958       of client connections without watching the console all the time, and it
959       should display messages like this:
960
961       2002-06-03 16:44:48: Connection from "127.0.0.1:34677"
962       2002-06-03   16:44:48:  Team  "Napoleon"  on  client  "127.0.0.1:34677"
963       accepted
964       2002-06-03 16:44:49: Client "127.0.0.1:34677" accepted
965       2002-06-03 16:44:49: Waiting for 1 team...
966
967       And on the client you should see a screen which  says  "Waiting  for  1
968       team(s)"  with  the  list of connected players below (Napoleon). You do
969       not need to click on the "Start now" button.
970
971       Now click on "Start game" on computer B. The server should display mes‐
972       sages like this:
973
974       2002-06-03 16:49:14: Connection from "192.168.1.1:1098"
975       2002-06-03  16:49:14:  Team  "Henri  IV"  on  client "192.168.1.1:1098"
976       accepted
977       2002-06-03 16:49:15: Client "192.168.1.1:1098" accepted
978       2002-06-03 16:49:15: Client "192.168.1.1:1098" ready
979       2002-06-03 16:49:15: Client "127.0.0.1:34677" ready
980       2002-06-03 16:49:15: Sending info to "127.0.0.1:34677"
981       2002-06-03 16:49:15: Sending info to "192.168.1.1:1098"
982       2002-06-03 16:49:16: Game start
983
984       And at that point, the game should start 8-)
985
986
987       Restart a new game
988
989       Once the game is over, you  can  start  another  network  game  on  the
990       clients  without  touching the server, because the server automatically
991       restarts and waits for players to connect.
992
993       To stop the server - if you want to change its settings for instance  -
994       just go to the console where it's running and press CTRL-C.
995
996
997
998   Using the meta-server
999       Basics
1000
1001       The meta-server is a piece of software which is running on my web site,
1002       and allows servers to register themselves so that client can get a list
1003       of available servers.
1004
1005       It's  written  in PHP and is _very_ basic but I believe it's enough for
1006       what has to be done: maintain a list of running servers.
1007
1008       The source code for the meta-server is included in the  source  package
1009       of  Liquid War, so you might run such a server yourself if you want to.
1010       However, by default, servers will register themselves on my  web  site,
1011       and will be listed on http://www.ufoot.org/liquidwar/v5/metaserver.php3
1012
1013
1014       How to register a server
1015
1016       Launch the server, and when you get the question:
1017
1018       Register on "www.ufoot.org/metaserver/" (y/n)?
1019
1020       answer "y".
1021
1022       Note  that  if you're behind a proxy or a firewall, the server might be
1023       unable to register itself. Clients might also have problems to  connect
1024       themselves  on your server if there's a machine which does NAT (Network
1025       Address Translation) between you and the meta-server.
1026
1027
1028       How to find a server
1029
1030       In the main menu, click on "Net Game" and  then  "Search  for  internet
1031       games".
1032
1033       Now  you  should  see a list of available servers. You can click on the
1034       items in the list to get more informations about a given  server.  Once
1035       you have chosen a server, click on "Join now".
1036
1037       Now you get on a "Waiting for teams" screen. You might be interested in
1038       using the "Start now" button. Indeed, if you are 4 players connected on
1039       a  server  that accepts up to 6 players, maybe you'll want to start the
1040       game right away without waiting for 2 more players. In this case, every
1041       player  must click "Start now". A "*" character will replace the "-" in
1042       the players list when a player clicks on  "Start  now".  When  all  the
1043       players are displayed with a "*a, the game starts.
1044
1045       You can also chat with other players by entering text in the area above
1046       the "Send message" button, and then click on this button. Keep in  mind
1047       that  this is a very primitive chat and that the best way to chat effi‐
1048       ciently is IMHO to play in windowed mode and  have  an  IRC  client  at
1049       hand.
1050
1051       Note  that  you  can  also  get  the  list  of  available  servers from
1052       http://www.ufoot.org/liquidwar/v5/metaserver.php3  There  you'll   also
1053       find  a  little chat-box which will allow you to send exchange messages
1054       with other players.
1055
1056
1057
1058   Options
1059       Server options
1060
1061       You can pass options to the server using the command line. The  follow‐
1062       ing parameters are accepted:
1063
1064       *  "-n"  where  "n"  is a number between 2 and 6 : with this option you
1065          can tell the server how many teams will connect to the game. Beware,
1066          there  can  be several teams on the same computer, so if you want to
1067          have a computer with 2 players on it and 2 other  computers  with  a
1068          single player, then you need to use the "-4" option.
1069
1070       *  "-lag n" where "n" is an integer : with this option, you can control
1071          the lag used at startup. Normally, Liquid War handles this parameter
1072          automatically, but you might want to force it to a given value.
1073
1074       *  "-port n" where "n" is an integer : allows you to change the IP port
1075          used by the server to listen to the clients. if you omit this param‐
1076          eter, the default port is (8035) is used.
1077
1078       *  "-log  file.log"  :  dumps all informations in "file.log" instead of
1079          using the standard output.
1080
1081       *  "-public" : skips the "Register on ..." question, and registers  the
1082          server automatically on the meta-server, so that clients can find it
1083          easily.
1084
1085       *  "-private" : skips the "Register on ..." question, and does not reg‐
1086          ister the server at all.
1087
1088       *  "-comment  This_is_a_comment"  : associates a comment to the server,
1089          which will be displayed by the meta-server. Note that the  character
1090          "_" will be replaced by spaces. This makes command line parsing eas‐
1091          ier. I'm lazy 8-)
1092
1093       *  "-password xxx" : associates a password to  the  server.  With  this
1094          option,  clients  will need to give the right password to be able to
1095          connect on the server.
1096
1097       *  "-callback cmd" : with  this  option,  the  command  "cmd"  will  be
1098          launched whenever someone connects on an empty server. For instance,
1099          if you want to run a permanent server and want to know when  someone
1100          connects  but do not wish to permanently keep an eye on the server's
1101          log, you might use this option and put in "cmd" a command that auto‐
1102          matically  sends you a mail. You might also use a command that fires
1103          a popup window. It's up to you. 2 sample scripts  are  available  in
1104          the  "misc"  directory of the Liquid War source distribution. One is
1105          "misc/liquidwar_notify.sh" and works  on  UNIX  platforms,  and  the
1106          other  one  is  "misc/lwpopup.js",  which  is  automatically used by
1107          "misc/lwserver.bat", and works on Windows.
1108
1109
1110
1111       Common options
1112
1113       These options work on both client and server, even if they  are  rather
1114       "server-oriented".
1115
1116       *  "-metaserver url" : redefines the URL of the meta-server. Usefull if
1117          you want to use your own meta-server.
1118
1119       *  "-netlog" : if you use this option, the server  will  dump  all  the
1120          network  traffic  on the standard output. This is usefull for debug‐
1121          ging.
1122
1123       *  "-nobeep" : Disables the system beeps  that  the  application  might
1124          fire.  These  beeps  are mostly used on the server to notify clients
1125          connections.
1126
1127
1128
1129
1130   About Liquid War's network implementation
1131       Basics
1132
1133       Liquid War uses TCP sockets, and a single-threaded server. This implies
1134       that:
1135
1136       *  The game can sometimes get blocked if you play on Internet.
1137
1138       *  The server can't talk simultaneously with several clients.
1139
1140
1141       I needed to use TCP sockets, since LW's algorithm can not cope with any
1142       data loss and it's not a reasonnable to try and anticipate what the map
1143       would be like if the player did not move etc...
1144
1145       I  did not implement any complex multithreaded stuff since I'm lazy and
1146       however, clients need to have informations about all the  other  before
1147       something  can  be  done. However, implementing a mutltithreaded server
1148       could have advantages over the current solution.
1149
1150
1151       What is this lag stuff anyway?
1152
1153       In Liquid War, all the clients send their key presses  to  the  server,
1154       and  then  the server dispatches this information to everyone. This has
1155       to be done for every round.
1156
1157       You can easily imagine that if a player has a poor connection,  with  a
1158       very  long  "ping  delay",  it  can  take quite a long time to send the
1159       information to the server, and then get it back.
1160
1161       So what Liquid War does is that at  the  beginning  of  the  game,  the
1162       server  sends a couple of "blank" key strokes to the clients. This way,
1163       clients receive data from the server before thay  have  sent  any.  The
1164       number  of  key strokes sent at the beginning of the game is called the
1165       "lag".
1166
1167       So if it takes 200 msec to send and then receive data from  the  server
1168       (approx  the time returned by the "ping" command) then with a lag of 6,
1169       you can theorically play at a rate of (1/0.2)*6=30 rounds/sec.
1170
1171       On one hand, setting the lag parameter to a high value will avoid  many
1172       network  errors  and allow you to play at a very fast pace, but the big
1173       drawback is that there will be quite a long time  between  the  instant
1174       you  send  a  key  stroke to the server and the moment it comes back to
1175       you. On the other hand, setting the lag to a low value will limit dras‐
1176       tically he number of rounds per second, but make the game more "respon‐
1177       sive".
1178
1179       However, since release 5.4.1, the "lag" is modified  automatically  and
1180       should  adapt itself to the situation. I've not been able to test it in
1181       real conditions yet, but it should work 8-)
1182
1183       Still, setting the lag to a sensible default value can  save  you  some
1184       trouble. Indeed, by default, Liquid War will choose a value (6), but it
1185       can not guess if you are playing on Internet or on a 100 Mbit LAN,  and
1186       it can take quite a long time before Liquid War automatically finds the
1187       right value. To know the right value which  should  be  used  with  the
1188       "-lag" option, simply play a few games and watch the average lag (which
1189       is displayed on the server console every minute)  at  the  end  of  the
1190       game.
1191
1192
1193       Performance issues
1194
1195       Liquid  War  uses  a  "light" server, and one of the advantages of this
1196       solution is that it allows you to run the server on low-end  computers.
1197       I  personnally  run a permanent server on a 486 DX2, and it runs like a
1198       charm.
1199
1200       The only thing you have to take care of when running a server is  band‐
1201       width. Don't worry, you won't need a 10Mbit connection, basically, each
1202       clients sends and receives 12 bytes of data at each round. If  you  add
1203       TCP/IP  headers  and  the  facts that stuff will probably be bundled in
1204       bigger packets, a client must deliver about 15 Kbit/sec (up  and  down)
1205       for  a  game that runs at 100 frames/sec. A 56K V90 modem is enough for
1206       this.
1207
1208       So if you run a server with 2 clients connected, the server  will  need
1209       to deliver 30 Kbit/sec in both ways. A 56K V90 modem _can_ do that, but
1210       your provider needs to be a good one 8-)
1211
1212       And if you run a server with 6 clients, you simply  won't  be  able  to
1213       reach  the 100 frames/sec with a 56K V90 modem. It will necessarly drop
1214       to something less than 30 frames/sec, and is likely to drop to about 15
1215       frames/sec.  OK this is not a big deal, since few Internet games run at
1216       more than 30 frames/sec, but well, if the server has  troubles  receiv‐
1217       ing/sending data, everyone will wait, and the fun will go away.
1218
1219       As  a conclusion: if you have the choice, choose the friend who has the
1220       best bandwidth to run the server, without even considering the power of
1221       his computer.
1222
1223
1224
1225   Troubleshooting
1226       General information
1227
1228       Network  support  in 5.4 and 5.5 is still experimental in many ways, so
1229       you might get weird behaviors. Basically, if you have a  problem,  just
1230       do the following:
1231
1232       *  Stop  and  restart the server when something goes wrong. To stop it,
1233          use CTRL-C.
1234
1235       *  Check out that you have entered the correct IP addresses.
1236
1237       *  Try and start the client and the server using the  "-netlog"  option
1238          to have an idea about what's happening.
1239
1240
1241
1242       Bugs in 5.4.x corrected in 5.4.2
1243
1244       Liquid  War  5.4.0  and 5.4.1 were very hard to play over the Internet.
1245       The reason is that the network routines did not do enough error  check‐
1246       ing,  and  therefore  there  were very often errors when sending and/or
1247       receiving the map to the server. Hopefully, this bug should not  appear
1248       anymore in 5.4.2 or any other recent release.
1249
1250
1251
1252   About security
1253       Network games passwords
1254
1255       As  you might have noticed, under the box where you can enter the pass‐
1256       word, a little notice explains that you must choose a "weak"  password.
1257       Now  you'll tell me -> people keep on explaining me that passwords must
1258       be something complex like "aS\r!Y9p" and now I'm told to  use  "hello",
1259       what's up?
1260
1261       OK,  keep  in  mind Liquid War is a game. This password stuff is just a
1262       way to be able to play with your friends only and  keep  on  using  the
1263       meta-server's  services. Liquid War does not encrypt data and I can see
1264       no good reason to do it for, so the password is stored and sent to  the
1265       server in clear, as plain text.
1266
1267       The  consequence  is that if you use a valuable password - for instance
1268       the one you use to log in on your computer  -  the  guy  who  runs  the
1269       server  will  see your password in the log file if he wishes to. There‐
1270       fore, use something weak, something that if someones finds out what  it
1271       is, you won't really care. So "hello" is a wise choice.
1272
1273
1274       Is Liquid War likely to have security holes?
1275
1276       Yes.
1277
1278       Any program is likely to have security holes, especially when it's net‐
1279       worked. However, I have good reasons to think that Liquid War  is  safe
1280       enough  for  a  game. At least I find it safe enough to run a permanent
1281       public server on my personnal computer 8-)
1282
1283       FYI, here are some things which I think make Liquid War rather safe  to
1284       run:
1285
1286       *  Liquid  War  does  not  store anything on your hard drive that would
1287          have been received from the network. The maps are kept  in  RAM.  So
1288          you won't download any virus playing Liquid War on Internet.
1289
1290       *  Liquid  War  does  not transmit any sort of code on the network. All
1291          the transmitted bytes represent plain data. So you're not likely  to
1292          execute any arbitrary code - virus, worm - when playing on the Net.
1293
1294       *  Liquid  War  receives  network packets in static buffers, and if the
1295          received data is too big, it is truncated. One consequence  is  that
1296          Liquid  War  has a bunch of "limits". You can't send hudge maps over
1297          the network, you can't have long nicknames, and so on.  But  another
1298          consequence  is  that  if  you try to send garbage in the buffer, it
1299          will be truncated. Liquid War will protest with  a  "network  error"
1300          message and the connection will be closed, but there will be no easy
1301          exploit possible here.
1302
1303       *  Liquid War does not use the sprintf, strcpy  and  strcat  functions,
1304          which are known as being rather unsecure since they can lead to buf‐
1305          fer overflows. Instead, it uses the equivalent  functions  snprintf,
1306          strncpy  and  strncat.  On  platforms where these functions are sup‐
1307          ported natively, the game will use  the  default  system  functions,
1308          otherwise  it  will use a free implementation by Mark Martinec. FYI,
1309          Windows does not support snprintf-like functions natively, that  is,
1310          it's a piece of crap.
1311
1312       *  Liquid War is Free Software, so I'm not likely to have put backdoors
1313          in it myself, since anyone can look at the source code 8-)
1314
1315
1316       However, I have not - and I know nobody who has -  audited  Liquid  War
1317       for  security  holes.  So  there  might  be  some. Therefore you should
1318       respect a few things while running Liquid War:
1319
1320       *  Never run Liquid War as root or administrator. This is obvious but I
1321          still  mention  it.  If you want to run a Liquid War daemon on UNIX,
1322          run it as user "nobody"  or  something  approaching.  If  "root"  or
1323          "administrator"  does  not make sense on your system (DOS, Win98...)
1324          then I assume you're not _really_ concerned  about  security  anyway
1325          8-P
1326
1327       *  If  you  run a server 7/7 24/24, use the "-log" option to log every‐
1328          thing in a file. This way you'll keep a trace of  network  activity,
1329          and if something goes wrong, you might get a chance to see it.
1330
1331       *  If  you  use  passwords  in network games, *never* choose a valuable
1332          password. Use something simple like "hello" or "goodbye".
1333
1334       *  Keep in mind that Liquid War is a game, and not a bullet proof  pro‐
1335          fessionnal server.
1336
1337
1338       Last  point:  you  should be aware that version 5.4.5 of Liquid War has
1339       been proved to be vulnerable to a local buffer overflow, and one should
1340       run  at  least  5.5.9  to  get rid of this problem. FYI by the time the
1341       exploit  was  found  on  5.4.5,  5.5.9  was   already   out   8-)   See
1342       http://www.securityfocus.com/bid/8629     and    http://www.securityfo
1343       cus.com/bid/9453 for more informations.
1344
1345
1346       Can people cheat when playing on the Net?
1347
1348       No.
1349
1350       Or at least, not really. In fact, you  can  still  find  the  following
1351       types of lamers:
1352
1353       *  A guy who lets the CPU play at his place. He'll loose anyway because
1354          the CPU is definitely not a great Liquid War Master 8-)
1355
1356       *  A guy who tweaks the game and gets all  his  bots  fight  anyone  he
1357          wishes. That's mean.
1358
1359       *  A  guy  who  manages to let you have a 500msec lag while he does not
1360          have any lag at all.
1361
1362
1363       Apart from this, I can hardly see any way to cheat.  Why?  Because  the
1364       Liquid  War  server does not store any information about the game. It's
1365       not aware of who wins, who looses, it knows nothing. The only thing  it
1366       does is to transmit key presses between client computers.
1367
1368       This way, if someone plays with a tweaked release of Liquid War, think‐
1369       ing he will fool you, then he will fool you on his computer only...  On
1370       your  computer,  everything  will be fine. After some time, your screen
1371       and his screen will have nothing in common, and both players are likely
1372       to think they have won. Except the lamer will stay a lamer.
1373
1374       This  also  explains  why it's required to play with the very same ver‐
1375       sions of the game during network games. If you  plug  a  5.5.2  with  a
1376       5.5.1,  after a minute the screens will be completely different on each
1377       client, since there are subtle differences between the  5.5.1  and  the
1378       5.5.2  engine.  However, you shouldn't be able to do this, since a net‐
1379       work error will stop you before you can start to play.
1380
1381       Additionnally, versions 5.5.5 and higher have a checksum system.  Every
1382       100  rounds,  each client calculates a checksum with its local map, and
1383       sends it to the server. If the checksum is incorrect, the  server  will
1384       log a message like:
1385
1386       Checksum error on client "192.168.1.1:1098"
1387
1388       If you see this, then you're in one of the following situations:
1389
1390       *  There's a bug in the game
1391
1392       *  A lamer tries to cheat
1393
1394
1395       FYI,  all  releases from 5.4.0 to 5.5.4 have a bug which causes clients
1396       to desynchronize after a while...
1397
1398
1399

Command line parameters

1401   Introduction
1402       When you launch Liquid War 5, you can use command line options. If  you
1403       have no problems launching Liquid War, this section should not interest
1404       you very much.
1405
1406       You can use several options at the same  time.  The  basic  syntax  for
1407       options looks like this:
1408
1409       lw -option1 -option2 parameter2 -option3 parameter3 -option4 -option5
1410
1411       Note  that  most  of the options are legacy options which where usefull
1412       with the initial releases of Liquid War, when you had to run in a  Win‐
1413       dows  DOS  box,  and when there were still plenty of 486 computers with
1414       only 8Mb ram...
1415
1416
1417   Version checking
1418       These are basic options which  can  be  usefull  to  figure  out  which
1419       release of Liquid War is installed.
1420
1421       *  "-v" : returns the version number of the program.
1422
1423       *  "-h" : displays a short description and copyright information.
1424
1425
1426
1427   Changing default paths
1428       Very  usefull  options, especially if you can not install Liquid War in
1429       default directories or want to put the game in a special place.
1430
1431       *  "-cfg myconfigfile.cfg" : causes Liquid War  to  use  the  specified
1432          config file.
1433
1434       *  "-dat  mydatafilefile.dat"  : causes Liquid War to use the specified
1435          datafile. This might be a very interesting option if you run  Liquid
1436          War  on a GNU/Linux box where you do not have root access and there‐
1437          fore can not put the datafile in /usr.
1438
1439       *  "-map mycustommapdir" : causes  Liquid  War  to  use  the  specified
1440          directory as the user map directory. The user map directory is where
1441          you can put plain bitmaps to be used as maps.
1442
1443       *  "-tex mycustomtexturedir" : causes Liquid War to use  the  specified
1444          directory  as the user texture directory. The user texture directory
1445          is where you can put plain bitmaps to be used as textures.
1446
1447       *  "-mid mycustommusicdir" : causes Liquid War  to  use  the  specified
1448          directory  as the user music directory. Any midi file placed in this
1449          directory will be added to the list of available musics.
1450
1451       *  "-server myliquidwarserverfile" : causes Liquid War to use the spec‐
1452          ified  file  as the server executable. This option has no effect for
1453          now since the server is not launched by the client.
1454
1455       *  "-mapgen mylwmapgenfile" : causes Liquid War to  use  the  specified
1456          file as the "lwmapgen" executable. "lwmapgen" is an utility by David
1457          Redick which generates random maps automatically for Liquid War. You
1458          might  wish  to change this option if random map generation does not
1459          work for some reason, or if you want to use your own map generator.
1460
1461
1462
1463   Troubleshooting switches
1464       These options give you control on how Liquid War treats  initialisation
1465       errors,  how much memory it should reserve, what kind of video mode sit
1466       should not choose etc...
1467
1468       *  "-vga" : This option forces Liquid War to use your video card as  if
1469          it  was  only  a basic VGA card. This option is required if you play
1470          Liquid War from Windows NT.
1471
1472       *  "-no400300" : This option disables the VGA  400x300  video  mode.  I
1473          created this options for I know that some video cards/monitors don't
1474          support the 400x300 mode.
1475
1476       *  "-silent" : With this option, Liquid War will not play any sound. It
1477          will  not  search for any sound card. This can be interesting if you
1478          don't have any sound card or if Liquid War doesn't handle your  card
1479          correctly.
1480
1481       *  "-nowater" : Causes Liquid War not to load any water sound. Use this
1482          if Liquid War runs short of memory, and you should gain about 850kb.
1483
1484       *  "-nosfx" : Causes Liquid War not to load any sound fx. Use  this  if
1485          Liquid War runs short of memory, and you should gain about 150kb.
1486
1487       *  "-nomusic" : Causes Liquid War not to load any midi music.
1488
1489       *  "-mem  n" : The parameter "n" sets the amount of memory (in Mb) Liq‐
1490          uid War will allocate to do all its calculus. If this number is  too
1491          small,  you  won't  be  able to play on all the levels. If it is too
1492          high, Liquid War may not start at all or crash while you  are  play‐
1493          ing. The default value is 8. If you play Liquid War from Windows and
1494          Liquid War refuses to run because this parameter is too  high,  then
1495          try and give more dpmi memory to Liquid War.
1496
1497       *  "-nojoy" : This option disables joystick support.
1498
1499       *  "-noback"  : Causes Liquid War not to load the background image. Use
1500          this if Liquid War runs short of memory, and you should  gain  about
1501          300kb.
1502
1503       *  "-notex"  :  Causes  Liquid War not to load any texture. Use this if
1504          Liquid War runs short of memory, and you should gain about 750kb.
1505
1506       *  "-auto" : If you set this option,  Liquid  War  won't  generate  any
1507          error while allocating memory or loading data.
1508
1509       *  "-safe"  :  With this option, you will play with a very reduced ver‐
1510          sion of Liquid War. It looks rather ugly but should work  in  a  DOS
1511          box with only 4Mb of DPMI memory. Use this if you experience serious
1512          memory or device problems. If Liquid War  doesn't  start  with  this
1513          option turned on, I really don't think I can do anything for you...
1514
1515       *  "-nice"  :  With  this  option,  Liquid War will use a mode which is
1516          between the default mode and the "safe" mode.
1517
1518       *  "-check" : With this option, Liquid War will  stop  as  soon  as  it
1519          detects something strange while initializing.
1520
1521       *  "-stop"  :  If you set this option, Liquid War will prompt you for a
1522          key when the init process is completed.
1523
1524       *  "-c" : This is a weird option, if you turn it on, the game will only
1525          use  fonctions which are programmed in C langage. The default behav‐
1526          iour is to use some functions I rewrote in assembly langage, so that
1527          the game is a little faster.
1528
1529
1530
1531   Debug options
1532       These  options  are  usefull  if  you  want to debug the game and trace
1533       what's happening.
1534
1535       *  "-netlog" : Dumps all the network traffic on  the  standard  output.
1536          This  can help finding problems when trying to connect to the server
1537          in a network game.
1538
1539
1540
1541   Server options
1542       The server command line options are  described  in  the  section  which
1543       deals  which  network games in general. IMHO you need to understand how
1544       network works in LW before trying to tweak the server 8-)
1545
1546
1547   Other options
1548       Everything else 8-)
1549
1550       *  "-capture" : Activates the capture mode. In this mode, the game will
1551          dump a .bmp file on the disk several times per second, which is use‐
1552          full if you want to create an mpeg movie of your game session after‐
1553          wards.  You can also activate this mode interactively by pressing F9
1554          within the game.
1555
1556       *  "-metaserver url" : redefines the URL of the meta-server. Usefull if
1557          you want to use your own meta-server.
1558
1559       *  "-nobeep"  :  Disables  the  system beeps that the application might
1560          fire. These beeps are mostly used on the server  to  notify  clients
1561          connections.
1562
1563       *  "-tombola" : Activates a special mode where scores are not displayed
1564          normally. Instead, the game displays 3 random numbers  between  1  -
1565          500.
1566
1567
1568
1569   lwmapgen options
1570       The  external lwmapgen program by David Redick accepts a number of com‐
1571       mand line options. You can type:
1572
1573       liquidwar-mapgen --help
1574
1575       to get a list of all available options under UNIX.  Under  Windows  the
1576       command would be:
1577
1578       lwwinmap --help
1579
1580       Note that lwmapgen is called automatically by Liquid War when you click
1581       on the "Random map" button.
1582
1583       The idea behind lwmapgen is that you choose a function which  sets  the
1584       type  of  map  generated, and then pass various arguments to this func‐
1585       tion. If you do not explicitly choose a function, one will be picked up
1586       for you randomly, and all other parameters will use default values.
1587
1588       The most usefull and common options are:
1589
1590       *  "--help" : displays help.
1591
1592       *  "--out filename" : save bitmap to filename.
1593
1594       *  "--size n" : bitmap size (an integer between 0 and 5).
1595
1596       *  "--list" : list all available functions.
1597
1598       *  "--function function_name" : which function to use.
1599
1600
1601       Here's a typical use of lwmapgen:
1602
1603       liquidwar-mapgen --size 3 --function hole --out test.bmp
1604
1605

Platform specific issues

1607   General remarks
1608       Liquid  War is now a cross-platform game, thanks to Allegro. So now you
1609       can play under different OS.
1610
1611       The same source tree will compile on all supported platforms, but  with
1612       slight  differences  when  running. C preprocessor #defines are used to
1613       code some platform specific stuff, and in some cases there are  differ‐
1614       ent files for the DOS, Windows and UNIX versions.
1615
1616       As I said, I try to use the same code for all platforms. This is in the
1617       long term the best choice. Otherwise there would different branches  of
1618       the source tree, and I don't think this is a very good solution.
1619
1620       Therefore  some  optimizations  that were performed in the old DOS-only
1621       version have been totally removed, for they were 100%  platform  depen‐
1622       dent  (ie  mode-X  asm  coding).  So  the new versions are all a little
1623       slower than the old 5.1 stuff, but the performance loss is  only  about
1624       20%, which is not significant with today's PCs. And anyways the perfor‐
1625       mance loss is most of the time limited to the goog  old  VGA  320x200x8
1626       mode-X, which starts being kind of obsolete.
1627
1628
1629   DOS
1630       This  is  the  original version. It's the fastest one as far as I know,
1631       the safest one and it will always be I think, since Allegro  was  first
1632       designed  for  DOS,  and DOS allows a full unconditionnal access to all
1633       the hardware ressources LW requires. LW doesn't use any hardware accel‐
1634       eration  and  it's not been designed to do so. Unfortunately there's no
1635       network support for the DOS version of Liquid War.
1636
1637
1638   Windows
1639       When running under a Windows box, the DOS release used to be safer than
1640       the  native  Windows  port. Now that DOS support is getting really poor
1641       with recent versions of Windows, the native Windows release  of  Liquid
1642       War  starts  begin  the  good choice for Windows users. And Allegro for
1643       Windows is getting quite stable in the 4.x series.
1644
1645       The other reason to choose this release rather than the DOS release  is
1646       that it has network support.
1647
1648       If you have problems running Liquid War under Windows, please check out
1649       the "data\lwwin.log" file which should be written each time you run the
1650       game.  It  contains  the  information which is displayed on the console
1651       under other platforms, and might give you a  clue  about  what's  going
1652       wrong.
1653
1654
1655   GNU/Linux
1656       This port is the most recent one, and also the one I prefer. Paths have
1657       been changed to an UNIXish style, ie the data is stored in:
1658
1659       /usr/local/share/games/liquidwar
1660
1661       the executable in:
1662
1663       /usr/local/games
1664
1665       and the configuration file is
1666
1667       ~/.liquidwarrc
1668
1669       Since not all GNU/Linux distributions have  /usr/local/games  in  their
1670       path,  I  also put a symbolic link to the binaries in /usr/local/bin. I
1671       believe Liquid War is quite FHS compliant, so if its  default  directo‐
1672       ries do not match your configuration, blame your distro for not follow‐
1673       ing  the  standards  8-)   AFAIK   the   only   touchy   directory   is
1674       /usr/local/share/pixmaps  which I've seen on many distribution but does
1675       not seem to be referenced in the FHS.
1676
1677       With the latest releases of Allegro, Liquid War is becoming pretty sta‐
1678       ble  under  GNU/Linux.  You should also know that the GNU/Linux port is
1679       usually the most up to date, since I very very seldom boot  Windows  at
1680       home and do most of the coding under GNU/Linux.
1681
1682
1683   FreeBSD
1684       This  is  the  latest  port,  so  I  expect it to be a little touchy to
1685       install and/or run for some time.
1686
1687       Note that to compile the game you'll need to  install  GNU  tools  like
1688       gmake  and  gcc.  Liquid War won't compile with the genuine make and cc
1689       commands.
1690
1691       One thing you might ask is: "why do you provide the binary as  a  plain
1692       .tgz  file,  it would be much nicer if a standard FreeBSD port was pro‐
1693       vided instead!". The answer is that the statically linked binary should
1694       work flawlessly and does not raise any dependency problem. Also I don't
1695       know how to make a BSD port and I'm not really interested in doing  it.
1696       If  it's  easy to do, then someone can simply do it and send it back to
1697       me. If it's hard to do, then I do not really have the time nor  motiva‐
1698       tion  to do it. What I did is make the code and install scripts FreeBSD
1699       friendly so that it would be possible to compile the game  under  Free‐
1700       BSD. Packaging is another story.
1701
1702
1703   Mac OS X
1704       There's  currently  a  beta  version of a Mac OS X port for Liquid War.
1705       Ryan D. Brown nicely managed to compile and run the game under  Mac  OS
1706       X,  and  the  latest  news was that it does basically work. Still, this
1707       port did not go through intensive testing, so there might still be some
1708       bugs, expecially concerning networking.
1709
1710       There  were  some  byte  endianess  problems  in  previous  ( <=5.5.8 )
1711       releases of LW, but I tried to fix them and they should be gone now.
1712
1713       As of today, we're trying to find out a convenient way to  package  and
1714       release  the  Mac OS X version of LW. You can contact us on the mailing
1715       list if you're interested in this port.
1716
1717

User levels

1719   A piece of advice
1720       You can use your own levels whith Liquid War 5. The only thing you have
1721       to  do  is to put your own 256-colors vbitmap files in a special direc‐
1722       tory, and the program will use them. Currently, BMP, LBM, PCX, and  TGA
1723       files  are supported. It is a good thing to use 256 colors bitmaps, for
1724       they waste less disk space than truecolor bitmaps,  and  Liquid  War  5
1725       converts  all  bitmaps  to  32 colors bitmaps. Additionnally, truecolor
1726       bitmaps might cause the DOS version to crash randomly...  2-color  bit‐
1727       maps will also cause the program to crash. I warned you!
1728
1729       The  best thing you can do to create your user levels is to have a look
1730       at the few user files I put in the .zip file and try  at  first  to  do
1731       something that looks about the same!
1732
1733
1734   Maps
1735       Liquid  War  5  does  many checks on user levels and is much safer than
1736       Liquid War 3. Still, try and help the program not to crash,  if  possi‐
1737       ble.
1738
1739       Liquid  War  considers that dark colors are walls and bright colors are
1740       associated to the playable area. So you can draw your walls  in  black,
1741       dark  blue,  etc...  And the rest of the map can be of any bright color
1742       such as white or yellow.
1743
1744       You can draw a small map on a big bitmap, as long as you use  a  bright
1745       background  color. Liquid War will autodetect the range of your map and
1746       add the border line if necessary.
1747
1748       Liquid War re-orders all the maps, so that the smallest ones are on the
1749       left  and  the  most complicated ones on the right when you choose them
1750       with the slider in the "map" menu. So if you can't  find  the  map  you
1751       just  draw, don't worry, it is probably just mixed with the levels from
1752       the .dat file.
1753
1754       The  default  path  for  maps  is   "custom\map\"   on   windows,   and
1755       "/usr/local/share/games/liquidwar/map" on GNU/Linux.
1756
1757
1758   Textures
1759       All  you  have  to do is put a bitmap in the default directory which is
1760       "custom\texture\"  on  windows,   and   "/usr/local/share/games/liquid‐
1761       war/texture" on GNU/Linux.
1762
1763
1764   Textures
1765       As  of  Liquid  War 5.6.x, it's possible to associate a map with a tex‐
1766       ture. All you need is to call the maps with  the  same  name  (case  is
1767       important,  lowercase  recommendend...).  Look at the "meditate" custom
1768       map which is shipped with Liquid War for instance.
1769
1770       This also works  with  internal  builtin  maps  (those  stored  in  the
1771       datafile)  so for instance if you name a custom texture "world1.bmp" it
1772       will automatically be associated to the builtin map world1  (to  figure
1773       out  internal names you have to unpack the source distribution and look
1774       in the ./data directory). This also works the other way, if you name  a
1775       map  "wood2.bmp"  it  will be automatically associated with the builtin
1776       texture wood2.
1777
1778       Associating a texture with a map requires more work  than  designing  a
1779       simple  map,  but  the results is usually much nicer. See the "Kasper -
1780       ..." series of maps for instance.
1781
1782
1783   Send your levels
1784       Maybe you will find that the original levels are ugly  and  unplayable.
1785       Well,  if you have made user levels and think they are great, just send
1786       them to the Liquid War user mailing list. Please use  only  256  colors
1787       bitmap  and zip them before sending them, or else they might be blocked
1788       by my provider...
1789
1790       As of today, dozens of user maps have already been included  in  Liquid
1791       War,  this  is very nice for it happens that every map designer has his
1792       own personnal tastes, so the maps all look different.
1793
1794       Still, to be included in Liquid  War's  mainstream  distribution,  your
1795       maps  will  need to be placed under the terms of the GNU General Public
1796       License, or at least a compatible license. You should have  received  a
1797       copy of this license with Liquid War anyway. Read it 8-)
1798
1799       Of course, you can use *any* map when playing. You can even play with a
1800       bitmap you got from a proprietary source - such a proprietary game  you
1801       bought  for  instance  -  but the point is that I can't - and you can't
1802       either - distribute such a map along with Liquid War.
1803
1804       However, this is enough legal boring stuff! What  you  should  keep  in
1805       mind  is  that  I'm  always happy when I receive maps from players, and
1806       it's a pleasure for me to include them in the mainstream distribution.
1807
1808

Core algorithm

1810   Introduction
1811       General remarks
1812
1813       If you have played Liquid War, you must have  noticed  that  your  army
1814       always  takes  the shortest way to reach the cursor. So the fundamental
1815       stuff in Liquid War is path-finding. Once you've done that the game  is
1816       quite  easy  to code. Not harder than any other 2D game. Still the path
1817       finding algorithm is an interesting one, for it's not a  common  method
1818       that we used.
1819
1820       Basically,  at  each round (by round I mean a game logical update, this
1821       occurs 10 or 100 times/sec depending on the level and/or your machine),
1822       the  distance from all the points of the level to your cursor is calcu‐
1823       lated. Now the point is to calculate this fast, real fast. In  fact,  a
1824       "gradient" is calculated for all the points of the level, and the value
1825       of this gradient is the distance required for a little pixel/fighter to
1826       reach  your cursor, assuming that he takes the shortest way. Liquid War
1827       does this with a 10% error tolerance, and it's enough for  keeping  the
1828       game interesting.
1829
1830       Once  you  have  this  gradient  calculated, it's not hard to move your
1831       fighters. Basically, you just have to move  them  toward  the  adjacent
1832       point  that  has  the  lowest gradient value, ie is the closest to your
1833       cursor.
1834
1835
1836       History
1837
1838       The Liquid War algorithm has been invented by my friend Thomas  Colcom‐
1839       bet  In fact the Liquid War algorithm has been invented before the game
1840       itself. The game came as  a  consequence  of  the  algorithm,  he  just
1841       thought "mmm, cool, we could make a game with that!".
1842
1843       Later, I enhanced the algorithm, as I coded it. The consequences were a
1844       performance increase, especially on simple but big levels. I mean  lev‐
1845       els with wide areas for teams to move. Still the basis of the algorithm
1846       remained the same.
1847
1848
1849       Pros
1850
1851       The Liquid War algorithm for path-finding is very efficient:
1852
1853       *  When you have to move lots of different  points  toward  one  single
1854          point. Good thing that's the rule of Liquid War!
1855
1856       *  When  you  have no clue about how your map will look like, ie if the
1857          walls are randomly placed.  The  complexity  of  the  level  doesn't
1858          influence  much  the  speed of the algorithm. The size does, but the
1859          complexity, ie the number of walls, is not so important.
1860
1861
1862
1863       Cons
1864
1865       The Liquid War algorithm is very  poor  compared  to  other  algorithms
1866       when:
1867
1868       *  You have several target destinations, that's to say Liquid War would
1869          be really slow if there were 100 teams with 10 players only.
1870
1871       *  You want to move one single point only.
1872
1873       *  > You want the exact (100% sure) path. In fact, this algorithm finds
1874          solutions  which  approach the best one but you can never figure out
1875          if the solution you found is the best, and the algorithm never ends.
1876          In  the  long  term,  the algo will always find the best solution or
1877          something really close but I don't know any easy way to  figure  out
1878          when you have reached this state.
1879
1880
1881
1882
1883   Mesh
1884       Introduction
1885
1886       The first Liquid War algorithm used to calculate the gradient (the dis‐
1887       tance from a point to your cursor) for every single point of the map.
1888
1889       With Liquid War 5, I used a mesh system. This mesh system is  a  struc‐
1890       ture  of squares connected together. Squares may be 1,2,4,8 or 16 units
1891       large or any nice value like that, and the gradient is only  calculated
1892       once  for  each square. Squares have connections between them, and each
1893       connection is associated to a direction.
1894
1895       There are 12 directions:
1896
1897       *  North-North-West (NNW)
1898
1899       *  North-West (NW)
1900
1901       *  West-North-West (WNW)
1902
1903       *  West-South-West (WSW)
1904
1905       *  South-West (SW)
1906
1907       *  South-South-West (SSW)
1908
1909       *  South-South-East (SSE)
1910
1911       *  South-East (SE)
1912
1913       *  East-South-East (ESE)
1914
1915       *  East-North-East (ENE)
1916
1917       *  North-East (NE)
1918
1919       *  North-North-East (NNE)
1920
1921
1922
1923       Example
1924
1925       Well, let me give you an example, supposing that  you  level  structure
1926       is:
1927
1928       **********
1929       *        *
1930       *        *
1931       *       **
1932       *        *
1933       **********
1934
1935       The * represent walls, that's to say squares where fighters can not go.
1936
1937       Then the mesh structure would be:
1938
1939       **********
1940       *11112233*
1941       *11112233*
1942       *1111445**
1943       *i1114467*
1944       **********
1945
1946       In this mesh, there are 7 zones:
1947
1948       *  zone 1 has a size of 4. It's linked with zones 2 (ENE) and 4 (ESE).
1949
1950       *  zone  2 has a size of 2. It's linked with zones 3 (ENE,ESE), 5 (SE),
1951          4 (SSE,SSW) and 1 (SW,WSW,WNW).
1952
1953       *  zone 3 has a size of 2. It's linked with zones 5 (SSW), 4 (SW) and 2
1954          (WSW,WNW).
1955
1956       *  zone  4 has a size of 2. It's linked with zones 2 (NNW,NNE), 4 (NE),
1957          5 (ENE), 6 (ESE) and 1 (WSW,WNW,NW).
1958
1959       *  zone 5 has a size of 1. It's linked with  zones  3  (NNW,NNE,NE),  7
1960          (SE), 6 (SSE,SSW), 4 (SW,WSW,WNW) and 2 (NW).
1961
1962       *  zone  6  has  a  size  of  1.  It's linked with zones 5 (NNW,NNE), 7
1963          (ENE,ESE) and 4 (WSW,WNW,NW).
1964
1965       *  zone 7 has a size of  1.  It's  linked  with  zones  5  (NW)  and  6
1966          (WSW,WNW).
1967
1968
1969
1970       Why such a complicated structure?
1971
1972       Because it allows the module which calculates the gradient to work much
1973       faster. With this system, the number of zones is  reduced  a  lot,  and
1974       calculus  on  the  mesh  can  go very fast. At the same time, this mesh
1975       structure is complicated to understand by us humans but it's very  easy
1976       for the computer.
1977
1978
1979
1980   Gradient
1981       Introduction
1982
1983       For  each  zone defined in the mesh, LW calculates an estimation of the
1984       distance between the cursor and this zone.
1985
1986       The algorihm is based on the fact that to cross a zone which size is n,
1987       n movements are required. Easy, eh?
1988
1989
1990       Description
1991
1992       Here's the way the algorithm works:
1993
1994       for each turn of the game, do:
1995
1996       *  pick  up a direction between the 12 defined directions. They have to
1997          be chosen is a peculiar order to avoid weird behaviors  from  fight‐
1998          ers,  but  let's suppose we just pick up the "next" direction, ie if
1999          WSW was chosen the last time, we pick up WNW.
2000
2001
2002       and then for each zone in the mesh, do:
2003
2004       *  Compare the potential of the current zone with that of its  neighbor
2005          zone. The neighbor zone to be chosen is the one which corresponds to
2006          the direction which has been previously picked up, and by  potential
2007          I  mean  "the  distance  to the cursor, estimated by the algorithm's
2008          last pass".
2009
2010       *  If potential_of_the_neighbor_zone > (potential_of_the_current_zone +
2011          size_of_the_current_zone)   then   potentiel_of_the_neighbor_zone  =
2012          potential_of_the_current_zone + size_of_the_current_zone
2013
2014
2015
2016       How can this work?
2017
2018       Well, just ask my friend thom-Thom, he's the one who had  the  idea  of
2019       this algorithm!
2020
2021       The  basic  idea is that by applying this simple rule to all the zones,
2022       after a certain amount of time, it's impossible to find  any  place  in
2023       the  mesh  where  the  rule is not respected. And at this time, one can
2024       consider the potiential is right in any point.
2025
2026       Of course when the cursor moves the potential has to  be  recalculated,
2027       but you see, cursors move really slowly in Liquid War, so the algorithm
2028       has plenty of time to find a new stable solution...
2029
2030
2031       Demo
2032
2033       It's possible to see this algorithm working by typing:
2034
2035       ufootgrad[n]
2036
2037       while playing, where [n] is the number of  the  team  the  gradient  of
2038       which you want to view. The game is still running but you view a team's
2039       gradient being calculated in real time instead of seeing the fighters.
2040
2041       If you type ufootgrad0 the display comes back to normal mode.
2042
2043
2044
2045   Move
2046       Introduction
2047
2048       Once the gradient is calculated for any zone on the  battlefield,  it's
2049       quite easy to move the fighters, hey?
2050
2051       The following method is used to move the players:
2052
2053       *  A "main direction" is chosen for the fighter, this direction is cho‐
2054          sen using the gradient calculated on the mesh.
2055
2056       *  Knowing which direction is the main one, a "level  of  interest"  is
2057          applied to the 12 defined directions.
2058
2059
2060       There are 4 "level of interest" for directions:
2061
2062       *  Main directions: the direction calculated.
2063
2064       *  Good  directions:  these  directions  should lead the fighter to the
2065          cursor.
2066
2067       *  Acceptable directions: ok, one can use  this  direction,  since  the
2068          fighter shouldn't loose any time using it.
2069
2070       *  Unpossible directions: wether there's a wall or using this direction
2071          means the fighter will be farer from  his  cursor  than  before,  it
2072          always means that this direction will not be used, never.
2073
2074
2075
2076       Rules
2077
2078       The  fighters will try to find any matching situation in this list, and
2079       chose the first one.
2080
2081       *  The main direction is available, no one on it, OK, let's follow it.
2082
2083       *  There's a good direction with no one on it, OK, let's follow it.
2084
2085       *  There's an acceptable direction with no one on it, OK, let's  follow
2086          it.
2087
2088       *  The  main  direction  is available, but there's an opponent on it, I
2089          attack! By attacking, one means that  energy  is  drawned  from  the
2090          attacked  fighter and transmitted to the attacker. When the attacked
2091          fighter dies, he belongs to the team which killed him.
2092
2093       *  A good direction is available, but there's  an  opponent  on  it,  I
2094          attack!
2095
2096       *  The  main  direction  is available, but there's a mate on it, I cure
2097          him. That's to say that energy is given to the mate. This way,  when
2098          there's  a big pool of fighters from the same team, they re-generate
2099          each other.
2100
2101       *  None of the previous situations found, do nothing.
2102
2103
2104
2105       Tips and tricks
2106
2107       The behavior of the armies is quite tricky to set up. I had  myself  to
2108       try  many algorithms before I came to something nice. In fact, I had to
2109       introduce some "random" behaviors. They are not  really  random  for  I
2110       wanted  the game to behave the same when given the same keyboard input,
2111       but for instance, fighters will prefer NNW to NNE sometimes, and NNE to
2112       NNW  some  other times. By the way, I think Liquid War could stand as a
2113       nice example of the thoery of chaos.
2114
2115
2116

Source code

2118   General remarks
2119       Modularity
2120
2121       Liquid War 5 is basically a big C program.  I've  splitted  the  source
2122       code  in many small files for I do not like to have to handle big mono‐
2123       lithic sources, but this does not mean Liquid War is very  modular.  In
2124       fact Liquid War 5 is quite bloated with global variables and other ugly
2125       stuff 8-(
2126
2127
2128       Coding style
2129
2130       To be honest, it's a big mess. You won't find 2 files coded in the same
2131       maner...  OK,  I'm  exagerating a bit. From now I try to make an effort
2132       and stick to basic rules such as:
2133
2134       *  use the GNUish-style indentation - the default Emacs mode in fact
2135
2136       *  prefix global  functions  /  variables  /  constants  /  types  with
2137          lw_<NAME_OF_THE_file>_. For instance, a "do_it" function in myfile.c
2138          will be called lw_myfile_do_it
2139
2140       *  use capitals for constants, globals and types  only.  All  functions
2141          are in lowercase with "_" to separate words
2142
2143       *  keep  on using 8.3 filenames for .c source files. This is for better
2144          DOS integration. DOS version of Liquid War is still maintained,  you
2145          know 8-)
2146
2147       *  use English only for code and comments
2148
2149
2150       I  might decide to rename and cleanup everything some day, for it would
2151       help other coders to understand what I wrote, but well,  this  is  cer‐
2152       tainly not a thrilling task 8-/
2153
2154
2155
2156   Source files organization
2157       Main game code
2158
2159       Here  you'll  find  the  main()  function, the main game loop, applica‐
2160       tion-wide constants and other global stuff.
2161
2162       It might be a good start if you want to hack the code.
2163
2164       *  base.h: contains global constants used in many different files.
2165
2166       *  game.c / game.h: contains the main game loop.
2167
2168       *  main.c / main.h: the file where the main  C  function  is  declared.
2169          Doesn't  contain  much except calling init functions and running the
2170          GUI.
2171
2172
2173
2174       Menus
2175
2176       The menus are coded using the Allegro GUI system. While this system  is
2177       very  powerfull, it's IMHO not adapted to very complex GUIs, and one of
2178       its drawbacks is that it's not  so  easy  to  redesign  something  once
2179       you've coded it.
2180
2181       Besides,  when  I  started coding the GUI in 1998, I did it in a rather
2182       ugly way, and now I'm paying for my being lazy at that  time,  since  I
2183       spent hours coding when I want to change something 8-/
2184
2185       *  about.c / about.h: contains the code for the about menu.
2186
2187       *  advanced.c / advanced.h: contains the GUI advanced options menu.
2188
2189       *  connect.c  /  connect.h:  contains code for the "connect" menu which
2190          displays which players are connected to the server, before the  game
2191          actually starts.
2192
2193       *  controls.c / controls.h: contains the code for the controls menu.
2194
2195       *  graphics.c / graphics.h: code for the graphic options menu.
2196
2197       *  internet.c  /  internet.h:  contains  the  code  for the "Search for
2198          Internet games" menu, where one can pick up a running  server  auto‐
2199          matically with the help of the meta-server.
2200
2201       *  language.c / language.h: contains the code for the "Language" menu.
2202
2203       *  level.c  /  level.h: contains code for the menu where the player can
2204          select a level and its options (texture or color).
2205
2206       *  menu.c / menu.h: contains the code for the main menu.
2207
2208       *  netgame.c / netgame.h: contains the code for the net game menu.
2209
2210       *  options.c / options.h: contains the code for the options menu.
2211
2212       *  play.c / play.h: contains the code which ties the menu to  the  main
2213          gameloop.
2214
2215       *  rules.c / rules.h: code for the rules menu.
2216
2217       *  score.c / score.h: functions to display the scores at the end of the
2218          game.
2219
2220       *  speeds.c / speeds.h: contains the code for the speeds menu.
2221
2222       *  team.c / team.h: code for the team  menu,  where  one  choses  which
2223          teams will play.
2224
2225       *  volume.c / volume.h: code for the sound menu.
2226
2227       *  wave.c / wave.h: code for the wave menu.
2228
2229
2230
2231       GUI tools
2232
2233       These files contain various utilities which are used in the menus.
2234
2235       *  alleg2.c  /  alleg2.h:  contains  some  tweaked allegro functions. I
2236          wanted to use bitmaps with sevral colors for my  fonts,  and  change
2237          some  of  the allegro default behavior. So rather than modifying the
2238          allegro source code right in the library I copied it  in  this  file
2239          and then modified it.
2240
2241       *  back.c / back.h: this modules displays the background image.
2242
2243       *  dialog.c / dialog.h: contains code for standard dialog boxes.
2244
2245       *  error.c / error.h: contains functions to display error messages once
2246          the game is in graphical mode.
2247
2248       *  help.c / help.h: generic  functions  to  display  the  various  help
2249          pages.
2250
2251
2252
2253       Core algorithm
2254
2255       Here's  *the*  interesting part. All the rest of the code is just sugar
2256       coat to display stuff, receive players commands, communicate with other
2257       computers, handle errors, etc... But the real thing is here!
2258
2259       It's funny to note that these files have almost not been modified since
2260       Liquid War 5.0.
2261
2262       It's also interesting to note that they represent a small percentage of
2263       the  total  amount  of  code in the game. This tends to prove - and I'm
2264       convinced of it - that game programming does not only consists in  hav‐
2265       ing  great  ideas,  but also requires a lot of "dirty" and boring work.
2266       Honestly, coding an option menu is as boring as coding Liquid War algo‐
2267       rithm is fun.
2268
2269       *  fighter.c  /  fighter.h:  contains code to move the armies, once the
2270          gradient has been calculated.
2271
2272       *  grad.c / grad.h: this module calculates the gradient for each  team.
2273          One  could  say it's the "kernel" of the game, since most of the CPU
2274          time is spent in this module (except if you have a slow display...).
2275
2276       *  mesh.c / mesh.h: contains code to set up a usable mesh with  a  map.
2277          Mesh  are re-calculated at each time a new game is started, the rea‐
2278          son for this being that meshes are *very* big so  it  would  not  be
2279          reasonnable to save them directly on the HD.
2280
2281       *  monster.s / monster.h: assembly functions to speed-up the game. It's
2282          a replacement for some fighter.c functions.
2283
2284       *  spread.s / spread.h: contains assembly replacements for  some  func‐
2285          tions  of  grad.c.  These replacements do the same than the original
2286          ones from grad.c, but faster. Could still be optimized.
2287
2288
2289
2290       Moving cursors
2291
2292       It looks like nothing, but moving a cursor and deciding where it should
2293       go if there's a wall in front of it is not that easy, especially if you
2294       want things to work nicely.
2295
2296       *  autoplay.c / autoplay.h: contains the code for the computer AI. This
2297          module  simulates keypresses from the computer, then the computer is
2298          handled as any other player.
2299
2300       *  move.c / move.h: provides an API to move the cursors.
2301
2302
2303
2304       User input
2305
2306       Until 5.4.0, Liquid War did not have network support. As it is designed
2307       to  be multiplayer, one needed to have several players on the same com‐
2308       puter. The mouse also needed to be handled in a special way since  cur‐
2309       sors  can  *not*  pass walls in Liquid War. Additionnally, I wanted all
2310       input channels (keyboard mouse and joystick) to be handled in a unified
2311       way.
2312
2313       This  explains  why there's so much code for user input, when one would
2314       think at first sight that "polling the keyboard is enough".
2315
2316       *  joystick.c / joystick.h: contains code to support joystick input. It
2317          wraps  joystick  buttons  to virtual keyboard keys, so that joystick
2318          and keyboard behave exactly the same.
2319
2320       *  keyboard.c / keyboard.h: contains code to handle key presses.
2321
2322       *  mouse.c / mouse.h: wraps the mouse  movements  to  virtual  keyboard
2323          keys. This way the mouse can be used to control the players.
2324
2325
2326
2327       Initialisations
2328
2329       These  files  contain  functions  to intialize various game components.
2330       100% boring code.
2331
2332       *  area.c / area.h: contains functions to create the game  area.  Basi‐
2333          cally  it  contains functions to create the data structures in which
2334          the level is stored during the game.
2335
2336       *  army.c / army.h: functions to create the armies, and place  them  on
2337          the battlefield.
2338
2339       *  asm.c  /  asm.h:  various  constants, macros and utilities to ensure
2340          that asembly code works correctly.
2341
2342       *  bigdata.c / bigdata.h: I had a really  hard  time  with  the  malloc
2343          function  with DJGPP under Win95 dos box. I tried to have it working
2344          for hours and hours but my program kept being buggy. So I decided to
2345          allocate  the  memory  myself, in a memory zone I create at startup.
2346          This is what this module does: create a huge memory  zone  and  then
2347          give parts of it to the rest of the program.
2348
2349       *  config.c / config.h: contains everything that is related to the game
2350          configuration. This module contains  in  global  variables  all  the
2351          parameters that are stored in the config file.
2352
2353       *  cursor.c / cursor.h: contains the code to init the cursors and place
2354          them on the battlefield at the beginning of the game.
2355
2356       *  decal.c / decal.h: This module makes  the  link  between  teams  and
2357          players.  Its  coding  is  quite ugly, for some modules in LW assume
2358          that when 2 teams are playing they are always teams 0 and 1. So when
2359          3  teams  are playing are playing and the second team loses, one has
2360          to make team 2 become team 1. That's what this module is for.
2361
2362       *  exit.c / exit.h: contains code that is executed when the game  ends,
2363          it shuts down Allegro and displays messages on the console.
2364
2365       *  gfxmode.c  /  gfxmode.h:  contains  code to set up the various video
2366          modes, and defines which modes are available for each platform.
2367
2368       *  init.c / init.h: contains code to  initialize  Allegro  with  proper
2369          options and analyze failures.
2370
2371       *  palette.c / palette.h: contains function to set up the current color
2372          palette. Liquid War uses different palettes, depending on what  col‐
2373          ors are chosen for teams.
2374
2375
2376
2377       Graphics
2378
2379       Here lies most of the graphic functions in Liquid War. There's not that
2380       much code since Liquid War's strength is not its  visual  effects,  but
2381       rather its gameplay.
2382
2383       The only "funny" thing is the wave effect. I'm quite happy with it, and
2384       honestly, I do think it is rather fast, given the fact that it uses  no
2385       3D hardware at all.
2386
2387       *  disp.c / disp.h: contains functions to display the battlefield.
2388
2389       *  distor.c  /  distor.h: this module contains code to create the "wave
2390          effect". It uses a lot of data tables, and is quite  complicated  to
2391          understand...
2392
2393       *  glouglou.s  /  glouglou.h:  assembly module, it is a replacement for
2394          some functions of distor.c. It goes much faster but does the same.
2395
2396       *  info.c / info.h: contains code to display the info bar. The info bar
2397          is the bar which display the time left and the amount of players for
2398          each team while the game is running.
2399
2400       *  message.c / message.h: provides an API to  display  messages  during
2401          the  game.  Very useful if you want to debug the game: you can trace
2402          and display anything.
2403
2404       *  pion.c / pion.h: contains code to display the cursors.
2405
2406       *  viewport.c / vieport.h: code to allocate and resize the  zone  where
2407          the map is displayed, also called "viewport".
2408
2409
2410
2411       Sound and music
2412
2413       Sound  and  music  routines required some encapsulation, since the game
2414       must be able to run even if the sound and/or music did  not  load  cor‐
2415       rectly.
2416
2417       *  music.c / music.h: contains the code to control MIDI playback.
2418
2419       *  sound.c / sound.h: functions to play sound.
2420
2421
2422
2423       Data management
2424
2425       These functions handle the datafile contents and also the custom data.
2426
2427       Note  that the various utilities such as liquidwarcol, liquidwarmap and
2428       liquidwartex do not share code with the main executable. This is  obvi‐
2429       ously  a design error, for liquidwarmap will handle maps in a very poor
2430       way and is unable to autodetect map errors, whereas the  game  does  it
2431       rather well. Blame the programmer.
2432
2433       *  disk.c  / disk.h: contains all the code to access data from the hard
2434          drive. In fact, all the HD access is done at startup.
2435
2436       *  map.c / map.h: contains code to load the maps from  a  datafile  raw
2437          data or a user defined bitmap to a usable structure in RAM.
2438
2439       *  maptex.c  /  maptex.h: contains code to handle the "use default tex‐
2440          ture" option, and associate a map with  a  given  texture  automati‐
2441          cally.
2442
2443       *  texture.c  /  texture.h:  contains code to handle textures. Textures
2444          are stored in a special format which uses 5 bits per pixel.
2445
2446
2447
2448       Random map generator
2449
2450       Liquid War has a "generate  random  map"  feature  which  is  available
2451       within  the  game  and also as an external program. The source code for
2452       the external program is in ./utils/lwmapgen in Liquid War  source  dis‐
2453       tribution.  This program has been coded by David Redick, is also avail‐
2454       able  on  http://www.cs.clemson.edu/~dredick/lwmapgen/  and  works   on
2455       GNU/Linux.  Compiling this program under DOS and/or Windows is untested
2456       and unsupported.
2457
2458       The random map generator within Liquid War - which of course  works  on
2459       any  platform support by LW - uses for its greater part the same source
2460       code as the external lwmapgen program.
2461
2462       *  random.c / random.h: wrapper for the map generator written by  David
2463          Redick. It basically does the same as ./utils/lwmapgen/main.c except
2464          that it does it within Liquid War as it is running  and  not  in  an
2465          external independant program.
2466
2467
2468
2469       Time handling
2470
2471       Time handling is fundamental in a game. Time is used for visual effects
2472       (waves...) during the game, it's used to generate  some  pseudo  random
2473       stuff, well, it's used everywhere!
2474
2475       Note  that  on the client, I use 2 "different" clocks. The first counts
2476       the "real" time, in seconds. The second one is counts "rounds"  and  is
2477       incremented by 1 at each game round.
2478
2479       *  srvtime.c / srvtime.h: code used to handle time on the server, where
2480          Allegro's functions are not available.
2481
2482       *  ticker.c / ticker.h: sets up a timer callback.
2483
2484       *  time.c / time.h: functions to know how long the game has  been  run‐
2485          ning, knowing that it can be interrupted.
2486
2487
2488
2489       In-game utilities
2490
2491       These  are  various utilities use to monitor and control the game while
2492       one's playing.
2493
2494       *  capture.c / capture.h: code used to capture the video output of  the
2495          game and store it in .bmp files while playing.
2496
2497       *  checksum.c  /  checksum.h:  utilities  to generate a checksum from a
2498          given game state. Used in network code to make sure all the  clients
2499          stay synchronized.
2500
2501       *  code.c  /  code.h: This file contains the code to handle key presses
2502          during the game. That's to say the pause key for instance.
2503
2504       *  profile.c / profile.h: provides tools to calculate how fast the game
2505          is runnning and what operations slow it down.
2506
2507       *  watchdog.c  / watchdog.h: this module waits for "secret codes" to be
2508          typed while the game is running, and traps them.
2509
2510
2511
2512       Command line handling
2513
2514       OK, now to all the UNIX guys, I *know* there are many ways to do things
2515       in  a  better and simple way than I did. But keep in mind that in 1998,
2516       under DOS, I had a rotten command line and even now I  need  everything
2517       to work on both UNIX and Microsoft platforms.
2518
2519       These utilities are not perfect, but they work, that's all I ask them.
2520
2521       *  basicopt.c  / basicopt.h: handles basic command line parameters such
2522          as "-v" or "-h".
2523
2524       *  parser.c / parser.h: contains code to parse and analyze the  command
2525          line parameters.
2526
2527       *  startup.c  /  startup.h:  analyzes  the  command line parameters and
2528          stores them into global variables.
2529
2530
2531
2532       Locale support
2533
2534       Liquid War now has locale support. Basically, all the labels and  texts
2535       in the UI are stored in constants. There's simply file per language.
2536
2537       Note  to  translators:  if you decide to translate the menus in another
2538       language, keep in mind that all the translations must fit in the  vari‐
2539       ous  buttons  and textboxes. The best resolution to test this - the one
2540       where letters take most place - is 640x480.
2541
2542       *  lang.c / lang.h: contains code to handle language dependant stuff.
2543
2544       *  langen.c / langen.h: contains code to handle English specific stuff.
2545
2546       *  langfr.c / langfr.h: contains code to handle French specific stuff.
2547
2548
2549
2550       Log and various messages
2551
2552       OK, the API of the log routines is a piece of crap. Now I'm simply  too
2553       lazy to change it. It works, that's all I ask.
2554
2555       BTW,  there's  a  clear  advantage  in  using custom-made log functions
2556       instead of plain calls to "fprintf(stderr,...". It might not be obvious
2557       for  UNIX  users,  but  think  about  Windows. Nothing like a "tail -f"
2558       there, nor a proper output redirection system. When a  user  clicks  on
2559       the  Liquid  War  icon,  I want "console" information to be logged in a
2560       file!
2561
2562       *  log.h: common header for logcli.c and logsrv.c.
2563
2564       *  logcli.c: contains code to display messages  on  the  console.  It's
2565          usefull  for  console may have different behaviors when the games is
2566          used on different platforms.  This  file  is  used  to  compile  the
2567          client.
2568
2569       *  logsrv.c:  contains  code  to  display messages on the console. This
2570          file is used to compile the server, which does not  use  Allegro  at
2571          all.
2572
2573       *  popupgen.h: common header for popup functions.
2574
2575       *  popupw32.c: code to handle popup on the Win32 platform. Popups are a
2576          must-have under Windows for error  diagnostics,  since  the  average
2577          Windows user never gives any look at any log file...
2578
2579
2580
2581       Macros, utilities and string support
2582
2583       As usual, I needed to prepare a small set of usefull macros.
2584
2585       *  macro.h: contains basic wrappers/macros for snprintf like functions.
2586          This mostly to ease up string manipulation which is - as always -  a
2587          nightmare in standard C.
2588
2589       *  path.c  /  path.h:  code  used  to  handle  filenames and paths, for
2590          instance remove path and file extension from a filename.
2591
2592
2593       It's also important to note that Liquid War uses  snprintf  instead  of
2594       sprintf, for using the latter is very likely to cause buffer overflows.
2595       Under Linux glibc provides this function but Microsoft does not provide
2596       it  natively on Windows. Therefore I used a third party snprintf imple‐
2597       mentation by Mark  Martinec:  http://www.ijs.si/software/snprintf/  and
2598       its  source  is available in the ./utils directory of Liquid War source
2599       distribution.
2600
2601
2602       Byte order and endianess
2603
2604       As you might know, PC Intel based computers are  "little-endian"  while
2605       Sun Sparc stations and Mac computers are "big-endian". This is an issue
2606       for LW since in network games maps are transmitted  in  binary  format.
2607       Therefore I needed to set up some (un)serialization fonctions.
2608
2609       *  serial.c / serial.h: code used to transform integers and map headers
2610          into an uniform cross-platform byte stream which is readable by both
2611          little and big endian machines.
2612
2613
2614
2615       Thread support
2616
2617       Liquid  War does have thread support, but it is a "limited" thread sup‐
2618       port. I mean that the game is generally monothreaded, but a  few  func‐
2619       tions  use  threads.  For  instance,  calls to the meta-server are done
2620       within threads.
2621
2622       Basically, I do not really enjoy programming in a  multithreaded  envi‐
2623       ronnement.  So  when  possible,  I  chose the monothread path, and used
2624       threads only where I simply would not be able to find  another  accept‐
2625       able solution.
2626
2627       I also needed to use some mutexes to prevent crashes in the user inter‐
2628       face.
2629
2630       *  mutxdos.c: provides fake mutex support under  DOS.  This  module  is
2631          here only to make compilation easier.
2632
2633       *  mutxgen.h: header for mutxdos.c, mutxunix.c and mutxw32.c.
2634
2635       *  mutxunix.c: provides mutex support on UNIX.
2636
2637       *  mutxw32.c: provides mutex support on Win32.
2638
2639       *  thrddos.c:  provides  fake  thread support under DOS. This module is
2640          here only to make compilation easier.
2641
2642       *  thrdgen.h: header for thrddos.c, thrdunix.c and thrdw32.c.
2643
2644       *  thrdunix.c: provides thread support on UNIX.
2645
2646       *  thrdw32.c: provides thread support on Win32.
2647
2648
2649
2650       Launching external programs
2651
2652       Liquid War might sometimes launch external programs. This is (for secu‐
2653       rity reason) not a default behavior and has to be activated and config‐
2654       ured by yourself, using the "-callback"  command  line  option  on  the
2655       server for instance.
2656
2657       *  execgen.h: header for execunix.c and execw32.c.
2658
2659       *  execunix.c: code to launch external programs on UNIX.
2660
2661       *  execw32.c: code to launch external programs on Win32.
2662
2663       *  exec2.c: code to launch external programs within the client, without
2664          any interaction with the user, ie no  unwanted  popping  window  for
2665          instance.
2666
2667
2668
2669       Low-level network code
2670
2671       There  are network packages for Allegro, but I decided not to use them.
2672       Socket support is not that hard to implement under UNIX and  Win32  and
2673       besides, I've done it for my job recently, so I just knew how to do it.
2674
2675       Another  reason  which  decided me to code my own toolbox is that I did
2676       not want Liquid War to have external dependencies - except  Allegro  of
2677       course.  This  way, UNIX gamers to not have to set up and/or download a
2678       specific network library. It's also easier to  integrate  the  game  in
2679       projects like Debian if it has few dependencies.
2680
2681       This network code is not a masterpiece, it's just a little set of tools
2682       that have proven to work. That's all.
2683
2684       BTW, it's important to notice that  when  linking  with  Allegro,  most
2685       blocking UNIX calls ("sleep" or "recv" for instance) stop working: they
2686       alwasys return immediately. This led me to implement weird ugly  hacks,
2687       like  calling  "recv"  in a loop until it gets what it wants... This is
2688       theorically and practically a performance killer, but I found no  other
2689       way  to  fix  this. And FYI, this is not an Allegro bug, it's a feature
2690       8-)
2691
2692       *  dnsutil.c / dnsutil.h: wrapper code to issue DNS  requests,  without
2693          having to handle the hostent struct.
2694
2695       *  sock2cli.c:  sode  used  to  wrap  low-level network function on the
2696          client.
2697
2698       *  sock2gen.h: header for sock2cli.c and sock2srv.c.
2699
2700       *  sock2srv.c: code used to wrap  low-level  network  function  on  the
2701          server.
2702
2703       *  sockdos.c: network API for DOS.
2704
2705       *  sockex.c: netowrk routines shared by sockunix and sockw32.
2706
2707       *  sockgen.h: header for sockdos.c, sockunix.c and sockw32.c.
2708
2709       *  sockunix.c: network API for UNIX.
2710
2711       *  sockw32.c: network API for Win32.
2712
2713
2714
2715       High-level network code
2716
2717       These files contains network utilities which are Liquid War specific.
2718
2719       *  chat.c  /  chat.h: functions used to handle chat messages in network
2720          games.
2721
2722       *  keyexch.c / keyexch.h: functions to send and  receive  keys  to  the
2723          server. Used on the client.
2724
2725       *  netconf.c  /  netconf.h:  code to send and receive the config of the
2726          clients over the network.
2727
2728       *  netkey.c / netkey.h: contains some tools to manipulate  key  strokes
2729          over the network.
2730
2731       *  netmap.c / netmap.h: code to send and receive the maps over the net‐
2732          work.
2733
2734       *  netmess.c / netmess.h: contains a parser  to  interpret  plain  text
2735          messages. Used when exhanging information over the network.
2736
2737       *  netplay.c / netplay.h: contains the code to set up and start network
2738          games.
2739
2740       *  network.c / network.h: contains some network related  functions  and
2741          constants used on the client.
2742
2743       *  ping.c  /  ping.h:  code  used on the client to estimate the average
2744          ping time with a server.
2745
2746       *  protocol.c / protocol.h: contains the sequence of messages send  and
2747          recevied by the client when connecting on the server.
2748
2749       *  startinf.c  /  startinf.h:  contains struct and tools to handle some
2750          network informations while starting a network game.
2751
2752
2753
2754       Communication with the meta-server
2755
2756       The meta-server is called by both client  and  server.  Basically,  the
2757       server registers itself, and the client asks for a list of servers.
2758
2759       The  meta-server itself is just a set of simple PHP scripts with a sim‐
2760       ple MySQL database. I chose PHP because my provider allows execution of
2761       PHP pages, that's all.
2762
2763       The  protocol  is *very* basic, and uses HTTP 1.0 for requests. Answers
2764       are received in plain text, with one information per line.  There's  no
2765       garantee  that  this  would  work  with any HTTP server, but experience
2766       proved that it works with my provider 8-)
2767
2768       *  httputil.c  /  httputil.h:  low  level  functions  to  handle   http
2769          requests.
2770
2771       *  wwwcli.c / wwwcli.h: code used on the client to communicate with the
2772          meta-server.
2773
2774       *  wwwsrv.c / wwwsrv.h: code used on the server to communicate with the
2775          meta-server.
2776
2777
2778
2779       Server code
2780
2781       The Liquid War server is a rather small program. The only thing it does
2782       is accept new players, transmit map and game parameters  between  them,
2783       and then "replicate keys".
2784
2785       By  "replicate  keys" I mean that the server asks each client what keys
2786       have been pressed during the  last  round,  and  then  dispatches  this
2787       informations  to  all  clients.  This implies that the server has abso‐
2788       lutely no idea of who's loosing, who's winning, etc...
2789
2790       All the "logic" of the server is coded in these files, the rest is only
2791       utilities and helper functions.
2792
2793       *  server.c  / server.h: main code for the server (equivalent of main.c
2794          for the client).
2795
2796       *  srvchan.c / srvchan.h: code used to handles channels on the  server.
2797          A  channel  is associated to a given computer and may manage several
2798          teams.
2799
2800       *  srvcont.c / srvcont.h: global network controler used on the server.
2801
2802       *  srvteam.c / srvteam.h: code used to handle teams on the server.
2803
2804
2805
2806

Bugs

2808   Report a new bug
2809       If you have troubles with Liquid War 5, if you think it is a  bug,  and
2810       if  it  is  not  described  in this file, then just send a (precise...)
2811       decription of your problem to the Liquid War user mailing list.
2812
2813       Besides, it happens that now most bug  reports  come  from  the  Debian
2814       tracking  system "http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=liq
2815       uidwar". Thanks to the Debian users and maintainers, it's a very  valu‐
2816       able feedback source.
2817
2818       Additionnaly,  on  online  bug tracking system has been set up. It uses
2819       Flyspray     http://flyspray.rocks.cc/.     It's     accessible      on
2820       http://www.ufoot.org/bugtracker/      or     "http://www.ufoot.org/bug
2821       tracker/index.php?project=2". I try to collect everything here  :  bugs
2822       reported  on  the  mailing-list,  bugs  from  Debian,  and bugs I found
2823       myself. Alternatively you can report bugs directly on it 8-)
2824
2825
2826   Network
2827       Network support in Liquid War is far from being perfect, so there are a
2828       bunch  of little problems which can appear. Basically, once the game is
2829       correctly started on a LAN, you should have no  problems,  but  getting
2830       the game started might be difficult.
2831
2832
2833   Mouse does not work
2834       Some  users  reported  that  they were unable to control the Liquid War
2835       cursor with the mouse. Well, the answer is a typical Microsoftish "this
2836       ain't a bug, it's a feature!".
2837
2838       More seriously, you're supposed to move the cursor with the keyboard in
2839       Liquid War. There's no way to handle the cursor "like a mouse  pointer"
2840       (*). This is due to:
2841
2842       *  Severe limitations in the Liquid War core algorithm.
2843
2844       *  The  fact  that moving the cursor "too fast" would really change the
2845          gameplay of Liquid War. As a Liquid War integrist 8-) I can tell you
2846          the  game  would really not be the same if you could move the cursor
2847          as fast as you wish. It's part of the game that sometimes  it  takes
2848          you  ages  to recover from a strategical mistakes. You need to think
2849          twice before going to the very end of a level. That's  strategy.  At
2850          least  that's  how  I  view  things... Anyways as I mentionned above
2851          there's a limitation in the core algorithm.
2852
2853
2854       (*) This is not perfectly true, there's a way  to  control  the  cursor
2855       with  the  mouse, but it's designed for the case "4 people want to play
2856       on the same computer and one single keyboard is not  enough".  Control‐
2857       ling the cursor with the mouse in Liquid War is possible but yet rather
2858       hard to master 8-/ Try it and you'll understand what I mean. This  mode
2859       can be set up in the "Teams" menu.
2860
2861
2862   Game does not start
2863       On non UNIX platforms such as Windows or DOS, Liquid War is distributed
2864       in a .zip file. It's IMPORTANT that you unzip the .zip  files  with  an
2865       "unzipper"  which preserves the directory structure. Most install prob‐
2866       lems under Windows come from broken unzipping  programs  which  extract
2867       all  files in the same directory... WinZip 8.x or the unzip32.exe util‐
2868       ity that comes with DJGPP are both able to uncompress Liquid  War  .zip
2869       files correctly.
2870
2871       On  Liquid  War 5.5.9 and later, the Windows version should detect this
2872       problem automatically and warn you with a message which basically  says
2873       something  like  "Unable  to  load datafile. Are you sure Liquid War is
2874       correctly installed?". If you get this message, you need  to  reinstall
2875       the  game by unzipping it with a "correct" unzipping program which does
2876       not wreck directory structrure up.
2877
2878
2879   Interference with other Windows programs
2880       It's been reported that Liquid War can run very slowly on Windows  when
2881       some  other  programs  (Mozilla for instance) are running. So if Liquid
2882       War's menus seem to be really really slow, then try to shut down  other
2883       applications and run the game again.
2884
2885       This  problem  does not seem to apply on GNU/Linux - at least if you do
2886       not run 300 daemons together on your machine 8-)
2887
2888
2889   Datafile bugs
2890       Sometimes there are some problems when  compiling  the  datafile,  this
2891       includes:
2892
2893       *  The  liquidwarcol,  liquidwarmap  and  liquidwartex  utilities might
2894          freeze or segfault. Typing "make" again often solves the problem.
2895
2896       *  The background image sometimes ends  up  using  the  wrong  palette,
2897          which has a very nasty consequence: it looks ugly.
2898
2899
2900       These  bugs  are  quite  hard to get rid off, since I can not reproduce
2901       them easily. The good solution would be to completely rewrite the  liq‐
2902       uidwarcol, liquidwarmap and liquidwartex utilities.
2903
2904
2905   Midi does not work on OSS
2906       Preamble
2907
2908       IF  your  midi  music  on Liquid War, or indeed any other Allegro game,
2909       doesn't work and you are using the  OSS  (Open  Sound  System)  drivers
2910       (these  are  the sound drivers which come with the standard kernel dis‐
2911       tribution), this may well be because Allegro only supports "FM  synthe‐
2912       sis"  and  not "wavetable" when it is using OSS. FM synthesis is a very
2913       old method of making sound from MIDI and has long since  been  replaced
2914       by  wavetable  synthesis,  with the net result that it's quite possible
2915       you've got OSS MIDI working nicely in other applications without having
2916       FM support set up at all. This is what I found. (It has to be said that
2917       I didn't find the FM sound quality quite as bad as  people  have  said,
2918       though).
2919
2920       In this situation, it looks to me like you have the following choices:
2921
2922
2923       Hack Allegro...
2924
2925
2926
2927       and for the rest of us...
2928
2929
2930       Use Allegro's DIGMID midi driver...
2931
2932
2933
2934
2935       Get an FM driver up and running...
2936
2937
2938
2939       *  Find  out which FM driver is appropriate for your sound card. If you
2940          have distribution-specific tools and docs for setting up sound,  try
2941          those.  If  not,  you will need to be familiar with the knowledge in
2942          the Sound-HOWTO and Kernel-HOWTO i.e. know how  to  compile  kernels
2943          and modules and deal with sound drivers.
2944
2945       *  Look  through  the  OSS modules in 'make menuconfig' and see if any‐
2946          thing catches your eye. See if there is any  specific  documentation
2947          on  your  sound  card  on  http://www.linuxdoc.org.  Do  a  few  web
2948          searches. For my AWE64, I use the OPL3 driver.
2949
2950       *  Compile and install the FM driver module, or set up your  system  to
2951          use the new kernel if you want to compile the driver in.
2952
2953       *  Load  the module, or boot your new kernel. It is very important that
2954          you pay attention to what is said in the 'help' for your  FM  driver
2955          in  'make menuconfig' and read any necessary files in the Documenta‐
2956          tion/sound/ directory. For example, I just had a nice half-hour won‐
2957          dering why the hell my FM wasn't working now when it had been before
2958          - with the OPL3 driver, you have to give the option io=0x388 to ins‐
2959          mod. Which is stated nice and clear in the docs, but of course I had
2960          forgotten since then. You can prevent such happenings  by  recording
2961          options permanently in /etc/modules.conf - see the manpage etc.
2962
2963       *  Try the game. If it's worked you will hear particularly beepy music.
2964          Enjoy!
2965
2966
2967
2968       Opl3 occult FAQ
2969
2970       --IMPORTANT-- If you are using Liquid War, your FM will  only  work  if
2971       you  go  to  the  map 'Elephant inside a boa' and proceed to chase each
2972       other round in circles for at least 10 minutes. This cures a bug in the
2973       design of the OPL3 interface which conflicts badly with the core Liquid
2974       War algorithms. How the hell the music hardware even  knows  about  the
2975       core algorithms I don't know, but that's what I made of the now-defunct
2976       opl3-occult-FAQ, from which here is an excerpt:
2977
2978       Many roads a man must take. Those with one-track minds  are  DOOMED,  I
2979       tells ya.
2980
2981       ----  The  Liquid  War algorithm calculates distances to one place, the
2982       cursor.
2983
2984       And:
2985
2986       Man or machine, face or code, must stand strong  and  solid;  must  not
2987       just ooze away as slime.
2988
2989       ----  We think it might just take objection to the whole 'slimy' nature
2990       of the LW beings. As well as it being LIQUID War.
2991
2992       So, our carefully tailored approach, is to  firstly  have  the  players
2993       going  in all the possible different directions evenly by moving around
2994       the map in circles, and secondly to divert the  opl3's  attention  from
2995       the  general  slimy  liquidness  of it all by emphasizing the solidity,
2996       reality, and natural goodness of that  classic  tapestry:  an  elephant
2997       inside a boa.
2998
2999       That and it's a f***ing ace level.
3000
3001
3002
3003   Checksum errors
3004       The Liquid War server is a "light" servers which - to some extent - has
3005       no idea about what is going on in the game. It  simply  replicates  key
3006       strokes  between  clients and each client maintains its own game state.
3007       Normally, the game is designed so that given the same  user  input,  it
3008       will behave exactly the same.
3009
3010       However,  it  happens  that sometimes 2 clients can behave differently,
3011       and this is a (severe) bug. One consequence is that messages  reporting
3012       "Checksum  errors"  appear  on the server's and on the client's console
3013       output. This bug appears when using non-default rules  settings.  Basi‐
3014       cally,  if  someones tweaks his rules, then the checksum errors appear.
3015       Of course I double-triple checked that options were correctly  sent  on
3016       the  network,  but,  well,  could  not fix the bug. Yet. The short term
3017       solution seems to play with default factory settings...
3018
3019       I'm highly interested in bug-reports concerning this problem.
3020
3021

To do

3023   Bug-fixing
3024       In its latest releases Liquid War is quite stable IMHO.  However  there
3025       are  still  some  issues  with  network under Windows for instance. I'm
3026       aware of these bugs and I'm trying to fix them  but  this  does  really
3027       take time.
3028
3029       I  always welcome bug-reports and patches, as making Liquid War W 5.x.x
3030       as stable and bug-free as possible is really important to me - and most
3031       of the time players also appreciate stable programs 8-)
3032
3033       The  most important bug-fixing area is probably cross-platform support.
3034       That is, make sure that the game runs fine on every supported  OS.  For
3035       instance,  it's  quite  common  for  Mac  OS/X  and/or FreeBSD users to
3036       "crash" the game. This rarely happens on GNU/Linux, just because it has
3037       been  so  much more tested on this platform. This applies to Liquid War
3038       itself and also, to some extent, to Allegro.
3039
3040
3041   New features
3042       Let's be clear: no new features in Liquid War 5. It's bloated,  compli‐
3043       cated,  old, uninteresting to hack. All new features should be found in
3044       Liquid War 6.
3045
3046
3047   Liquid War 6
3048       Since summer 2005, Liquid War 6, a complete rewrite of Liquid  War,  is
3049       on    its    way.    See   http://www.gnu.org/software/liquidwar6/   or
3050       http://www.ufoot.org/liquidwar/v6 for more informations.
3051
3052

Work in progress

3054   Note on releases
3055       Whenever Liquid War is released, I usually pass the good news to Fresh‐
3056       meat  (  http://freshmeat.net/projects/liquidwar/  ). Then all releases
3057       are   accessible   from   the   main   download    page,    which    is
3058       http://www.ufoot.org/liquidwar/v5/download.
3059
3060       Releasing the game takes time, for I want all binaries to install prop‐
3061       erly and sources to compile cleanly.  Therefore  there  might  be  some
3062       delay before the time coding is over and the time a release is actually
3063       ready. So for impatients and/or for people who need  to  test  out  the
3064       very latest versions (eg someone who wants to compile the game on a new
3065       platform), it's possible to access the source repository directly.
3066
3067
3068   About GNU Arch
3069       I use GNU Arch  (Tom  Lord's  Arch  in  fact,  http://www.gnu.org/soft
3070       ware/gnu-arch/  )  instead  of the previously used CVS. Indeed, tla has
3071       some very fancy features such as signing  patches  with  gpg,  and  I'm
3072       tired of suffering CVS limitations.
3073
3074       So  FYI  the  previously  active  CVS  repositories, on Sourceforge and
3075       Savannah, are currently unmaintained.
3076
3077
3078   How to get latest releases
3079       *  Step   1:   read   the   excellent   Arch    tutorial    http://reg
3080          exps.srparish.net/www/tutorial/html/arch.html  if you are not famil‐
3081          iar with tla. I admit there's a steep learning curve, but  it's  yet
3082          clear and understandable.
3083
3084       *  Step  2: point on the repository, which is accessible (read-only) on
3085          http://arch.sv.gnu.org/archives/liquidwar/.
3086
3087
3088       A typical set of tla commands would be:
3089
3090       tla register-archive http://arch.sv.gnu.org/archives/liquidwar
3091       tla get -A liquidwar@sv.gnu.org liquidwar6--stable
3092
3093       If you are interested, I can open this repository in  read/write  mode,
3094       however  one  of  the  points of GNU Arch is that it allows cooperative
3095       developpement with multiple depots, so this isn't mandatory.  And  any‐
3096       ways,  importing myself patches received by email has never been a real
3097       burden.
3098
3099       Besides,  most  developpement  is  now  done  on  Liquid  War  6.   See
3100       http://www.gnu.org/software/liquidwar6/ or http://www.ufoot.org/liquid
3101       war/v6 for more informations.
3102
3103

Copying

3105       Liquid War is a multiplayer wargame.
3106
3107       Copyright (C) 1998-2007 Christian Mauduit (ufoot@ufoot.org)
3108
3109       This program is free software; you can redistribute it and/or modify it
3110       under  the  terms of the GNU General Public License as published by the
3111       Free Software Foundation; either version 2 of the License, or (at  your
3112       option) any later version.
3113
3114       This  program  is  distributed  in the hope that it will be useful, but
3115       WITHOUT ANY  WARRANTY;  without  even  the  implied  warranty  of  MER‐
3116       CHANTABILITY  or  FITNESS FOR A partICULAR PURPOSE. See the GNU General
3117       Public License for more details.
3118
3119       You should have received a copy of the GNU General Public License along
3120       with this program; if not, write to the Free Software Foundation, Inc.,
3121       51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3122

AUTHOR

3124       Christian Mauduit <ufoot@ufoot.org>
3125
3126
3127
3128
3129                                    v5.6.4                       Liquid War(6)
Impressum