Starfleet 2068

STARFLEET 2068 is an all BASIC, low-resolution graphics, shoot ’em up space wars game for the Timex Sinclair 2068. The program listing and CK-TYPE output (to aide your typing/debugging of this program–see May/June ’87 issue of TDM) is printed below. STARFLEET 2068 is also available on tape from Lemke Software (2144 White Oak, Wichita, KS 67207) for $9.95 ppd., in case you want to try this game, but don’t have the time to key it in.

Scenerio: In the late 1990’s, NASA finally perfected the first WARP DRIVE engine. Earth Federation, a joint US-Canada-European space agency quickly arose to control deep space exploration. Over the first several decades, 9 major STAR BASES were constructed; 1 at the edge of our solar system, and 8 others nearly equidistant from this home base. The year is now 2068 AD. After nearly 70 years of exploration, it was beginning to look like we were alone in the galaxy…until THEY appeared. They made no effort to answer our communications, gave no sign of peaceful intent–and as far as we know, might be purely mechanical (computerized) devices. They simply came, destroying everything in their paths. They caught us by surprise. After 70 years of uninterrupted peace in space, Earth Federation had only 1 armed Star Ship left in space active service–the STRATA-GEM. The ship was hastily fueled, its crew briefed, and as the aliens were about to attack Star Bases 1 and 8, the STRATA-GEM was launched to meet the attackers. YOU are the CAPTAIN. Battle Stations are sounding. Good Luck!

Armament: The Strata-Gem has Electro-Magnet “shields” to repel the enemy weapons. Full strength is 10. If they go to zero, good bye!

Weapons: You have Photon Torpedos (for longer range shots) and Phasor weapons (for closer range shots). The number of each depends on the level of difficulty.

Sensors: Sensor range is 3 parsecs, at full strength, but will vary on shield strength (ship damage).

Engines: You have WARP Speed capability (Warp 1 to 3). You have 20 units of fuel. (Note: the faster you go, the more fuel you use!!) WARP 1 moves you 1 parsec (row and/or column) per move, WARP 2 moves you 2 rows and/or columns per move, etc. If you run out of fuel, good bye!

Docking: You must DOCK to refuel, repair, restock armament, etc. The Star Base will not lower its shields (necessary for you to dock) if there are enemy ships in the quadrant.

Surprises: Yes, there are a few. If a Base refuses to lower it’s shields, try-try again. You may have just been a “Bad Captain” and need to pay penance! There are 6 levels of difficulty!

How to Play.

STARFLEET 2068 has 2 screens, the navigation screen and the weapons/tactical screen. The navigation screen shows you a map of the galaxy: stars, bases, your ship, the enemy ships. The weapon/tactical screen shows you a “close-up” view around your ship, also the range of your sensors (a circle). Anything inside this circle is “fair game” for your weapons.

On the Navigation screen, “HELM AT YOUR CONTROL” will flash, telling you that it is your turn to make a move. Use the joystick to command your ship to make a move. You can change the WARP SPEED by pressing numbers 1 to 3. Press “D” to DOCK, press “W” to go to the WEAPONS screen.

NOTE: to DOCK, you must “fly” your ship into the STAR BASE User Defined Graphic you wish to dock with. Then on the next turn you command “D” (dock). DON’T try to fly thru stars or other ships! Press “0” (zero) for no move, as in station keeping.

On the Weapons screen, you will see the map “close-up”. Here you will see that Docking really places you just beside a STAR BASE. “WORKING!” will flash when you first go to this screen. The program is calculating the range, distance, position of everything for this new display. When the screen is completed, you will see your ship (center of the circle) with a ” ” User Defined Graphic flashing on it. This is your weapons “cross-hairs” for aiming at a specific target. Use your joystick to position this on the target of your choice. When ready, press fire. At any point prior to pressing fire, you can select your weapon: press “T” for torpedo, “P” for phaser weapon. If you shoot at yourself, this is a signal to abort the shot. Press “N” to go to the Navigation screen.

The program (listing).

Type in the program, SAVE it to tape with RUN 4040 [ENTER], (you start the program with RUN [ENTER]). LOAD in the CK-TYPE program (see May/June ’87 issue of TDM) and run it to help you find typing errors. Correct these as required, and re-SAVE the new copy.

This program uses 13 User Defined Graphics as 8X8 pixel Sprites. These are easily identified in the program listing as single INVERSE VIDEO letters (A thru M). I did this by re-defining each UDG as the inverse of its letter. This has no effect on the CK-TYPE, and requires no action on your part except that each time you encounter an INVERSE VIDEO character, you know it is a User Defined Graphics character (and which UDG character) and you must type it in with the “GRAPHIC” cursor command.

The program also abounds with REM statements. These are quite helpful for programming/debugging purposes, but if you remove these from your “working” copy, you will increase the program speed by at least 25%!!

STARFLEET 2068 program listing
STARFLEET 2068 program listing
STARFLEET 2068 program listing
STARFLEET 2068 program listing
STARFLEET 2068 program listing
STARFLEET 2068 program listing
STARFLEET 2068 program listing
STARFLEET 2068 program listing
STARFLEET 2068 program listing
STARFLEET 2068 program listing
STARFLEET 2068 program listing
STARFLEET 2068 program listing
STARFLEET 2068 program listing
STARFLEET 2068 program listing
STARFLEET 2068 CK-TYPE table (Line, Bytes, Sum)
STARFLEET 2068 CK-TYPE table (Line, Bytes, Sum)
STARFLEET 2068 CK-TYPE table (Line, Bytes, Sum)
STARFLEET 2068 CK-TYPE table (Line, Bytes, Sum)
STARFLEET 2068 CK-TYPE table (Line, Bytes, Sum)
STARFLEET 2068 CK-TYPE table (Line, Bytes, Sum)
STARFLEET 2068 CK-TYPE table (Line, Bytes, Sum)
STARFLEET 2068 CK-TYPE table (Line, Bytes, Sum)
STARFLEET 2068 CK-TYPE table (Line, Bytes, Sum)
STARFLEET 2068 CK-TYPE table (Line, Bytes, Sum)

How does it work?

Here is a brief description of the major sections (and a little philosophy) behind what makes this program work. This won’t tell you everything you’ll need to know about writing a game program, nor everything there is to know about this program, but it will tell you enough to make changes to this one, and even cheat if you want too!

Lines 10 – 50: Title/Copyright notice. Be sure to include this!

Lines 60 – 120: These calculations are used over and over in the program. To save memory, they are defined as functions. They are used to calculate row/column position from x/y pixel position and visa versa.

Line 130: This line reads the system ‘frames’ counter and calculates system time in seconds. It is used to calculate the GAME time, and also the elapsed time from your last move. If you take too much time to make a move, the aliens will take their turn. The time to make a turn is shorter as the level of difficulty goes up!

Line 140: This line re-directs the ‘RUN’ command to the program initialize routines starting at line 3510. (These are at the bottom/end of the program because they are not used very often, the routines that are used the most are at the top/beginning of the program to help speed things up!)

Lines 150 – 220: These lines ‘CLEAR’ away old messages and print the Elapsed Game time.

Line 230: This sets the SOUND command for the ‘soft’ exploding ship.

Lines 240 – 310: This section checks how much fuel you have left. It also prints the ‘fuel gage’ marker in the appropriate color, GREEN for lots of fuel, YELLOW for mid-tank, RED for low!

Lines 320 – 360: These lines print the Weapons Status.

Lines 370 – 460: This section converts the ALIENS, STAR BASES, STARS, and YOUR SHIP coordinates from the Screen Location array (L) to their row/column coordinates. Then the Navigation screen is printed. NOTE: to check the position of a star, base, etc. against any other object, you must compare the row and column, or x and y positions, this is 2 coordinate comparisons per object. When you start checking 10 ships for collisions with 9 bases, 11 stars, and your ship, it becomes very time consuming. Therefore, I created a single array (L), that defines a combined Row/Column location as a single value, thus reducing the comparison time to half its former time! The time to calculate this is easily compensated because there are a lot more comparisons than calculation loops!

Lines 470 – 510: This section reads the joystick using an IN/OUT command. This simultaneously reads both joysticks and is much faster than a STICK command that reads left only or right only. This method allows you to use left or right joysticks without any program speed penalty!

Lines 520 – 610: ‘LOCKING ONTO TARGET!’ While this message is flashing, these lines are checking to ‘see’ if there are any objects between your ship and the selected target. This is done using the POINT (X,Y) command. If POINT is 1, there is an object at that X,Y location. If POINT is 0, no object. The first object encountered is set as the real ‘target’.

Lines 620 – 740: This is the NAV. screen menu. Just press the letter associated with your choice: N – Nav, W – Weapons, D – Dock

Lines 750 – 880: ‘HELM AT YOUR COMMAND’. It’s your move!

Lines 890 – 1010: Move. Have enough fuel? Reposition your ship.

Lines 1020 – 1090: Check if you ‘hit’ anything when you moved.

Lines 1100 – 1140: Move the Aliens. 5 aliens move clockwise around the screen, 5 aliens move counter-clockwise.

Lines 1150 – 1280: Check if the Alien ships collided with your ship, or any of the Star Bases. The Star Bases are destroyed when the Alien Ships get close enough to ‘dock’. When a Star Base is destroyed, the next Star Base becomes their target. When Star Base 9 (home base) is destroyed, your ship becomes the final target!

Lines 1280 – 1390: Alien attack. If you get too close to the aliens (even in Nav mode), they will attack you!

Lines 1400 – 1470: DOCK. Check if you are in Star Base orbit, if alien ships are too close, etc.. Begin refuel, repair, etc. if DOCKed.

Lines 1480 – 1570: This section limits the fuel, armament, etc. carried for each level of difficulty.

Lines 1580 – 1620: Prepare to select your target.

Lines 1630 – 1700: This section catalogs all the stars, aliens, and bases relative to your ships’ present location.

Lines 1710 – 1850: This section counts how many stars, aliens, and bases are visible on the weapons screen, then creates the screen display.

Lines 1860 – 2010: This section reads the joystick commands and moves the ‘cross-hair’ UDG used to select the target. The M/C routine at 61241 makes a duplicate of the weapons screen in ‘high’ memory. The UDG cross-hair is moved to wherever you command it. The M/C routine at 61253 replaces the original screen, erasing the cross-hairs, allowing you to print it at another location quickly, giving you fast response to joystick commands.

Lines 2020 – 2110: This section allows you to select which weapon you want. It also prints your selection.

Lines 2120 – 2180: FIRE! Is your target in range? Do you have any fuel left?

Lines 2190 – 2250: Fire Photon Torpedo. Any left? Torpedo is displayed as a blinking ‘dot’ as is crosses the screen.

Lines 2260 – 2330: Fire Phaser. Any left? Phaser is displayed as a line.

Lines 2340 – 2610: Hit something? This section determines if you actually hit a anything, and what it was. If you hit an alien ship, its damage is computed. Alien ship damage is additive. You may score 30% on it with a first hit, 80% on a second hit…. the two hits will score a ‘kill’. Did you hit a star? a star base?

Lines 2620 – 2700: This subroutine determines the outcome of a collision with an alien ship. The alien is destroyed, but what is the damage to your ship???

Lines 2710 – 2850: Got 10 more aliens! Level of difficulty is increased.

Lines 2860 – 2900: Victory! Got ’em all!

Lines 2910 – 2960: Aliens shoot at your ship. Damage?

Lines 2970 – 3240: When you are in the Weapons mode, the aliens try to surround you. This section of the program controls each of the alien ships, and places them at prescribed points around you with some random deviations from these locations. The exact positions also vary with the level of difficulty! Despite the complexity of each move, the wait is very short… less than a second per ship.

Lines 3250 – 3470: Check alien ship collisions: hit your ship? destroy a star base?

Lines 3520 – 4040: Program initialization section.

Line 3550: This is the data and read/poke routine to set up the machine code programs used with the weapon screen.

Line 3590: This is the data that defines all 13 UDG sprites.

Line 3630: This data defines the screen location (L) of the 9 star bases and 10 alien ships.

Lines 3700 – 3860: These lines POKE in the UDG values.

Line 3910: This line creates a$. This array contains the navigation screen definition: screen border, star location, etc. This string is printed, and gives the appearance of scrolling the map into place.

Line 4020: This line pokes the ‘frames’ system variable with 0 (zero), reinitializing the game timer.

I hope you enjoy playing Star Fleet… at least as much as I did writing it! OK, beam me up Scotty!