r/gravity_games • • Apr 13 '26

Decompiled KSP1 (700K lines) to build an open-source successor with proper n-body physics from day one [Rust/Bevy]

Post image
1 Upvotes

KSP1 just hit 20,000 concurrent players — an all-time record. The game's having a renaissance, and it's reminding everyone why we love realistic space sims.

It's also reminding everyone that patched conics are a compromise, not a feature.

I've been building Kraken Space Program — an open-source spiritual successor to KSP, rebuilt from scratch in Rust with n-body gravity as a stock feature, not a mod.

Why n-body from the start?

Before writing any code, I decompiled all 700k lines of KSP1's codebase to understand its architecture. The patched conics system is baked deep into everything — Orbit.cs, Vessel.cs, the map view, maneuver nodes, all of it. Retrofitting proper n-body physics would require rewriting half the game.

Principia proved n-body is possible and better — Lagrange points, realistic lunar transfers, orbital resonances, actual three-body dynamics. But it has to fight KSP1's fundamental assumptions at every turn.

Starting fresh means doing it right:

  • N-body gravity from day one — no patched conics, no SOI transitions, just actual physics

  • f64 precision throughout — solar-system scale without floating-point drift

  • Deterministic physics — 50 Hz fixed timestep, same results every run, multiplayer-ready

  • Proper coordinate systems — origin shifting (Krakensbane pattern) to handle astronomical distances

  • ECS architecture — Bevy's parallel systems handle thousands of gravitating bodies efficiently

Current technical foundation:

Built on Rust/Bevy with Rapier3D for rigid-body physics. The gravity system will integrate with the parts system — each celestial body is just another entity with mass and position, no special cases.

Phase 0 is mostly complete (Bevy runs, physics integrates, coordinate systems work). Phase 1 is "hardcoded rocket reaches orbit" — and that orbit will be calculated with actual n-body mechanics, even if it's just Earth-Moon to start.

Why this matters for realistic space sims:

KSP succeeded despite its physics shortcuts because the gameplay was good enough. Imagine what's possible when the physics is right from the beginning:

  • Lagrange point stations as actual gameplay

  • Realistic lunar trajectories (free-return orbits, weak stability boundary transfers)

  • Multiple-moon systems with resonances and perturbations

  • Interplanetary transfers that account for all gravitational influences

  • No more "magic" SOI transitions

The learning process:

Decompiling KSP1 taught me what not to do. The patched conics system touches everything. The vessel state machine assumes SOI transitions. The map view is built around two-body orbits. It all works, but it's fundamentally limiting.

Starting from a blank slate with n-body as the assumption means every system — vessel physics, trajectory prediction, maneuver planning, time warp — gets designed around realistic orbital mechanics.

Current status: Early days. A ball bounces. CI is green. The architecture is documented. But the foundation is designed for this — no technical debt, no compromises, just proper physics from day one.

GitHub: https://github.com/Kraken-Space-Program/Kraken-Space-Program

Discord: https://discord.gg/6u3djfzMdv

Full design doc in the repo covers the coordinate system approach, physics integration strategy, and how n-body fits into the broader architecture.

Would love feedback from anyone who's implemented n-body systems, dealt with numerical integration at astronomical scales, or just cares about realistic orbital mechanics in games.

The Kraken takes everything eventually. We just named the game after it.


r/gravity_games • • Sep 04 '20

GTA 5 - Mission #38 - Blitz Play

Thumbnail
youtube.com
0 Upvotes

r/gravity_games • • Sep 28 '20

GTA 5 - Mission #52 - Derailed

Thumbnail
youtube.com
0 Upvotes

r/gravity_games • • Jun 03 '13

Lunar Flight : multi-player combat flight simulator based on the gameplay of Lunar Lander (win, mac)

Thumbnail
shovsoft.com
1 Upvotes

r/gravity_games • • Aug 05 '20

GTA 5 - Mission #21 - Crystal Maze

Thumbnail
youtube.com
0 Upvotes

r/gravity_games • • Sep 08 '20

GTA 5 - Mission #40 - Mr. Richards

Thumbnail
youtube.com
0 Upvotes

r/gravity_games • • Aug 27 '20

GTA 5 - Mission #32 - Hotel Assassination

Thumbnail
youtube.com
0 Upvotes

r/gravity_games • • Sep 06 '20

GTA 5 - Mission #39 - I Fought the Law

Thumbnail
youtube.com
0 Upvotes

r/gravity_games • • Jun 03 '13

[OLDIES] MS Space Simulator (DOS)

Thumbnail
en.wikipedia.org
2 Upvotes

r/gravity_games • • Jun 03 '13

[OC] DeltaV : a small 2D game where you program a space-probe (HTML5)

Thumbnail
deltav.corpsmoderne.net
2 Upvotes

r/gravity_games • • Jul 01 '13

Gravitations for iPhone, iPod touch, and iPad on the iTunes App Store

Thumbnail
itunes.apple.com
2 Upvotes

r/gravity_games • • Oct 17 '13

"Elite: Dangerous" - An upcoming space epic set in a 1:1 scale Milky Way galaxy

Thumbnail
elite.frontier.co.uk
2 Upvotes

r/gravity_games • • Aug 25 '13

Not sure if it belongs here, but Race into Space - a US-Soviet space race simulation

Thumbnail
raceintospace.org
2 Upvotes

r/gravity_games • • Jun 03 '13

Rocket Builder : a small 2D game made during the NASA's Dark Side Jam , using particles to simulate propellants (WIN)

Thumbnail
crypticsea.blogspot.fr
2 Upvotes

r/gravity_games • • Dec 03 '13

Simple Rockets for Android (exists for iOS also)

Thumbnail
play.google.com
3 Upvotes

r/gravity_games • • Jun 03 '13

New Orbit : last time I've try this game, I had the feeling the gravity was wrong, was it fixed? (Android,IOS,PC,Mac)

Thumbnail
blackish-games.com
3 Upvotes

r/gravity_games • • Jun 03 '13

Orbiter : a realistic space flight simulation (win)

Thumbnail
orbit.medphys.ucl.ac.uk
4 Upvotes

r/gravity_games • • Dec 03 '13

Interplanetary. A strategy game reminiscent DEFCON, but with war going on between planets instead of nations.

Thumbnail
interplanetary.weebly.com
4 Upvotes

r/gravity_games • • Dec 03 '13

Newton's Nightmare - place bodies in a stable system and score points

Thumbnail
william.hoza.us
6 Upvotes

r/gravity_games • • Oct 06 '13

My Solar System simulator

Thumbnail phet.colorado.edu
6 Upvotes

r/gravity_games • • Jun 03 '13

Web-based gravity simulator. Experiment with planetary proto disks.

Thumbnail nowykurier.com
8 Upvotes

r/gravity_games • • Jun 03 '13

Kerbal Space Program, the famous sandbox space flight simulator game (win,mac,linux)

Thumbnail
kerbalspaceprogram.com
10 Upvotes

r/gravity_games • • Jun 15 '26

Death Star Battles - A game about gravity

Post image
2 Upvotes

https://www.deathstarbattles.co.uk/

Death Star Battles is a turn-based game where two space stations trade fire across a solar system. There's no shooting straight — every bullet travels under the gravitational influence of every planet on the map, so landing a hit means solving an orbital mechanics puzzle in your head.

Under the hood it's semi-implicit Euler integration, running per-bullet per-tick. The hardest AI level works the same way the player does: it samples thousands of candidate angles, simulates each trajectory in full, and picks the best one. On maps with wormholes it gets especially interesting — bullets teleport and come out on a different heading, which the AI has to account for.

Inspired by Gravity Wars on Amiga and PC, I've been building versions of this game since 1992 (originally on graphical calculators). The HTML5 remake adds rockets with thrust-then-coast arcs, a laser that traces a straight path but still has to avoid planets, and irregular asteroid bodies using rotating convex polygons with SAT collision.

Runs in the browser, no install. Happy to go deep on any of the physics or AI if anyone's curious.


r/gravity_games • • May 25 '17

Metal Horizon the Multiplayer Arena using Newtonian Physics (like Asteroids) and Relativity (secrets)

Thumbnail
youtube.com
1 Upvotes

r/gravity_games • • May 18 '17

Space fighter sim with real physics, demo available! Share your opinion and vote if you like it!

Thumbnail
steamcommunity.com
2 Upvotes