65.9K
CodeProject is changing. Read more.
Home

StarTrek Galaxy

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.50/5 (2 votes)

Aug 28, 2008

CPOL

3 min read

viewsIcon

36327

downloadIcon

610

Windows Multiple ship version of the classic StarTrek

StarTrekGalaxy/Figure1.gif

Introduction

It was back in the early 1970s when I first encountered StarTrek on a Univac mainframe computer. At that time, it was written in Univac 1100 Basic and had the official code label of 'STTR2.BAS'. (STTR1.BAS was the instructions) See the Michael Birken article on "Star Trek 1971 Text Game." All the commands and concepts are the same, if I recall correctly. The Univac 'STTR2' game launched me into programming. I just had to understand how it worked! As a result, I collected about a dozen varieties of this game from various other systems and converted them to Univac Basic. Later, it was converted to Processor Technology SOL-20 BASIC5 and Extended Basic along with the classic versions of StarTrek that I had. This final version is in Visual Basic 5 and mimics the 'rolling text' screen of the older computer versions. One big difference is the Windows GUI push-button interface shown later.

One reason to submit this is that if I don't, it may be lost forever.

Background

Now to make a long story short, I wrote this version from the ground up and expanded the 'Universe' to a 10x10 grid system and added other starships and 'enemies.' Several ships would then contribute to the overall scan of the 'galaxy' or 'universe.' Since this was so different a version, I named it GALAXY and was not aware of other programs 'out there' by the same name. Each ship could scan, shoot or do other commands before losing its turn due to a move or a 'pass turn' command. And then the Klingons and cloaked Romulans would move! Once you knew where a Star Base was, you could 'dock' there and just wait for the enemies to approach you. Anti-matter bombs blew up stars and any nearby enemies. Anti-Matter Probes blew up stars in the adjoining quadrant along with the enemies. A Scout-Probe would show the 'scan' of all quadrants it traveled through. This was important to quickly find Star Bases before enemy movements could reset the scan. Once you find a Star Base, note its co-ordinates as any other starship can do a point-to-point warp to that base.

Code Sample

This is just one 'subroutine' to illustrate some of the conversion to Visual Basic. This is one code block that may be simple enough to understand without writing a book to describe how it works. Since many of the variables were lifted 'as is' from the original code, the variables are NOT self-documenting as they could be if this were re-factored in a VB.NET conversion.

Public Function fxDecodeSymbol(sSymbol As String) As Integer
    ' #########################################################
    ' ##
    ' ##    Sub fxDecodeSymbol(...)
    ' ##
    ' ##    Purpose:    Decode a Symbol to a Type #
    ' ##
    ' ##    Parameters:
    ' ##         iShip = Ship calling this Sub
    ' ##
    ' ##    Author:     Ralph Hopkins
    ' ##    Date:       August 3, 2000
    ' ##    Update:
    ' ##    Revisions:  1.0.0  Initial Version **/**/2000
    ' ##
    ' #########################################################
    Dim iShipType As Integer
    
    iShipType = -1
    Select Case sSymbol
    Case sS1$:                              ' Star
    Case "<E>": iShipType = SC_ENTERPRISE
    Case ":E:": iShipType = SC_E_SHUTTLE
    Case "<L>": iShipType = SC_LEXINGTON
    Case ":L:": iShipType = SC_L_SHUTTLE
    Case "<R>": iShipType = SC_REPUBLIC
    Case ":R:": iShipType = SC_R_SHUTTLE
    Case "<I>": iShipType = SC_INTERPRID
    Case ":I:": iShipType = SC_I_SHUTTLE
    Case "<H>": iShipType = SC_HOOD
    Case ":H:": iShipType = SC_H_SHUTTLE
    Case sB$:   iShipType = SC_BASE1
    Case sK$:   iShipType = SC_KL_WARSHIP   ' Klingon
    Case sJ$:   iShipType = SC_KL_CRUISER   ' Super Klingon
    Case sR$:   iShipType = SC_ROMULAN      ' Romulan
    Case sZ$:   iShipType = SC_ZORPH        ' Zorph
    Case sG$:   iShipType = SC_GORN         ' Gorn
    Case sG1$:  iShipType = SC_GORN_SCOUT   ' Gorn Scout
    Case sG2$:  iShipType = SC_GORN_BASE    ' Gorn Base
    Case sX$:   iShipType = SC_XEONITE      ' Xeonite
    Case sH$:   iShipType = SC_BLACK_HOLE   ' Black Hole
    Case sD$:                               ' Destroyed Ship
    Case sD1$:                              ' Destroyed Star
    Case sN$:   iShipType = SC_TRITON_MINE  ' Triton Mine
    End Select
    
    fxDecodeSymbol = iShipType
End Function                                ' End fxDecodeSymbol(...)

Using the Program

The first graphic is the start-up screen to show some of the interface as well as the 'enemy' symbols in the 'header' block. This screen shows a short-range scan of the Klingons (2nd button on left panel).

This button is the same as the old PHOTONS '4' command. Also, note that we can 'Auto-Fire' which means that the computer does the calculations and shooting for us!

As a result, we take some return fire and will have to shoot again.

After that, we can click the Long Range scan button.

Then after checking our status, the computer's first button brings up the shared map.

StarTrekGalaxy/Figure5.gif

This is a quick sample of the game. There is a HELP file with more information.

Points of Interest

Older original code (in Basic) is included with the source. There are instructions there also that reveal that you may have a 'Tractor Beam' to capture weak aliens. If I recall, you may be able to capture a Romulan Cloaking device. Each ship can launch one Shuttle-craft with an Anti-Matter bomb. It can act as a 'Scout' and maybe destroy an enemy. It appears as another ship on the 'universe' map. That is why you can only have up to 5 ships. You have up to 5 Shuttle-craft to potentially be active in the game. When they are lost, they are gone!

History

  • 28th August, 2008: Initial version