?? sail.6
字號:
.\" Copyright (c) 1988, 1993.\" The Regents of the University of California. All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\" notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\" notice, this list of conditions and the following disclaimer in the.\" documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\" must display the following acknowledgement:.\" This product includes software developed by the University of.\" California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\" may be used to endorse or promote products derived from this software.\" without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\" @(#)sail.6 8.2 (Berkeley) 12/30/93.\".TH SAIL 6 "December 30, 1993".UC 4.SH NAMEsail \- multi-user wooden ships and iron men.SH SYNOPSIS.B sail[.B \-s[.B \-l] ] [.B \-x] [.B \-b] [.B num].br.fi.SH DESCRIPTION.I Sailis a computer version of Avalon Hill's game of fighting sailoriginally developed by S. Craig Taylor..PPPlayers of.I Sailtake command of an old fashioned Man of War and fight otherplayers or the computer. They may re-enact one of the manyhistorical sea battles recorded in the game, or they can choosea fictional battle..PPAs a sea captain in the .I SailNavy, the player has complete control over the workings of his ship.He must order every maneuver, change the set of his sails, and judge theright moment to let loose the terrible destruction of his broadsides.In addition to fighting the enemy, he must harness the powers of the windand sea to make them work for him. The outcome of many battles during theage of sail was decided by the ability of one captain to hold the `weathergage.'.PPThe flags are:.TP.B \-sPrint the names and ships of the top ten sailors..TP.B \-lShow the login name. Only effective with \fB-s\fP..TP.B \-xPlay the first available ship instead of prompting for a choice..TP.B \-bNo bells..SH IMPLEMENTATION.I Sailis really two programs in one. Each player starts up a process whichruns his own ship. In addition, a.I driverprocess is forked (by the first player) to run the computer shipsand take care of global bookkeeping..PPBecause the.I drivermust calculate moves for each ship it controls, themore ships the computer is playing, the slower the game will appear..PPIf a player joins a game in progress, he will synchronizewith the other players (a rather slow process for everyone), and then he may play along with the rest..PPTo implement a multi-user game in Version 7 UNIX, which was the operatingsystem.I Sailwas first written under, the communicating processes must use a commontemporary file as a place to read and write messages. In addition, alocking mechanism must be provided to ensure exclusive access to theshared file. For example,.I Sailuses a temporary file named /tmp/#sailsink.21 for scenario 21, andcorresponding file names for the other scenarios. To provide exclusiveaccess to the temporary file, .I Sailuses a technique stolen from an old game called "pubcaves" by Jeff Cohen.Processes do a busy wait in the loop.br.sp.ce 2 for (n = 0; link(sync_file, sync_lock) < 0 && n < 30; n++) sleep(2);.br.spuntil they are able to create a link to a file named "/tmp/#saillock.??".The "??" correspond to the scenario number of the game. Since UNIX guarantees that a link will point to only one file, the process that succeedsin linking will have exclusive access to the temporary file..PPWhether or not this really works is open to speculation. When ucbmirowas rebooted after a crash, the file system check program found 3 linksbetween the.I Sailtemporary file and its link file..SH CONSEQUENCES OF SEPARATE PLAYER AND DRIVER PROCESSESWhen players do something of global interest, such as moving or firing,the driver must coordinate the action with the other ships in the game.For example, if a player wants to move in a certain direction, he writes amessage into the temporary file requesting the driver to move his ship.Each ``turn,'' the driver reads all the messages sent from the players anddecides what happened. It then writes back into the temporary file newvalues of variables, etc..PPThe most noticeable effect this communication has on the game is thedelay in moving. Suppose a player types a move for his ship and hitsreturn. What happens then? The player process saves up messages tobe written to the temporary file in a buffer. Every 7 seconds or so, theplayer process gets exclusive access to the temporary file and writes out its buffer to the file. The driver, running asynchronously, mustread in the movement command, process it, and write out the results. Thistakes two exclusive accesses to the temporary file. Finally, when the player process gets around to doing another 7 second update, the results of themove are displayed on the screen. Hence, every movement requires fourexclusive accesses to the temporary file (anywhere from 7 to 21 secondsdepending upon asynchrony) before the player sees the results of his moves..PPIn practice, the delays are not as annoying as they would appear. Thereis room for "pipelining" in the movement. After the player writes outa first movement message, a second movement command can then be issued.The first message will be in the temporary file waiting for the driver, andthe second will be in the file buffer waiting to be written to the file.Thus, by always typing moves a turn ahead of the time, the player cansail around quite quickly..PPIf the player types several movement commands between two 7 second updates,only the last movement command typed will be seen by the driver. Movementcommands within the same update "overwrite" each other, in a sense..SH THE HISTORY OF SAIL I wrote the first version of.I Sailon a PDP 11/70 in the fall of 1980. Needless to say, the code was horrendous,not portable in any sense of the word, and didn't work. The program was notvery modular and had fseeks() and fwrites() every few lines. After atremendous rewrite from the top down, I got the first working version up by1981. There were several annoying bugs concerning firing broadsides andfinding angles..I Sailuses no floating point, by the way, so the direction routines are rather tricky.Ed Wang rewrote my angle() routine in 1981 to be more correct (althoughit still doesn't work perfectly), and he added code to let a player selectwhich ship he wanted at the start of the game (instead of the first oneavailable)..PPCaptain Happy (Craig Leres) is responsible for making.I Sailportable for the first time. This was no easy task, by the way. Constantslike 2 and 10 were very frequent in the code. I also became famous forusing "Riggle Memorial Structures" in.I Sail.Many of my structure references are so long that they run off the lineprinter page. Here is an example, if you promise not to laugh..br.sp.cespecs[scene[flog.fgamenum].ship[flog.fshipnum].shipnum].pts.br.sp.PP.I Sailreceived its fourth and most thorough rewrite in the summer and fallof 1983. Ed Wang rewrote and modularized the code (a monumental feat)almost from scratch. Although he introduced many new bugs, the finalresult was very much cleaner and (?) faster. He added window movementcommands and find ship commands..SH HISTORICAL INFOOld Square Riggers were very maneuverable ships capable of intricatesailing. Their only disadvantage was an inability to sail very close to the wind. The design of a wooden ship allowed only for theguns to bear to the left and right sides. A few guns of smallaspect (usually 6 or 9 pounders) could point forward, but theireffect was small compared to a 68 gun broadside of 24 or 32 pounders.The guns bear approximately like so:.nf \\ b---------------- ---0 \\ \\ \\ up to a range of ten (for round shot) \\ \\ \\.fiAn interesting phenomenon occurred when a broadside was fireddown the length of an enemy ship. The shot tended to bounce alongthe deck and did several times more damage. This phenomenon was calleda rake. Because the bows of a ship are very strong and present a smallertarget than the stern, a stern rake (firing from the stern to the bow) causesmore damage than a bow rake..nf b 00 ---- Stern rake! a.fiMost ships were equipped with carronades, which were very large, closerange cannons. American ships from the revolution until the War of 1812were almost entirely armed with carronades..PPThe period of history covered in.I Sailis approximately from the 1770's until the end of Napoleonic France in 1815.There are many excellent books about the age of sail. My favorite authoris Captain Frederick Marryat. More contemporary authors include C.S. Foresterand Alexander Kent..PPFighting ships came in several sizes classed by armament. The mainstays ofany fleet were its "Ships of the Line", or "Line of Battle Ships". Theywere so named because these ships fought together in great lines. They wereclose enough for mutual support, yet every ship could fire both its broadsides.We get the modern words "ocean liner," or "liner," and "battleship" from"ship of the line." The most common size was the the 74 gun two deckedship of the line. The two gun decks usually mounted 18 and 24 pounder guns..PPThe pride of the fleet were the first rates. These were huge three deckedships of the line mounting 80 to 136 guns. The guns in the three tierswere usually 18, 24, and 32 pounders in that order from top to bottom..PPVarious other ships came next. They were almost all "razees," or shipsof the line with one deck sawed off. They mounted 40-64 guns and werea poor cross between a frigate and a line of battle ship. They neitherhad the speed of the former nor the firepower of the latter..PPNext came the "eyes of the fleet." Frigates came in many sizes mountinganywhere from 32 to 44 guns. They were very handy vessels. They couldoutsail anything bigger and outshoot anything smaller. Frigates didn'tfight in lines of battle as the much bigger 74's did. Instead, theyharassed the enemy's rear or captured crippled ships. They were muchmore useful in missions away from the fleet, such as cutting out expeditionsor boat actions. They could hit hard and get away fast..PPLastly, there were the corvettes, sloops, and brigs. These were smallerships mounting typically fewer than 20 guns. A corvette was only slightlysmaller than a frigate, so one might have up to 30 guns. Sloops were usedfor carrying dispatches or passengers. Brigs were something you built for land-locked lakes..SH SAIL PARTICULARSShips in.I Sailare represented by two characters. One character represents the bow ofthe ship, and the other represents the stern. Ships have nationalitiesand numbers. The first ship of a nationality is number 0, the secondnumber 1, etc. Therefore, the first British ship in a game would beprinted as "b0". The second Brit would be "b1", and the fifth Donwould be "s4". .PPShips can set normal sails, called Battle Sails, or bend on extra canvascalled Full Sails. A ship under full sail is a beautiful sight indeed,and it can move much faster than a ship under Battle Sails. The onlytrouble is, with full sails set, there is so much tension on sail andrigging that a well aimed round shot can burst a sail into ribbons whereit would only cause a little hole in a loose sail. For this reason,rigging damage is doubled on a ship with full sails set. Don't letthat discourage you from using full sails. I like to keep them up
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -