SCSE (Space Combat Simulation Engine) is an experimental C++20 project exploring space combat and simulation. It is an early prototype inspired by ideas from SPASIM, with a small console program for trying out the current simulation. The code and gameplay rules are still evolving.
In an MSYS2 UCRT64 terminal, install the compiler, CMake, and Ninja:
pacman -S --needed mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-cmake \
mingw-w64-ucrt-x86_64-ninjaOpen PowerShell at the repository root and configure in a new build directory. A directory configured with NMake cannot be reused with Ninja because CMake generators are fixed at configuration time.
cmake -S . -B build-ucrt -G Ninja `
-DCMAKE_MAKE_PROGRAM=C:/msys64/ucrt64/bin/ninja.exe `
-DCMAKE_CXX_COMPILER=C:/msys64/ucrt64/bin/g++.exe
cmake --build build-ucrt --parallel
ctest --test-dir build-ucrt --output-on-failure
$env:Path = "C:\msys64\ucrt64\bin;$env:Path"
.\build-ucrt\scse.exeThe PowerShell line above adds the UCRT64 runtime directory to PATH for that terminal.
Open this repository folder, run CMake: Select a Kit, choose the GCC UCRT64 kit, then run CMake: Delete Cache and Reconfigure. Workspace settings select Ninja and the compiler. Build with CMake: Build. To launch from VS Code's integrated PowerShell terminal, add C:\msys64\ucrt64\bin to PATH using the command above first.
For a clean rebuild, remove only the generated build-ucrt folder and repeat the configure and build commands. The older build folder can remain configured with its previous generator.
The prototype console program loads its built-in C++ scenario and advances the current fixed-step simulation while accepting commands. Team count, player capacity per team, planets, and weapon profiles are defined in src/rules/scenario.cpp. scse_core is the CMake library containing the current simulation code. The source listing, porting decisions and development notes are recorded in PORTING_SPEC.md.
help, status, teams, planets, tick (or wait), turn <x> <y> <z>, accel, decel, coast, throttle <1-4>, goal <planet> [orbit-level], orbit <level>, class <small|medium|large>, select <ship-id> [ship-id ...], target <entity-id>, weapon <profile>, shoot [power], launch <energy>, detonate, repair <amount>, load <energy|material> <amount> <planet>, transfer <energy|material> <amount> <entity-id>, ally <team> <team>, pause, resume, speed [multiplier], and exit. Team and weapon ranges are shown by help from the loaded scenario. The simulation advances continuously; tick or wait advances one step immediately.
Use these short command names consistently in scripts and documentation. ? and s are shortcuts for help and status.
turn takes a direction vector, not Euler angles or a world position. For example, turn 0 1 0 points along +Y, and turn 0 0 1 points upward along +Z. Scale does not matter; the vector is normalized by the heading conversion. The ship turns toward that direction at its configured turn rate.
teams lists entity IDs, teams, positions, and shields for ships and bases. Each player starts with two controllable ships; the starter world also has two stationary practice ships per team. select <ship-id> [ship-id ...] chooses one or more of your ships; both controllable ships are selected initially. target <entity-id> assigns the target to every selected ship, and shoot fires from the selected ships individually. Direct flight commands (turn, accel, decel, coast, and throttle) also apply to the selection. Each ship has its own torpedo slot, so launch and detonate also operate independently on selected ships. To assign different targets, use select <one-ship-id> followed by target <target-id> for each ship. Run teams to see ship IDs and each ship's current targeting ID. You may only select ships you control. T<number> refers to the first practice ship for that team; use the entity IDs from teams to target the additional ships. C++ calculates the desired aim direction each tick while applying each ship's turn rate. Instant weapons aim directly; finite-speed projectiles use the intercept calculation. Firing succeeds per ship when the target is in range and within the forward arc.
goal <planet> [level] engages navigation and uses a stopping-distance speed profile to brake before the planet's sphere of influence, then starts a scripted spiral from the ship's actual position toward the requested orbit. It does not reset the ship to level 1 first. orbit <level> starts an automatic transfer while already orbiting. The C++ integrator maintains circular motion during transfers and holds ships on their selected orbit radius after arrival. Level 1 is the outer boundary; higher levels are closer to the planet. class changes the test ship class. Orbit spacing, influence radius, transfer behavior, acceleration, braking, speed tiers, and ship-class limits are defined in src/rules/scenario.cpp. Initial ship-class limits are small=4, medium=2, and large=1; these are prototype tuning values. Edit the C++ scenario and rebuild to change them. turn rotates the ship's nose without changing inertial velocity; accel thrusts along the nose up to the selected speed tier, decel opposes current velocity, and coast coasts. throttle 1–throttle 4 sets a speed cap from 0.5 to 2.5 times the L1 circular speed. With current planet values, the caps are approximately 0.71, 1.41, 2.12, and 3.54 units/second. The default is stage 3. Goal autopilot uses the selected cap and automatically switches between accelerating, coasting, and braking. At the speed cap, it can still use lateral thrust to steer the velocity direction. status distinguishes facing from inertial velocity and reports the active orbit, throttle tier, and orbit radius.
speed reports the current playback multiplier; speed 1000 runs up to 1000 times faster, and speed 1 restores real-time playback. Valid values range from 0.1 to 10000. The physics timestep remains fixed, so actual fast-forward speed depends on CPU capacity.
Example: class small, goal 2 4 requests planet 2's innermost orbit; from orbit, orbit 1 returns to the outer boundary. class large restricts the ship to level 1, and deeper requests are rejected with an explanatory message. The current orbit controller uses simplified thrust and circularization rules for gameplay; it is not a high-fidelity Hohmann transfer model.
Weapon numbering follows the source roster: 1 Aggstroms, 2 Fouriers, 3 Diffractions, 4 Lasers. All four profiles currently use provisional values because the original lookup data is missing from the text export.
Edit the scenario data in src/rules/scenario.cpp to change world timing and seed, players per team, ships per player, player/ship/base/torpedo defaults, team names and home planets, ship classes and spawn/orbit settings, team base placement (Team::baseOffset, relative to the team's home planet), planet coordinates/gravity/orbit ranges/starting values, weapon profiles, practice targets, alliances, and ID starting values. Base health, shields, resources, and collision radius are set in baseDefaults; each player's base is created at its team's configured home-planet offset. Each weapon profile includes its own damage, range, projectile speed, lead limit, and maximum horizontal/vertical firing-angle errors. These are maximum deviations from the ship's facing; 180 degrees permits any angle on that axis. Team, planet, and weapon IDs must remain zero-based and contiguous. Rebuild after changing values.
src/engine/: current world state, typed actions, movement, navigation, combat, economy, and simulation loop.src/console/: terminal front end and text-command parser.src/rules/game_rules.hpp: typed scenario and gameplay rule model.src/rules/scenario.cpp: built-in typed scenario data and world initialization.src/rules/calculations/: orbit, flight-control, and weapon-aim calculations, separated by use.
Weapon profiles contain shared per-weapon tuning. Ship-specific bonuses or mount overrides should be layered separately later rather than changing the shared weapon definition.
The current engine code can be used by another front end through engine/engine.hpp and engine/world.hpp: construct a Simulation, issue WorldCommand actions through Simulation::execute, and advance it with Simulation::step. The terminal application and text parser live in console/. These interfaces may change as the project develops.
The current movement, initial resource values and weapon profiles are provisional because legacy source notation and shared initial data are not recoverable from the listing alone. Planet growth/revolt is still inactive. See PORTING_SPEC.md for fidelity status.
To build only the simulation library without the sample app, configure with -DSCSE_BUILD_CONSOLE=OFF.