Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpaceEngine (C++ / OpenGL)

A from-scratch space simulator focused on seamless scale — fly continuously across a universe of procedural galaxies (spiral, barred, elliptical, irregular, lenticular), into any one of them, down through a star system to a planet's surface, with no loading screens and no floating-point precision breakdown.

Native C++20 + raw Win32 + OpenGL 4.x core, with zero third-party dependencies — the window, the OpenGL function loader, the f64 math library, and all procedural generation are hand-written. See ARCHITECTURE.md for how the seamless-scale precision works.

![scales: universe → galaxy → system → planet]

Requirements

  • Windows with a GPU driver that supports OpenGL 3.3+ (any card from the last ~decade; the engine requests 4.5 core and falls back to 3.3).
  • MinGW-w64 g++ to build (tested with g++ 16.1, UCRT). No CMake or Make needed.

The build static-links the MinGW runtime, so se.exe ships no libstdc++/libgcc DLLs — it depends only on system DLLs (kernel32, user32, gdi32, opengl32) plus the C runtime.

Note: the engine needs a real hardware OpenGL driver. A headless/remote session with only Microsoft's "GDI Generic" software GL (OpenGL 1.1) cannot run it — run it from an interactive desktop session.

Windows 7 / 8.1 compatibility

The code uses no Windows 8+ APIs, so it runs on Windows 7 SP1 provided two things are present:

  1. A GPU driver with OpenGL 3.3+ (vendor driver, not the stock MS one).
  2. The Universal C Runtime (UCRT) — built into Windows 10/11, but on Win7/8.1 it comes from Windows Update KB2999226. A fully-updated Win7 SP1 has it. On an unpatched system se.exe won't start (missing api-ms-win-crt-*.dll); install KB2999226, or rebuild with a MSVCRT-based MinGW-w64 (e.g. the WinLibs MSVCRT variant), which depends only on msvcrt.dll — present on every Windows — and needs nothing extra on Win7.

Build & run

build.bat
se.exe

or from a bash shell (Git Bash / MSYS):

./build.sh
./se.exe

Both compile every .cpp under src/ and link opengl32, gdi32, user32.

Controls

Input Action
Mouse Look (captured)
W S A D Move forward / back / strafe
R / Space Move up
F / Ctrl Move down
Q E Roll
Mouse wheel Throttle (fly speed)
Shift Boost ×8
[ / ] Time warp down / up
P Pause time
Tab Toggle mouse capture
Esc Quit

Fly speed auto-scales to the nearest surface, so the same controls feel right whether you're cruising between planets or hovering over terrain. The window title shows live telemetry: nearest body, altitude, speed, time warp, and FPS.

Dive into a gas giant. Gas giants have no ground to land on — fly into one and you fall through it. The air thickens until drag throttles you to a crawl, the sky goes black, lightning flares in the storm decks, and far below the murk begins to glow from heat hotter than the surface of the Sun. The title bar turns into descent telemetry — depth, pressure, temperature, wind, the physical layer you're falling through, and a hull-failure warning that climbs toward the ~1.4 Mbar metallic-hydrogen floor that crushes anything that reaches it. The pressure/temperature model is a real dry-adiabatic atmosphere tuned to Jupiter.

Tests

Headless correctness tests (no GPU required) for the precision/simulation core — hierarchical floating-origin precision, Kepler orbits, noise determinism, blackbody colour, quaternions, and deterministic universe generation:

g++ -std=c++20 -O2 -Isrc tools/test_core.cpp \
    src/scene/scenegraph.cpp src/universe/orbit.cpp src/universe/system.cpp \
    src/universe/galaxy.cpp src/universe/star_octree.cpp src/universe/universe.cpp \
    src/gfx/camera.cpp src/procedural/noise.cpp src/procedural/blackbody.cpp \
    -o test_core.exe && ./test_core.exe

Project layout

See ARCHITECTURE.md for the full module map and the multi-phase roadmap (chunked-LOD terrain, atmospheric scattering, multi-system galaxy, etc.).

About

No description, website, or topics provided.

Resources

Stars

28 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages