Click here to Skip to main content
15,867,686 members
Articles / Programming Languages / Visual Basic

StarTrek Galaxy

Rate me:
Please Sign up or sign in to vote.
3.50/5 (2 votes)
28 Aug 2008CPOL3 min read 35.4K   601   10   6
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.

VB
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).

Image 2

This button Image 3 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!

Image 4

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

Image 5

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

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

License

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


Written By
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 Pin
rehopkins2-Sep-08 9:04
rehopkins2-Sep-08 9:04 
GeneralA long time ago... Pin
Mauro Leggieri28-Aug-08 16:47
Mauro Leggieri28-Aug-08 16:47 
Questionerrors and flaws Pin
kod3brkr28-Aug-08 15:08
kod3brkr28-Aug-08 15:08 
I've played this game a couple of times, and ran into an exploit, if you sit at a base, and just do a Warp Drive Short Range scan you can build up ALOT of energy, but when you go to transfer to shields, you get an overflow error. Also when alot of moving etc happens, you can't scroll back through the text to see what happened. Any fixes for stuff like this in the near future. I LOVE THIS GAME!!!!

--------------------
kod3brkr
in order to save the galaxy, one must first save oneself.

AnswerRe: errors and flaws Pin
rehopkins23-Sep-20 7:48
rehopkins23-Sep-20 7:48 
GeneralRe: errors and flaws Pin
kod3brkr23-Sep-20 14:32
kod3brkr23-Sep-20 14:32 

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

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