Skip to content

timastras9/spacesim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Space Explorer - Interactive Simulation Game

Overview

Space Explorer is an engaging interactive fiction simulation game written in Java. You command a spacecraft exploring distant star systems, managing resources, fuel, and crew morale. The game features dynamic exploration, strategic decision-making, and multiple possible endings.


How to Compile and Run

Requirements

  • Java Development Kit (JDK) 8 or higher installed
  • Command line/terminal access

Compilation

javac SpaceExplorer.java

Execution

java SpaceExplorer

Game Objectives

Primary Goal: Explore 5+ star systems AND collect 50+ resources to win!

Challenges:

  • Manage fuel carefully - running out means game over!
  • Keep crew morale high or risk mutiny
  • Balance exploration with resource management
  • Strategic decision-making at every turn

Game Commands

Command Effect
explore Explore nearby star systems within fuel range. Consumes fuel based on distance. Random chance to discover resources, artifacts, or anomalies.
manage Access crew management menu. Give speeches, allow rest days, or push crew harder. Affects morale and fuel.
scan Scan nearby space for anomalies and discoveries. Uses 10 fuel. Chance to find alien signals or resources.
hyper Execute hyperspace jump for long-distance travel. Consumes 30 fuel but travels 30-80 light-years.
status Display detailed mission report including total credits earned, resource descriptions, and achievements.
save Save your current game progress.
quit Exit the game and display final statistics.

Game Status Indicators

Fuel Level (0-100%)

  • 100%: Full tank, ready for exploration
  • 50%: Getting low, plan carefully
  • 0%: Game over - your ship loses power!

Crew Morale (0-100%)

  • 75%+: Crew is content and productive
  • 50-74%: Crew is adequate
  • 25-49%: Crew is unhappy
  • 0%: Game over - crew mutiny!

Resources Collected

  • Earned through exploration, scanning, and crew labor
  • Convert to credits in the end-game scoring
  • Essential for winning the game

Systems Explored

  • Count increases with each successful exploration
  • Need 5+ systems for victory
  • Each system can yield valuable discoveries

Game Mechanics

Exploration System

When you explore a system:

  1. You choose a distance (game randomizes)
  2. Fuel is consumed equal to distance
  3. You have a 70% chance of discovery
  4. Possible discoveries:
    • Exotic minerals (10-30 resources)
    • Energy anomalies (5 resources + morale boost)
    • Ancient artifacts (15 resources)

Crew Management

Three options available:

  • Motivational Speech: +10 morale, no cost
  • Rest Day: +15 morale, -5 fuel
  • Forced Labor: +10 resources, -20 morale (risky!)

Hyperspace Jumping

  • Requires 30 fuel minimum
  • Jumps 30-80 light-years (longer than normal exploration)
  • Great for covering distance quickly
  • Crew gets morale boost from the thrilling jump

Win Conditions

✓ Achieve VICTORY by:

  • Exploring 5 or more star systems
  • Collecting 50 or more resources
  • Keeping your ship operational

Lose Conditions

✗ Game Over if:

  • Out of Fuel: Fuel reaches 0% - your ship loses power
  • Crew Mutiny: Crew morale drops to 0% - you lose control

Scoring System

Your mission value is calculated as:

Total Credits = (Resources × 100) + (Systems Explored × 50) + (Distance × 10)

Example:

  • 60 resources × 100 = 6,000
  • 5 systems × 50 = 250
  • 100 light-years × 10 = 1,000
  • Total = 7,250 credits

Game Strategy Tips

Early Game (Turns 1-5)

  • Explore nearby systems to build resources
  • Don't waste fuel on distant jumps yet
  • Keep crew morale steady

Mid Game (Turns 6-15)

  • Push toward 5 systems explored
  • Use hyperspace jumps strategically
  • Manage crew to maintain morale

Late Game (Turns 15+)

  • Focus on collecting 50+ resources
  • Use scans and crew labor for final push
  • Monitor fuel to ensure you don't run out

Key Strategies

  • Balanced Approach: Mix exploration with crew management
  • Scout First: Use scan before committing to expensive exploration
  • Plan Fuel: Calculate fuel needed before each expedition
  • Crew Care: Happy crew = better exploration success rates

Code Structure

Main Components

The program includes 8 functions beyond main():

  1. initializeGame() - Sets up initial game state
  2. displayGameStatus() - Shows current ship statistics
  3. handleUserInput(String) - Processes player commands (String parameter)
  4. exploreSystem(int) - Explores distant systems (int parameter)
  5. calculateResources() - Computes mission value in credits (returns int)
  6. manageFuel(int) - Adjusts fuel levels (int parameter)
  7. getResourceDescription(int) - Creates descriptive text (int parameter, returns String)
  8. displayCrewManagementMenu() - Shows crew management options

Additional Features

  • Extensive code comments explaining every function
  • Clear variable naming for readability
  • Structured game state management
  • Dynamic random events for replayability
  • Visual status bars for fuel and morale

Example Game Session

WELCOME TO SPACE EXPLORER
Objective: Explore distant star systems and collect valuable resources...

============================================================
SHIP STATUS REPORT - TURN 1
============================================================
Location: Earth Spacedock
Fuel Level: 100% [==========]
Crew Morale: 75% [=======   ]
Systems Explored: 0
Resources Collected: 0

> Enter command (explore/manage/scan/hyper/status/save/quit): explore

Initiating exploration protocol...
[EXPLORATION LOG]
Traveling 14 light-years through space...
SUCCESS! Discovered 18 units of exotic minerals!

============================================================
SHIP STATUS REPORT - TURN 2
============================================================
Location: Star System 1
Fuel Level: 86% [========  ]
Crew Morale: 80% [========  ]
Systems Explored: 1
Resources Collected: 18

Replayability

Every game is unique because:

  • Random distances for exploration
  • Random discoveries during scans
  • Random artifacts found in systems
  • Unpredictable crew morale changes
  • Multiple valid strategies to achieve victory

Try different approaches:

  • Aggressive exploration vs. cautious approach
  • Crew-focused vs. resource-focused
  • Early hyperspace jumps vs. gradual exploration

Troubleshooting

"javac: command not found"

  • Java JDK is not installed. Download it from oracle.com or use OpenJDK

"Exception in thread main..."

  • Ensure the file is named exactly SpaceExplorer.java
  • Check that Java is properly installed

Game seems unresponsive

  • The game waits for your input. Type a command and press Enter
  • Valid commands are: explore, manage, scan, hyper, status, save, quit

Enjoy Your Space Exploration!

Command your ship wisely, manage your resources carefully, and discover the wonders of distant star systems. Safe travels, Captain! 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages