C / C++ / C#

  1. Home
  2. Computing & Technology
  3. C / C++ / C#

Star Trek Game Conversion Project

By David Bolton, About.com

8 of 8

Final Thoughts

As the converted application is in C, (no objects), so I used a few variables at the file scope, ie.e global. Everything is in one file.

Random Numbers

The application uses a function Random( int Max) which is seeded by calling the Randomize() function. This uses srand() seeded by the time function.

The GetCommand() function is the heart of the program, as it gets player Input and then despatches all valid strings to the appropriate functions. Remember to press return after you type a string.

The direction code is a bit odd and likely to be the main source of bugs in the Warp engine and Photon torpedo firing code. I translated as best I could, but I suspect this is way overdue for a rewrite.

Screen Display

No attempt has been made to use cursor movements, positioning or anything else. this just uses printf to output everything with \n\r to force carriage return/line feeds.

Conclusion

I think conversion took about 8-10 hours in total. For ages compilation produced hundreds of errors but I battled through and it all came good. I've compiled it with several compilers. Surprisingly, one of the commercial ones let errors through (and still compiled and linked perfectly) that a free compiler picked up!

I'll be rewriting it Object style in C++ shortly but you're free to have a go. If you do this, let me know!

Explore C / C++ / C#

About.com Special Features

C / C++ / C#

  1. Home
  2. Computing & Technology
  3. C / C++ / C#
  4. Projects
  5. Star Trek Conversion
  6. Final Thoughts on the Conversion

©2009 About.com, a part of The New York Times Company.

All rights reserved.