TheOpenSpaceProgram / osp-magnum

A spaceship game
https://www.openspaceprogram.org/
MIT License
216 stars 32 forks source link
cpp entity-component-system game-development game-engine physics-engine simulation

osp-magnum

Windows Linux Mac OS X

screenshot

This project is still deep in the pre-release development phase

OpenSpaceProgram is an open source initiative with the goal of creating a space flight simulator inspired by Kerbal Space Program. This project also works as a general-purpose library for space games and simulations with very large universes and multiple planetary systems.

Written in modern C++17, this project mainly features a custom game engine and a universe/orbit simulator, both relying on EnTT and Magnum. The universe and game engine are synchronized for a seamless spaceflight experience from a planet's surface to deep space.

By taking advantage of Entity Component System (ECS) architectures and Data-Oriented Design, this project achieves simplicity, flexibility, low coupling, and excellent performance. With these techniques in action, we can easily avoid spaghetti code and optimize for a high part count.

Features

Core

Extra

Test Application

To act as a temporary menu and scenario loader, a console-based test application is implemented. It is written in simple C++, making it an excellent start to understanding the rest of the codebase.

Building

These are simplified build instructions for an Ubuntu computer. Windows and Mac OS X build instructions are slightly different.

See our GitHub Actions for examples on how to get building for your environment

Install some dependencies, configure the build, build the build!

sudo apt install -y build-essential git cmake libsdl2-dev
git clone --depth=1 --recurse-submodules --shallow-submodules https://github.com/TheOpenSpaceProgram/osp-magnum.git osp-magnum
mkdir build-osp-magnum
cmake -B build-osp-magnum -S osp-magnum -DCMAKE_BUILD_TYPE=Release
cmake --build build-osp-magnum --parallel --config Release --target osp-magnum

Run the unit tests!

cmake --build build-osp-magnum --parallel --config Release --target compile-tests
ctest --schedule-random --progress --output-on-failure --parallel --no-tests error --build-config Release --test-dir build-osp-magnum/test

Run the game!

cd build-osp-magnum/Release
./osp-magnum

If you just want to test out the project so far, then see the Actions tab on GitHub to obtain automated builds for Linux or Windows.

Controls

These controls will seem familiar if you have played Kerbal Space Program!

Navigating

V - Switch game mode

ArrowUp    - Camera look up
ArrowDown  - Camera look down
ArrowLeft  - Camera look left
ArrowRight - Camera look right

RightMouse - Camera orbit

W - Camera forward
S - Camera backwards
A - Camera left
D - Camera right

Q - Camera up
E - Camera down

Flight

S - Vehicle pitch up
W - Vehicle pitch down

A - Vehicle yaw left
D - Vehicle yaw right

Q - Vehicle roll left
E - Vehicle roll right

Z - Vehicle thrust max
X - Vehicle thrust min
LShift - Vehicle thrust increment
LCtrl  - Vehicle thrust decrement

LCtrl+C | LShift+A - Vehicle self destruct

Misc

Space - Debug Throw
LCtrl+1 - Debug Planet Update

Contributing

Our development team is very small right now. We need more crew to help to launch this project to its first release.

Join our Discord Server for the latest discussions. You don't need to be a professional C++ developer to be involved or help! Graphics, sounds, game design, and scientific accuracy are important to this project too.

Checkout Architecture.md to get started with learning the codebase. Feel free to ask questions (even, and especially, the stupid ones); this will greatly help with documentation.

Simplified development roadmap

Random Notes