Click here to Skip to main content
Click here to Skip to main content
Go to top

StarTrek Galaxy

, 28 Aug 2008
Rate this:
Please Sign up or sign in to vote.
Windows Multiple ship version of the classic StarTrek
Figure1.gif

Introduction

It was back in the early 1970's 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 it's 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 it's 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.

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!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

rehopkins
Software Developer
United States United States
Programmer rince 1980. Background evolved from BASIC, ASM, C, C++, VB3 to VB6, Java, Html, XML, vbNet, c#. Started programing because of StarTrek (STTR2.BAS) and collected many mainframe games from the 70's from various computer systems. Transported many to Processor Technology SOL-20 and later many less to 'Windows'. Currently programing in vb6 / vbNet.

Comments and Discussions

 
GeneralErrors and flaws Pinmemberrehopkins22-Sep-08 9:04 
GeneralA long time ago... PinmemberMauro Leggieri28-Aug-08 16:47 
Questionerrors and flaws Pinmemberkod3brkr28-Aug-08 15:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 28 Aug 2008
Article Copyright 2008 by rehopkins
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid