Skip to content

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:

ParameterDefaultDescription
-SystemCount15Number of star systems to generate
-Seed-1RNG seed (-1 = random)
-StartingCredits3000Initial 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

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

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

ShipPriceCargoFuel TankFuel/LYMin Tech
Sparrow50010201.00
Hauler Mk I2,00030401.52
Comet Runner3,50020501.23
Star Barge6,00060352.03
Nebula Clipper10,00040600.84
Phantom15,00050800.65

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

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages