I built a version of Super Star Trek in Java. This version of the Star Trek text game is based on the work of the SST2k project.
Star Trek, a text-based computer game, has a long history. It originated back in the 1970’s and there have been many variations of it since then. According to the Wikipedia article on the Star Trek text game, the SST2k project started in 2005. It is based on the C port of Tom Almy, which was done in the early 2000s.
Original SST Source Code
- http://sst.berlios.de/ (old link; page no longer exists) – home page for Sst2k.
It includes a description of the game and the links below.
- https://developer.berlios.de/projects/sst/(old link; page no longer exists)- project page for Sst2k.
I cloned the C source code on March 31, 2012 with “git clone git://git.berlios.de/sst”.
- http://web.archive.org/web/20140225000928/http://sst.berlios.de/sst-doc.html – the documentation page for the game
- http://www.almy.us/sst.html – Tom Almy’s page on Super Star Trek
Example of Game Play
A bit of game play is shown below. Remember that this is a text-based game. The player is prompted for a command. The player enters a command and something happens in response. Refer to the SST documentation page for the set of commands for SST.
Briefly, here’s what is going on. your ship is the E in the scan view; stars, an asterisk (*), empty space, a dot (.); and enemy ships are represented by a K. The sequence we see below is a short range scan, followed by automatic phaser fire directed at any enemy ships in range, and then another short range scan. Note the changes in condition, energy, shields, etc. as the battle progresses.
My goal was to see if I could build an Android app based on the game. I found that there were a few things that I thought would make the game experience better.
The first thing I changed is what you see with a short range scan (SRS). The original game shows the quadrant you are in, no matter your sector position within the quadrant. I changed it so your ship is always in the center of the scan. You see the ship (E) and four sectors away. The effective viewing area of SRS is a 9 x 9 area, rather than the 10 x 10 area of the original. You can see that in the figures (above). Dashes are shown in row 10 and column 10, indicating that no information is available about those sectors. The end result is more realistic view of space. The ship’s scanner has the same range in all directions.
Placing the ship at the center of SRS is a significant change to the game. What you can see, which enemy ships are nearby, and how you move to far away quadrants are just a few of the aspects of the game that change.
The original game had another feature that I thought made the galaxy a bit hard to understand. Each time you entered a new quadrant, the positions of what was in the quadrant changed. The counts were invariant — same number of stars, number of enemy ships, number of bases — but the locations changed. I put in an option so that even the old style game can be played with nonrandom quadrants.
To support these two changes, I changed how the game sets up and changed what information is stored to preserve the state of the game. To support nonrandom quadrants, there is no choice but to generate the contents of space at the start of the game.
Commands I introduced or modified for the wglxy variation of the game include:
- LRM – long range move.
A command like “lrm 3 5” moves the ship to quadrant 3 5.
- PHASERS S – phaser fire, directed at a specific sector.
A command like “pha s 200 4 8” directs 200 units of phaser power at sector 4 8.
- MINE – Mine crystals from the planet you are orbiting.
The original game requires that you be on the planet, having gone there via a shuttle. In my variation, mining just happens as long as you are in orbit.
You will also note the addition of one device to the original set of devices. To go along with the LRM move command, I added a new device to avoid landing on an existing star or blackhole when you move into a quadrant. I called the device a “collision avoidance device”. If it is functioning properly, the ship can jump to a different quadrant and not have to worry if it will be destroyed as it arrives. If it is damaged, the ship runs the risk of being destroyed.
I added a new way to set up the the game with preset quadrants. A preset file can be used to indicate the positions of stars, blackholes, planets, bases, and enemy ships. That means that the same game be played more than once. It’s also useful to compare one person’s performance against another.
The start up for a game asks you to choose the length of game, difficulty level, and which variation of the game you want. My variation is the “wglxy” variation. Variation “plain” matches pretty much what was in the SST2k code of March 2012. Variations “almy” and “fancy” are more like “plain” because I have not finished adding all the features from the Sst2k code.
Java Source Code
The Java code I built is based on a clone of the SST2k, as of March 2012.
Current version of the Java port is available as a zip file on the Sst download page at Wglxy.com. As described above, the Java code is not a 100% match of the code. Some features have not been completed, and some new features have been added. This code compiles and runs inside of Eclipse Indigo, with Java 1.6 as the compiler.
(Update on February 4, 2016: There is a newer zip file on the Wglxy.com Super Star Trek page: sst-space-war-160204.zip.)
The C code from Sst2k is also accessible on the Sst download page at Wglxy.com.
According to the SST2k documentation page, the project contributors are David Matuzsek, Paul Reynolds, Tom Almy, Stas Sergeev, Don Smith, and Eric Steven Raymond.
All of us who are fans of the game are grateful for the work you have done on the original game and for the recent work to preserve and improve the game.