Originally created for Fall 2020 CS594 taught by James Plank, Lab 3: Jgraph
Don't Fly Into a F***ing Asteroid!!! is a very simple space flight game inspired by the classical video game, Asteroids.
The game puts you in control of a space ship which moves through outter space using thrust. Thrust is applied directionally using
prescribed keyboard keys as follows:
E: Thrust 1 unit UP
S: Thrust 1 unit LEFT
F: Thrust 1 unit RIGHT
D: Thrust 1 unit DOWN
X: Cancels all thrust and movement
V: Moves ship back to default position
Q: Pauses game
Z: Prints positions and velocities of all screen objects
Thrusting in any direction increases the velocity in said direction by 1 unit and is cumulative with multiple keystrokes.
It is worth noting that your ship can go "off-screen" indefinitely in any direction. If this happens and you can't find your way back,
the V key will place your ship back into default position. Also, stopping or reversing direction requires "undoing" the amount of thrust you've already
invested in your current direction(s). For example, if you thrusted upwards by pressing the E key three times, you'd have to press the D key three times
to stop or more than three times to undo upward thrust and begin moving downwards. For convenience, I've included the X key which cancels thrust in
all directions and stops your ship from moving. This is especially handy when you've accidently applied too much thrust and lost
your ship offscreen. If you were to only press V key, then your ship would relocate to default position, but the large thrust values would likely result
in, once again, your ship flying offscreen. Using the X key to cancel all thrust and then the V key to relocate the ship is recommended in these cases.
Setting Up And Playing The Game
The game uses jgraph to continuously overwrite a jpg file with the visual state of the game. As such, it is vitally
important to find a way to view a single jpg file which updates the view when the file changes.
If you want to install jgraph locally, you can follow the link to obtain the source files, or you can remote into the UTK lab computers which already have jgraph installed. The following instructions are for playing remotely, but these can easily
be adjusted to play locally.
INSTRUCTIONS
Download and install VSCode if you don't have it already.
You may prefer to use another IDE/program if you wish, but VSCode has easy-to-use SSH capabilities PLUS it allows remote viewing of jpg files which update if the content changes.
Remote-in to one of the UTK's lab computers.
Use VSCode's explorer to find the game's main directory (/home/jplank/www-home/plank/classes/cs494/494/labs/Lab-3-Jgraph).
If not there, then Dr. Plank placed them somewhere else. You'll have to ask or bribe.
Open "jimage.jpg" in it's own VSCode window. This window will act as your gaming screen.
The game is played using the console so you can either use VSCode's built-in terminal or a separate program. I prefer using VSCode in conjunction with MobaXterm for some strange reason.
To start the game, simply enter the following console command in the game's main directory:
./jgraph
The game will print out an introduction and instructions with the game paused. Once you're ready, hit Q key to unpause and play.
If gameplay is jittery and sluggish as compared to the "example gameplay video" below, then remote into different lab computers until you find a good one.
Example Gameplay Video
Below is a video showing a short segment of gameplay. And yes, I know the collision logic is horrendous, but it gets the point across ;). Enjoy!