Skip to content

Tdue21/PowerTraders

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PowerTraders

A space trading game for the PowerShell terminal, inspired by classics like Elite and Tradewars. Buy low, sell high, upgrade your ship, and explore a procedurally generated galaxy.

PowerShell 7+

Features

  • Procedural Galaxy — 15 star systems with unique names, coordinates, and tech levels
  • Dynamic Markets — 12 tradeable commodities with prices that fluctuate each turn
  • Ship Upgrades — 6 ships from the humble Sparrow to high-end freighters, with trade-in system
  • Interactive Star Map — Arrow-key navigation with real-time distance/fuel info
  • Warp Animation — ASCII warp-drive effect when travelling between systems
  • Save/Load — Full game state persistence to JSON
  • Auto-Refuel — Optional automatic refuelling on arrival

Quick Start

# Requires PowerShell 7+
./SpaceTraders.ps1

Optional parameters:

Parameter Default Description
-SystemCount 15 Number of star systems to generate
-Seed -1 RNG seed (-1 = random)
-StartingCredits 3000 Initial credits

How to Play

  1. Create a character and buy your first ship with your starting credits
  2. Trade goods — buy commodities at low-tech worlds and sell them at high-tech ones (and vice versa)
  3. Travel between systems, managing your fuel supply
  4. Upgrade your ship at ship dealers for more cargo space, fuel range, or speed
  5. Save your progress and come back later

Main Menu

Key Action
1 View Star Map
2 Trade at Market
3 Sell Cargo
4 Travel to Another System
5 Refuel Ship
6 Ship Dealer
7 Status
8 Toggle Auto-Refuel
9 Save Game
Q Quit

Economy

Prices are driven by each system's tech level (0–6) and per-good variance. Markets update every turn with ±10% random fluctuations, creating opportunities for arbitrage across the galaxy.

Fuel costs 10 + (TechLevel × 2) credits per unit. Fuel consumption depends on distance and your ship's efficiency rating.

Ships

Ship Price Cargo Fuel Tank Fuel/LY Min Tech
Sparrow 500 10 20 1.0 0
Hauler Mk I 2,000 30 40 1.5 2
Comet Runner 3,500 20 50 1.2 3
Star Barge 6,000 60 35 2.0 3
Nebula Clipper 10,000 40 60 0.8 4
Phantom 15,000 50 80 0.6 5

Trade-in value is 60% of the ship's purchase price. Cargo must fit in the new ship.

Project Structure

SpaceTraders.ps1          # Entry point & main game loop
Modules/
  UI.psm1                 # Console display, menus, star map, warp animation
  Universe.psm1           # Procedural galaxy & market generation
  Ships.psm1              # Ship catalog & upgrade system
  Trading.psm1            # Buy/sell goods, travel, refuelling
  SaveLoad.psm1           # JSON save/load system
Data/
  goods.json              # 12 trade commodities with base prices & variance
  ships.json              # Ship definitions
  system-names.json       # Name prefixes/suffixes for procedural generation
Saves/                    # Saved games ({PlayerName}.json)
Tests/                    # Pester test suite

Running Tests

Invoke-Pester ./Tests

Requirements

  • PowerShell 7.0 or later
  • A terminal that supports ANSI colors and cursor positioning

About

A Powershell 7.x clone of the old Space Traders game. Coded almost entirely through vibe-coding.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors