home *** CD-ROM | disk | FTP | other *** search
- STARSHIPS MANUAL
-
-
- Table of Contents:
-
- 1. Introduction
- 2. Programming guide
- 3. Designer's notes and hints
- 4. The graphical interface
- A. Designing icons
-
-
- 1. Introduction
-
- Starships is a game where you can program a fleet of up to fifteen starships
- to fight another fleet. The language used is a modified assembly language
- with a lot of commands removed, but some really useful ones added. The ships
- are able to look for other ships, and fire torpedos or phasers at them. In
- addition, the ships are able to communicate with each other, giving the
- option of having a command vessel and subordinates.
-
- If you enjoy this game, I would appreciate it if you send $10 or $15 to
- Andy Dolphin
- Platt Campus Center
- Harvey Mudd College
- Claremont, CA 91711
- USA
-
- My e-mail address is ADOLPHIN@TAU.CLAREMONT.EDU
-
- Feel free to send comments, as well. I would especially like to hear from
- people who think they have a great fleet set up and would like to try it
- out against others. I will gladly run an unofficial tournament if enough
- people send me their fleets. You can send the .SRC and .CFG files by e-mail
- or a uuencoded zipped file including all the needed files.
-
- I am pretty sure there are no bugs, although a division by zero error will
- cause the game to end and the erroneous program to lose. (The program will
- detect this - it won't crash, just stop.)
-
- If you are running an XT, use strshpxt.exe. Otherwise, use starship.exe.
-
-
- 2. Programming guide
-
- To play the game, you must write the AI routine (using your favorite ascii
- file editor), which must have a .SRC extension and a fleet configuration file,
- which needs a .CFG extension.
-
- During game play, if it seems a battle will never end, you can press Alt-X,
- at which point the computer will give a loss to the fleet with the furthest
- live ship from the origin.
-
- There are three modes you can run the game under.
-
- 2 Combat modes:
- During game play, you see the X, Y, and Z positions of each ship, the
- velocity and the direction (the polar angles Theta and Phi), the percent
- damage the ship had taken, and the percent of the shields remaining. The
- difference between the modes is that the real-time mode executes one command
- per cycle, while the full procedure mode waits for the EXE command to update.
- (There are 10 cycles per update in either mode.)
-
- Debugging mode:
- This is to help you debug your starship. After each instruction of fleet 1,
- ship 1 is completed, the screen shows the positions (in normal cartesian
- coordinates) and velocities (polar coordinates) of all the ships, and the
- values of all of fleet 1, ship 1's variables in the following formt:
- a b c d e f g h
- i j k l m n o p
- q r s t u v w x
- y z
- Note that the mode only does this for fleet 1, ship 1. Also, note that the
- debugging mode is an extension of the real-time mode.
-
- The .CFG file is simple to build. On the first line, you put the name (not
- necessarily the filename) of your fleet. On the second line, you put the
- number of starships in your fleet. After those two lines, you need two lines
- per ship: the root name of the ship's AI file and the name of the ship. One
- rule is that you can only have up to ten ships in a fleet. Here is an example
- file:
-
- My first fleet
- 3
- COMIC
- Calvin
- COMIC
- Hobbes
- ZOMBIE
- Me
-
- This fleet, "My first fleet", has three ships: two COMIC class ships and one
- ZOMBIE class ship. The two COMIC class ships are named "Calvin" and "Hobbes",
- while the ZOMBIE class ship is named "Me".
-
- The .SRC file is the fun part. It is your ship configuration and the
- commands it executes. About all you have is twenty-six variables, labeled
- A to Z. The variables A through F and V through Z have special uses, but can
- be used for ordinary computations as well. In the .SRC file, there must be
- exactly one space between the command and the first argument, between the
- first and second arguments, and so on. Additionally, all numbers must have
- three digits and be between 000 and 255. Case is not important, however.
-
- For example:
- "CPY A B" is a valid line, but "CPY AB", "CPY A B", and "CPY A B" are not.
- "set A 023" and "sEt A 023" are equally valid, while "set A 23" is not.
-
- For the jump and branch commands, labels are necessary. They are locations
- the program is allowed to jump to. They are defined by @name at the location
- they mark, and are referred to with as @name.
-
- Here are the commands (x1 and x2 will refer to variables, nnn to a number, and
- @ll to a label)
- ADD x1 x2: set x1 equal to x1+x2
- ARM x1: sets the time before a torpedo arms. This allows it to get far
- enough from your ship/fleet that it won't hurt your ship. The actual time
- will be 10 times this value (000-100, but 000 would be really stupid!)
- Default is 10.
- BEQ x1 x2 @ll: if x1=x2, jump to @ll
- BGR x1 x2 @ll: if x1>x2, jump to @ll
- BLT x1 x2 @ll: if x1<x2, jump to @ll
- BNE x1 x2 @ll: if x1 is not equal to x2, jump to @ll
- CPY x1 x2: set x2 equal to x1
- DAM: returns the damage to fleet V, ship W to A
- COS x1 x2: set x2 equal to 1000*cos(x1)
- DIV x1 x2: set x1 equal to x1/x2 rounded to the nearest integer
- DST: self-destruct, good as suicide ship in a fleet.
- ENG: returns the engine power of fleet V, ship W to X
- EXE: tells when the command processing for one loop of the program is
- finished. This is not yet implemented, but will be an option so that a ship
- can take its time while preparing its commands. You will want to put the
- EXE command at the end of the main loop.
- FIR: fires a torpedo in the direction Y,Z (polar coordinates)
- FSZ: returns the number of ships in fleet V to A.
- JMP @ll: jump to @ll
- LOC: returns the relative location of fleet V, ship W to A, B and C in polar
- coordinates
- MLT x1 x2: set x1 equal to x1*x2 (make sure it doesn't overflow)
- MSH: returns the full shield strength of fleet V, ship W to X
- MVE: move at speed X in the direction Y,Z (polar coordinates)
- PHS: fire phasers at fleet V (probably 2), ship W
- POL: returns the polar coordinate equivalent of the position (X,Y,Z) to A, B,
- and C
- POS: returns the polar position of fleet V, ship W relative to a star. This
- is a good way to get a calibrated position instead of the position relative
- to the ship.
- PRX x1: sets the proximity range for torpedo detonation. The actual range is
- 10 times the value here (000-100). Default is 40.
- PWR: returns the phaser power of fleet V, ship W to X
- RSH: returns the shield regeneration rate of fleet V, ship W to X
- SET x1 nnn: set x1 equal to nnn
- SHL: returns the current level of the shields on fleet V, ship W to A
- SIN x1 x2: set x2 equal to 1000*sin(x1)
- SUB x1 x2: set x1 equal to x1-x2
- TEL: send the message X,Y,Z to ship W. Ship W receives this in D,E,F
- TIM: returns the current time to A.
- TRP: returns the torpedo strength of fleet V, ship W to X
- VEL: returns the velocity of fleet V, ship W to A, B, and C in polar
- coordinates.
-
- Additionally, there are compiler directives to stop compilation, add comments,
- and configure your ship.
- #: begins a comment line
- $END nnn: end compiling
- $ENG nnn: set engine strength (000-010, 000 means you don't move, 010 is best)
- $MSH nnn: set maximum shield strength (000-100, 000 means you don't have
- shields, 100 is the best)
- $RSH nnn: set regeneration rate of shields in thousandths of a percent per
- cycle (the cycles go by quickly, 000-100)
- $TRP nnn: set the ship's torpedo strength (000-100, 100 is strongest)
- $PWR nnn: set the phaser power (000-100, 100 is strongest)
-
- For the commands where V chooses the fleet to reference, 1 is your fleet and
- 2 is the enemy fleet. For the commands where W chooses the ship to reference,
- 0 is always your ship.
-
- Some special considerations:
- Ship Destruction:
- when a ship is destroyed, all ships within a radius of 3000 of it
- also have a chance of being destroyed.
- Torpedos: reload time is 500 cycles
- they move at speed 600
- the maximum range is 50000 units, which they reach after 5000 cycles
- the proximity fuse can be increased if your firing algorithm isn't
- the best, but the further away the blast, the lesser the damage.
- Phasers: reload time is 250 cycles
- the maximum range is 2000 units, but are stronger as the range
- decreases. (Phaser hit at range 0 is the same strength as torpedo
- hit (of proximity 40), while phaser hit at range 2000 is half the
- strength.)
- Moving: your ship's acceleration is not infinite, nor is the turning radius
- zero. Also, you move 0.04 times your velocity each clock cycle.
- Damage: as a ship takes damage (not shield weakeing, but real damage), its
- systems will lose effectiveness.
- Memory: you may only have 10000 steps of object code and 255 labels. I really
- doubt that the 10000 limit will be a problem. The 255 labels,
- however, will keep programs from being horribly complex.
-
- A helpful note is that nonexistant ships have damage of 255. This will help
- you to determine the number of enemy ships (a function I purposefully
- excluded)
-
- After you write your .SRC file (or if you want to use a provided ship), you
- will need to use SCOMPILE.EXE to compile the ship. This writes two files:
- the .OBJ file has the ship configuration and the compiled code, and the .LBL
- file has the addresses of all the labels. If there are no errors, your ship
- is ready to put into a fleet.
-
- A note about polar coordinates:
- There are three values associated with each position.
- R, which is the total distance, velocity, etc.
- Theta, which is the angle (degrees) from the Z axis. It is the same as
- 90-north latitude.
- Phi, which is the angle in the XY plane from the X axis. It is the same
- as east longitude.
- There are conversions to use to get between normal cartesian coordinates and
- polar coordinates:
- X=R*sin(Theta)*cos(Phi)
- Y=R*sin(Theta)*sin(Phi)
- Z=R*cos(Theta)
- There are also transformations to go the other way, but I won't bore you with
- those since you can use the POL function.
-
-
- 3. Designer's notes and hints.
-
- I've been wanting to do a game like this for quite some time now, and finally
- got around to it. I hope other people enjoy it. I added the 3-D aspect,
- since space battles really should be in 3-D.
-
- The style of the game is very flexible. For example, the TEL function can be
- used in countless ways. If you want to be sure a message is received, you
- can have the receiving ship send out a response when it gets the message,
- deciding on your own communications protocol. An obvious use of TEL would
- be to have a command ship tell the lower ships who to attack, but you can
- make it as complex as you like. If you want to be really organized, you could
- even split your fleet into three wings of three ships each with an overall
- command ship and a wing commander for each wing.
-
- Since you can configure the ships as you please, I think some standard should
- be used. For and contests I run I will use this system:
- Add the $TRP, $PWR, $ENG, $MSH, and $RSH values for every ship in the fleet.
- The $ENG isn't as high, but it isn't as important, either. Here are the
- classes:
- 1: Single ship, maximum 200 points.
- 2: Up to 10 ships, maximum 800 points.
- 3: Up to 15 ships, maximum 4000 points.
-
- Some small hints:
- -If you have a command ship, you need a backup system in case it is
- destroyed. Also, it probably will want more shielding and regeneration, but
- not as much weaponry.
- -Only one command is executed per clock cycle, so speed is fairly important
- here. (Not crucial, though. You can have rather complex routines without
- getting too much punishment.)
- -You probably want to experiment with dogfighting techniques before you get
- into huge command structures.
- -I think most people's best dogfighting techniques will be pretty similar.
- Thus, any edge you can get from coming up with a brilliant command scheme
- would be quite helpful.
- -Try to figure out how to elude torpedos. Remember, they move in a straight
- line so all you have to do is get out of the way.
- -There's no fleet size command. Perhaps you want your fleet leader to
- calculate it first thing and tell everyone else, so they can store it
- somewhere. I suppose you could build it in to each ship, but it seems a
- waste to have every ship doing the same number crunching. (Remember that
- nonexistant ships have a damage of 255...)
- -Be creative.
-
- I have included some .SRC files as well. CHARGER.SRC chases down ship 1 of
- the enemy fleet and torpedos it until one or the other is dead. It won't work
- against more than one ship, however. CONST50.SRC is a moving target, which
- moves constantly in a straight line at speed 50. LEADER.SRC uses a slightly
- more advanced targeting algorithm, where it tries to lead the enemy ship. It
- doesn't take into account the fact that the other ship may not be moving in
- a straight line, however. CHARGER and LEADER are both class 1 vessels.
-
- I have also included some fleet ships. FLEADER and FCHARGER are identical to
- the original LEADER and CHARGER routines, except that they allow for more than
- one enemy vessel. FLEETSHP uses the leader routines and attacks the vessel
- told to it be a flagship, or the nearest vessel if none is specified.
- SHIELDER is good for use as ship #1 against FLEADER and FCHARGER ships. It
- has not weapons, but has good shields for them to shoot at with little effect.
- (Those routines hunt down enemy #1 first, then #2, and so on, so SHIELDER is a
- good way to keep your warships alive.) FLAGSHIP will control four FLEETSHPs,
- numbered as ships 1 through 4 and FLAGSHP2 will control one SHIELDER and three
- FLEETSHPs. Example .CFG files are given in FLEET1 and FLEET2, both class 2
- fleets. Example .CFG files for FLEADER and FCHARGER are LFLEET and CFLEET,
- also both class 2 fleets.
-
- MIGHTY 1 and 2 are two use together in a class 2 fleet. Instead of having
- essentially 4 class 1 vessels to make up a class 2 fleet, this uses two much
- stronger vessels, and seems to work pretty well. MIGHTY1 takes on the enemy
- with the highest Z value, and MIGHTY2 takes on that with the lowest. An
- example .CFG file here is FLEET3.
-
- Some notes about these (you will probably notice these pretty easily by
- playing a few rounds with them):
- -The two flagships are easily destroyed. They should probably either get better
- shields or be combined with other vessels. I know it seems a waste to use up
- the points on a noncombat vessel, but it's probably necessary.
- -The two flagships don't really use a great AI routine. They order their 2
- strongest vessels to attack the enemy's vessel with the most shield damage.
- -The mighty fleet doesn't seems to work well. Perhaps it's better to have
- more, weaker vessels.
-
-
- 4. THE GRAPHICAL INTERFACE
-
- After having quite a few requests, I finally broke down and wrote it.
- It shows the locations of all the live ships, as well as dead ships and
- torpedos that happen to be in the field of view. It also shows when a ship
- is hit either by torpedo or phaser, and shows the status of shields, hull
- damage, and systems damage.
-
- The main screen.
- The main screen will have a parallelogram, which represents the X-Y plane
- of the area shown. X increases as you go right, and Y increases as you go
- up/right. Every ship has a vertical line connecting its icon to its X-Y
- position. Torpedos also have this, as do dead ships. All live ships will
- always be shown on the display, but torpedos and dead ships may not be. The
- number at the top is the range that the display shows. Note that a ship
- without an icon will simply be a dot.
-
- The ship stats.
- Each ship is listed, along with six bars under it. The first two, the
- longer ones, represent the shield strength and the amount of hull damage.
- The other four bars represent damage to shield rechargers, torpedo tubes,
- phaser banks, and engines, respectively. The bars are fully green when
- things are going well and completely red when the system it represents is
- dead.
-
- Appendix A: Designing icons.
- The graphical interface will use icons for the ships if you wish. The
- icon file is very easy to create. It is an ascii file of a 7x7 matrix, with
- the value at 4,4 being the center. The only possible values of this matrix
- are 0, 1, and 2. 0 is a blank, 1 is black, and 2 is the fleet color. For
- example, the matrix
- 0 0 0 0 0 0 0
- 0 0 1 1 1 0 0
- 0 1 2 2 2 1 0
- 0 1 2 1 2 1 0
- 0 1 2 1 2 1 0
- 0 0 1 1 1 0 0
- 0 0 0 0 0 0 0
- would create a square icon with a black outside and middle. The name of this
- icon file is the samed root as the .SRC file, but with a .ICN extension. If
- no icon is available, a point in the middle will be used.
-
- I will try to post the most current version of the game as soon as possible.
- This version of the game is complete - I'm not going to cripple the game so
- that I can beg for money, since I really hate it when people do that...
-
-
- Enjoy!
-