home *** CD-ROM | disk | FTP | other *** search
/ Best Objectech Shareware Selections / UNTITLED.iso / boss / game / misc / 003 / starship.doc < prev    next >
Encoding:
Text File  |  1993-05-30  |  16.8 KB  |  356 lines

  1.                                 STARSHIPS MANUAL
  2.  
  3.  
  4. Table of Contents:
  5.  
  6. 1. Introduction
  7. 2. Programming guide
  8. 3. Designer's notes and hints
  9. 4. The graphical interface
  10. A. Designing icons
  11.  
  12.  
  13. 1. Introduction
  14.  
  15. Starships is a game where you can program a fleet of up to fifteen starships
  16. to fight another fleet.  The language used is a modified assembly language
  17. with a lot of commands removed, but some really useful ones added.  The ships
  18. are able to look for other ships, and fire torpedos or phasers at them.  In
  19. addition, the ships are able to communicate with each other, giving the
  20. option of having a command vessel and subordinates.
  21.  
  22. If you enjoy this game, I would appreciate it if you send $10 or $15 to
  23.   Andy Dolphin
  24.   Platt Campus Center
  25.   Harvey Mudd College
  26.   Claremont, CA  91711
  27.   USA
  28.  
  29. My e-mail address is ADOLPHIN@TAU.CLAREMONT.EDU
  30.  
  31. Feel free to send comments, as well.  I would especially like to hear from
  32. people who think they have a great fleet set up and would like to try it
  33. out against others.  I will gladly run an unofficial tournament if enough
  34. people send me their fleets.  You can send the .SRC and .CFG files by e-mail
  35. or a uuencoded zipped file including all the needed files.
  36.  
  37. I am pretty sure there are no bugs, although a division by zero error will
  38. cause the game to end and the erroneous program to lose.  (The program will
  39. detect this - it won't crash, just stop.)
  40.  
  41. If you are running an XT, use strshpxt.exe.  Otherwise, use starship.exe.
  42.  
  43.  
  44. 2. Programming guide
  45.  
  46. To play the game, you must write the AI routine (using your favorite ascii
  47. file editor), which must have a .SRC extension and a fleet configuration file,
  48. which needs a .CFG extension.
  49.  
  50. During game play, if it seems a battle will never end, you can press Alt-X,
  51. at which point the computer will give a loss to the fleet with the furthest
  52. live ship from the origin.
  53.  
  54. There are three modes you can run the game under.
  55.  
  56. 2 Combat modes:
  57. During game play, you see the X, Y, and Z positions of each ship, the
  58. velocity and the direction (the polar angles Theta and Phi), the percent
  59. damage the ship had taken, and the percent of the shields remaining. The
  60. difference between the modes is that the real-time mode executes one command
  61. per cycle, while the full procedure mode waits for the EXE command to update.
  62. (There are 10 cycles per update in either mode.)
  63.  
  64. Debugging mode:
  65. This is to help you debug your starship.  After each instruction of fleet 1,
  66. ship 1 is completed, the screen shows the positions (in normal cartesian
  67. coordinates) and velocities (polar coordinates) of all the ships, and the
  68. values of all of fleet 1, ship 1's variables in the following formt:
  69.   a b c d e f g h
  70.   i j k l m n o p
  71.   q r s t u v w x
  72.   y z
  73. Note that the mode only does this for fleet 1, ship 1.  Also, note that the
  74. debugging mode is an extension of the real-time mode.
  75.  
  76. The .CFG file is simple to build.  On the first line, you put the name (not
  77. necessarily the filename) of your fleet.  On the second line, you put the
  78. number of starships in your fleet.  After those two lines, you need two lines
  79. per ship: the root name of the ship's AI file and the name of the ship.  One
  80. rule is that you can only have up to ten ships in a fleet.  Here is an example 
  81. file:
  82.  
  83. My first fleet
  84. 3
  85. COMIC
  86. Calvin
  87. COMIC
  88. Hobbes
  89. ZOMBIE
  90. Me
  91.  
  92. This fleet, "My first fleet", has three ships: two COMIC class ships and one
  93. ZOMBIE class ship.  The two COMIC class ships are named "Calvin" and "Hobbes",
  94. while the ZOMBIE class ship is named "Me".
  95.  
  96. The .SRC file is the fun part.  It is your ship configuration and the
  97. commands it executes.  About all you have is twenty-six variables, labeled
  98. A to Z.  The variables A through F and V through Z have special uses, but can
  99. be used for ordinary computations as well.  In the .SRC file, there must be
  100. exactly one space between the command and the first argument, between the
  101. first and second arguments, and so on.  Additionally, all numbers must have
  102. three digits and be between 000 and 255.  Case is not important, however.
  103.  
  104. For example:
  105. "CPY A B" is a valid line, but "CPY AB", "CPY  A B", and "CPY A  B" are not.
  106. "set A 023" and "sEt A 023" are equally valid, while "set A 23" is not.
  107.  
  108. For the jump and branch commands, labels are necessary.  They are locations
  109. the program is allowed to jump to.  They are defined by @name at the location
  110. they mark, and are referred to with as @name.
  111.  
  112. Here are the commands (x1 and x2 will refer to variables, nnn to a number, and
  113. @ll to a label)
  114. ADD x1 x2: set x1 equal to x1+x2
  115. ARM x1: sets the time before a torpedo arms.  This allows it to get far
  116.   enough from your ship/fleet that it won't hurt your ship.  The actual time
  117.   will be 10 times this value (000-100, but 000 would be really stupid!)
  118.   Default is 10.
  119. BEQ x1 x2 @ll: if x1=x2, jump to @ll
  120. BGR x1 x2 @ll: if x1>x2, jump to @ll
  121. BLT x1 x2 @ll: if x1<x2, jump to @ll
  122. BNE x1 x2 @ll: if x1 is not equal to x2, jump to @ll
  123. CPY x1 x2: set x2 equal to x1
  124. DAM: returns the damage to fleet V, ship W to A
  125. COS x1 x2: set x2 equal to 1000*cos(x1)
  126. DIV x1 x2: set x1 equal to x1/x2 rounded to the nearest integer
  127. DST: self-destruct, good as suicide ship in a fleet.
  128. ENG: returns the engine power of fleet V, ship W to X
  129. EXE: tells when the command processing for one loop of the program is
  130.   finished.  This is not yet implemented, but will be an option so that a ship
  131.   can take its time while preparing its commands.  You will want to put the
  132.   EXE command at the end of the main loop.
  133. FIR: fires a torpedo in the direction Y,Z (polar coordinates)
  134. FSZ: returns the number of ships in fleet V to A.
  135. JMP @ll: jump to @ll
  136. LOC: returns the relative location of fleet V, ship W to A, B and C in polar
  137.   coordinates
  138. MLT x1 x2: set x1 equal to x1*x2 (make sure it doesn't overflow)
  139. MSH: returns the full shield strength of fleet V, ship W to X
  140. MVE: move at speed X in the direction Y,Z (polar coordinates)
  141. PHS: fire phasers at fleet V (probably 2), ship W
  142. POL: returns the polar coordinate equivalent of the position (X,Y,Z) to A, B,
  143.   and C
  144. POS: returns the polar position of fleet V, ship W relative to a star.  This
  145.   is a good way to get a calibrated position instead of the position relative
  146.   to the ship.
  147. PRX x1: sets the proximity range for torpedo detonation.  The actual range is
  148.   10 times the value here (000-100).  Default is 40.
  149. PWR: returns the phaser power of fleet V, ship W to X
  150. RSH: returns the shield regeneration rate of fleet V, ship W to X
  151. SET x1 nnn: set x1 equal to nnn
  152. SHL: returns the current level of the shields on fleet V, ship W to A
  153. SIN x1 x2: set x2 equal to 1000*sin(x1)
  154. SUB x1 x2: set x1 equal to x1-x2
  155. TEL: send the message X,Y,Z to ship W.  Ship W receives this in D,E,F
  156. TIM: returns the current time to A.
  157. TRP: returns the torpedo strength of fleet V, ship W to X
  158. VEL: returns the velocity of fleet V, ship W to A, B, and C in polar
  159.   coordinates.
  160.  
  161. Additionally, there are compiler directives to stop compilation, add comments,
  162. and configure your ship.
  163. #: begins a comment line
  164. $END nnn: end compiling
  165. $ENG nnn: set engine strength (000-010, 000 means you don't move, 010 is best)
  166. $MSH nnn: set maximum shield strength (000-100, 000 means you don't have
  167.   shields, 100 is the best)
  168. $RSH nnn: set regeneration rate of shields in thousandths of a percent per
  169.   cycle (the cycles go by quickly, 000-100)
  170. $TRP nnn: set the ship's torpedo strength (000-100, 100 is strongest)
  171. $PWR nnn: set the phaser power (000-100, 100 is strongest)
  172.  
  173. For the commands where V chooses the fleet to reference, 1 is your fleet and
  174. 2 is the enemy fleet.  For the commands where W chooses the ship to reference,
  175. 0 is always your ship.
  176.  
  177. Some special considerations:
  178. Ship Destruction:
  179.          when a ship is destroyed, all ships within a radius of 3000 of it
  180.          also have a chance of being destroyed.
  181. Torpedos: reload time is 500 cycles
  182.           they move at speed 600
  183.           the maximum range is 50000 units, which they reach after 5000 cycles
  184.           the proximity fuse can be increased if your firing algorithm isn't
  185.           the best, but the further away the blast, the lesser the damage.
  186. Phasers: reload time is 250 cycles
  187.          the maximum range is 2000 units, but are stronger as the range
  188.          decreases.  (Phaser hit at range 0 is the same strength as torpedo
  189.          hit (of proximity 40), while phaser hit at range 2000 is half the
  190.          strength.)
  191. Moving: your ship's acceleration is not infinite, nor is the turning radius
  192.         zero.  Also, you move 0.04 times your velocity each clock cycle.
  193. Damage: as a ship takes damage (not shield weakeing, but real damage), its
  194.         systems will lose effectiveness.
  195. Memory: you may only have 10000 steps of object code and 255 labels.  I really
  196.         doubt that the 10000 limit will be a problem.  The 255 labels,
  197.         however, will keep programs from being horribly complex.
  198.  
  199. A helpful note is that nonexistant ships have damage of 255.  This will help
  200. you to determine the number of enemy ships (a function I purposefully
  201. excluded)
  202.  
  203. After you write your .SRC file (or if you want to use a provided ship), you
  204. will need to use SCOMPILE.EXE to compile the ship.  This writes two files:
  205. the .OBJ file has the ship configuration and the compiled code, and the .LBL
  206. file has the addresses of all the labels.  If there are no errors, your ship
  207. is ready to put into a fleet.
  208.  
  209. A note about polar coordinates:
  210. There are three values associated with each position.
  211.   R, which is the total distance, velocity, etc.
  212.   Theta, which is the angle (degrees) from the Z axis.  It is the same as
  213.     90-north latitude.
  214.   Phi, which is the angle in the XY plane from the X axis.  It is the same
  215.     as east longitude.
  216. There are conversions to use to get between normal cartesian coordinates and
  217. polar coordinates:
  218.   X=R*sin(Theta)*cos(Phi)
  219.   Y=R*sin(Theta)*sin(Phi)
  220.   Z=R*cos(Theta)
  221. There are also transformations to go the other way, but I won't bore you with
  222. those since you can use the POL function.
  223.  
  224.  
  225. 3. Designer's notes and hints.
  226.  
  227. I've been wanting to do a game like this for quite some time now, and finally
  228. got around to it.  I hope other people enjoy it.  I added the 3-D aspect,
  229. since space battles really should be in 3-D.
  230.  
  231. The style of the game is very flexible.  For example, the TEL function can be
  232. used in countless ways.  If you want to be sure a message is received, you
  233. can have the receiving ship send out a response when it gets the message,
  234. deciding on your own communications protocol.  An obvious use of TEL would
  235. be to have a command ship tell the lower ships who to attack, but you can
  236. make it as complex as you like.  If you want to be really organized, you could
  237. even split your fleet into three wings of three ships each with an overall
  238. command ship and a wing commander for each wing.
  239.  
  240. Since you can configure the ships as you please, I think some standard should
  241. be used.  For and contests I run I will use this system:
  242.   Add the $TRP, $PWR, $ENG, $MSH, and $RSH values for every ship in the fleet.
  243. The $ENG isn't as high, but it isn't as important, either. Here are the
  244. classes:
  245.     1: Single ship, maximum 200 points.
  246.     2: Up to 10 ships, maximum 800 points.
  247.     3: Up to 15 ships, maximum 4000 points.
  248.  
  249. Some small hints:
  250.   -If you have a command ship, you need a backup system in case it is
  251.   destroyed.  Also, it probably will want more shielding and regeneration, but
  252.   not as much weaponry.
  253.   -Only one command is executed per clock cycle, so speed is fairly important
  254.   here.  (Not crucial, though.  You can have rather complex routines without
  255.   getting too much punishment.)
  256.   -You probably want to experiment with dogfighting techniques before you get
  257.   into huge command structures.
  258.   -I think most people's best dogfighting techniques will be pretty similar.
  259.   Thus, any edge you can get from coming up with a brilliant command scheme
  260.   would be quite helpful.
  261.   -Try to figure out how to elude torpedos.  Remember, they move in a straight
  262.   line so all you have to do is get out of the way.
  263.   -There's no fleet size command.  Perhaps you want your fleet leader to
  264.   calculate it first thing and tell everyone else, so they can store it
  265.   somewhere.  I suppose you could build it in to each ship, but it seems a 
  266.   waste to have every ship doing the same number crunching.  (Remember that
  267.   nonexistant ships have a damage of 255...)
  268.   -Be creative.
  269.  
  270. I have included some .SRC files as well.  CHARGER.SRC chases down ship 1 of
  271. the enemy fleet and torpedos it until one or the other is dead.  It won't work
  272. against more than one ship, however.  CONST50.SRC is a moving target, which
  273. moves constantly in a straight line at speed 50.  LEADER.SRC uses a slightly
  274. more advanced targeting algorithm, where it tries to lead the enemy ship.  It
  275. doesn't take into account the fact that the other ship may not be moving in
  276. a straight line, however.  CHARGER and LEADER are both class 1 vessels.
  277.  
  278. I have also included some fleet ships.  FLEADER and FCHARGER are identical to
  279. the original LEADER and CHARGER routines, except that they allow for more than
  280. one enemy vessel.  FLEETSHP uses the leader routines and attacks the vessel
  281. told to it be a flagship, or the nearest vessel if none is specified.
  282. SHIELDER is good for use as ship #1 against FLEADER and FCHARGER ships.  It
  283. has not weapons, but has good shields for them to shoot at with little effect.
  284. (Those routines hunt down enemy #1 first, then #2, and so on, so SHIELDER is a
  285. good way to keep your warships alive.)  FLAGSHIP will control four FLEETSHPs,
  286. numbered as ships 1 through 4 and FLAGSHP2 will control one SHIELDER and three
  287. FLEETSHPs.  Example .CFG files are given in FLEET1 and FLEET2, both class 2
  288. fleets.  Example .CFG files for FLEADER and FCHARGER are LFLEET and CFLEET,
  289. also both class 2 fleets.
  290.  
  291. MIGHTY 1 and 2 are two use together in a class 2 fleet.  Instead of having
  292. essentially 4 class 1 vessels to make up a class 2 fleet, this uses two much
  293. stronger vessels, and seems to work pretty well.  MIGHTY1 takes on the enemy
  294. with the highest Z value, and MIGHTY2 takes on that with the lowest.  An
  295. example .CFG file here is FLEET3.
  296.  
  297. Some notes about these (you will probably notice these pretty easily by
  298. playing a few rounds with them):
  299.   -The two flagships are easily destroyed.  They should probably either get better
  300. shields or be combined with other vessels.  I know it seems a waste to use up
  301. the points on a noncombat vessel, but it's probably necessary.
  302.   -The two flagships don't really use a great AI routine.  They order their 2
  303. strongest vessels to attack the enemy's vessel with the most shield damage.
  304.   -The mighty fleet doesn't seems to work well.  Perhaps it's better to have
  305. more, weaker vessels.
  306.  
  307.  
  308. 4. THE GRAPHICAL INTERFACE
  309.  
  310.      After having quite a few requests, I finally broke down and wrote it.
  311. It shows the locations of all the live ships, as well as dead ships and
  312. torpedos that happen to be in the field of view.  It also shows when a ship
  313. is hit either by torpedo or phaser, and shows the status of shields, hull
  314. damage, and systems damage.
  315.  
  316. The main screen.
  317.      The main screen will have a parallelogram, which represents the X-Y plane
  318. of the area shown.  X increases as you go right, and Y increases as you go
  319. up/right.  Every ship has a vertical line connecting its icon to its X-Y
  320. position.  Torpedos also have this, as do dead ships.  All live ships will
  321. always be shown on the display, but torpedos and dead ships may not be.  The
  322. number at the top is the range that the display shows.  Note that a ship
  323. without an icon will simply be a dot.
  324.  
  325. The ship stats.
  326.     Each ship is listed, along with six bars under it.  The first two, the
  327. longer ones, represent the shield strength and the amount of hull damage.
  328. The other four bars represent damage to shield rechargers, torpedo tubes,
  329. phaser banks, and engines, respectively.  The bars are fully green when
  330. things are going well and completely red when the system it represents is
  331. dead.
  332.  
  333. Appendix A: Designing icons.
  334.      The graphical interface will use icons for the ships if you wish.  The
  335. icon file is very easy to create.  It is an ascii file of a 7x7 matrix, with
  336. the value at 4,4 being the center.  The only possible values of this matrix
  337. are 0, 1, and 2.  0 is a blank, 1 is black, and 2 is the fleet color.  For
  338. example, the matrix
  339. 0 0 0 0 0 0 0
  340. 0 0 1 1 1 0 0
  341. 0 1 2 2 2 1 0
  342. 0 1 2 1 2 1 0
  343. 0 1 2 1 2 1 0
  344. 0 0 1 1 1 0 0
  345. 0 0 0 0 0 0 0
  346. would create a square icon with a black outside and middle.  The name of this
  347. icon file is the samed root as the .SRC file, but with a .ICN extension.  If
  348. no icon is available, a point in the middle will be used.
  349.  
  350. I will try to post the most current version of the game as soon as possible.
  351. This version of the game is complete - I'm not going to cripple the game so
  352. that I can beg for money, since I really hate it when people do that...
  353.  
  354.  
  355. Enjoy!
  356.