STARTREK for Arduboy

Hello, everyone.
My second program is an old simulation game. Do you know the game “STARTREK”?

A little rich title screen

Main window

Galaxy map

This game has many variations and rules. Please play and ask if you have any questions. And if you have any fun ideas, please tell me.

Source code and hex file are available here:

Play now (updated 2020-03-17T12:52:00Z):
startrekAB.ino-arduboy.hex (70.8 KB)

Most recent version:



Display a map of galaxy.
  If long range sensor has damaged, all displayed content will be erased.
  If short range sensor has damaged, even the current parcel will not be displayed.

Move using the warp engine.
  0 degree on the right, specify angle clockwise
  Movement within the sector is the distance from warp 1 to warp 8
  Off-sector movement is from warp 10 to warp 80 distance
  If the engine has damaged, the maximum is warp 2

Fire photon torpedo
  Maximum loading capacity is 10 shots
  0 degree on the right, specify angle clockwise
  Not fired if broken

Fire phaser
  Fired at enemies in the sector if short range sensor or probe sensor is running.
  If both are out of order, they will only fire at visible enemies
  Specify the energy units to fire
  Not fired if broken

Generate a shield
  If a ship is attacked without a shield, a mechanical failure will occur
  Specify the energy unit used for the shield (percent)
  Shield does not occur if broken

Report mechanism failure status
  Number of days until failure is recovered is also reported

Report the status of enemies in the sector
  You can know the position of the enemy even if the short range sensor is out of order

Start the computer
    Calculate the angle and distance to a location in a sector
    Calculate the angle and distance to a location outside the sector
    Calculate the angle to a location in a sector
    Spend energy units and attempt to repair mechanism failure
    Shut down computer
    Abandon mission

** Additional information
  In order to warp between sectors, a run of distance 2 is required
  You can hit and deal damage to enemies
  Reaching the base replenishes energy and photon torpedoes and repairs the mechanism
  Magnetic storms can cause mechanical failure when moving between sectors

I wish you a successful mission


1 Like

Thank you so much!!! This takes me back to my younger years, this is a game I played on my old TV using a touchtone phone back in the day. There was a TV channel that was able to output games on the TV and you controlled it by calling a number and use your phone as a controller.

Anyway thank you for this game :smile:

1 Like

To @Pharap.

御無沙汰しておりました。–Gobusata site orimasita.
日本語の勉強は進んでいますか。–Nihon-go no benkyou ha susundeimasuka?

This time, I tried to use descriptive variable and function names whenever possible. I also actively used structures. But it is not perfect. I also took care of how to escape from while and for statements. I now understand the handling of string constants a bit. But I have a lot to learn.

To @Vampirics.
The first computer I got had a Z80 CPU. Recently, I heard that CP/M works with a few ICs, including a Z80 CPU and Atmega32a. So I got the necessary parts, soldered and turned on the power. The serial console displayed the world of a good old 8-bit computer. I operated for a while and found “it”. It was “STARTREK.BAS”.

I thought it would not be fun just to rewrite it as it was, so I improved the user interface and animations. There is still room for improvement. This time, there is still a lot of free space for sketches. :wink:

To @CDR_Xavier.
Sorry. “NetHack” is likely to take more time. :sweat_smile:

1 Like

Don’t worry. I’m not in a hurry.
Too bad I had no idea what this game is about. Looks like a lot of fun though.


それは「Gobusata shite orimashita」,
ローマ字で、「し」は 「shi」だから。


いええ。( ^ _ ^')

I try to reply in Japanese when I can, but I am not actively studying it.

はい。Much better than before. (「もっと良い。」?)



command, computer and mechanism should use const char *.
const は「読み取り専用」。(‘read-only’.)

Without the const you get a warning:

I:\Downloads\startrekAB\startrekAB.ino:83:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

Similarly void prints(int x, int y, char *message, bool inv)
should be void prints(int x, int y, const char *message, bool inv)

You might also want to look at this:

If you don’t understand it then don’t worry too much.


1 Like

Holy crap. I meant to do this a long time ago but never got around to it. So awesome to see this!

1 Like

To @Pharap.

なるほど! I understand well.

This is my next challenge.

To @Dreamer3.
Thank you for your greatest praise. :blush:

To the community.
I intend to implement some non-original features in this game. They are “black hole” and “jamming”. Can I do that? I still don’t know.

The world is confused by the emergence of new viruses, but take care of your body.

1 Like

Found my old sketches. Mine was going to be a lot more graphical than text based.


To @Dreamer3.
Wow! It’s cool! Can I play this game? I really want to play! :star_struck:

I put a configuration screen on my “STARTREK”.
Features that are not in the original are “Black Hole” and “jamming”. I’ll explain what it looks like later. I have to prepare dinner for my family from now on. :sweat_smile:

1 Like


「僕の体は準備万端」(冗談です :P


Huh. Dinner mission is complete.

I explain the configuration.

First, you can now set the total number of enemies and the number of friendly bases.

Second, you can now set the number of supplies your allies can supply. You can decide whether a friendly base can be unlimitedly replenished or replenished once.

The third is about black holes. It is a feature not found in the original. When you enter a new sector, there is a one-tenth chance that a black hole will exist. In the sector with the black hole, the orbit of the Enterprise and the photon torpedo will bend significantly by its gravity. Computer calculations will also be unreliable. However, photon torpedoes from enemies are not affected.

Finally, jamming. When you enter an enemy sector, there is a one-tenth chance that the enemy will emit jammers. In this case, no black hole is generated. Within this sector, the situation is the same as if short range sonsor sensor (thanks for @Pharap) and probe sensor had broken. Guess the position of the enemy from the explosion of adjacent stars and occasional explosions and shoot down the enemy. If you shoot down all enemies in the sector, jamming will be canceled.

The source code has been modified. Let me know if you come up with more fun features. :stuck_out_tongue:

1 Like

“Sensor” or “Sonar”?

「星雲」- “Nebula” (singular/one), “Nebulae” (plural/many).

I’m not sure what it would do though. Maybe it would damage the ship?

You definately needs to complete that game or teamup with @BlueMax.

Thanks. I’m curious how many space the game currently takes up anyways. That’s always the tricky part on this tiny hardware.

Currently about 90% of progmem and 61% of RAM.

I can see a lot of potential optimisations*,
but I want to make sure @BlueMax understands any suggested changes before accepting them.

* E.g. getting rid of all use of strlen and strcpy_P,
modifying prints to accept const __FlashStringHelper * and read chars straight from progmem instead of RAM,
getting rid of all the character buffers allocated on the stack.

Progmem is going to be the issue if we started adding graphics, of course.

A good idea for sure, but mostly frees up RAM at run-time… possibly some flash space, not sure how much to/from code there is.

To @Pharap.

なるほど! I found the difference between the two methods.

I received this proposal! I have added a new feature asteroid belt.
When you arrive at a new sector, there is a one-eighth chance that an asteroid belt will appear. Vertical or horizontal asteroid belts allow photon torpedoes to pass, but not the Enterprise. This requires a new strategy.

I can still add new features. I am waiting for a fun suggestion.

1 Like

This kind of thing really makes me want an Arduboy with more room for programs… or even just more storage - because even then you could build some nice interpreters and run interpreted programs to build bigger software. I have all sorts of cool little graphical ideas you could do for this kind of thing to make it “next level” but very, very quickly we’d be out of space.