You are browsing as a guest. Sign up (or log in) to start making projects!

10h 23m 50s logged

Devlog 9 — Kerbal Gravity Program: the REPL is (almost) done

No devlog last week — life happened, then OpenCode helped me absolutely cook.

Newcomers: KGRP is a mission planner for KSP (runs outside the game). You
define a spacecraft, stack events on a timeline, and the sim runs them. Plan
in the tool, fly in the game.

Where we are

The REPL is nearly feature-complete. Every mission action is a TicketEvent
coast, maneuver, burn, engine toggle, science. The REPL never touches your
ship directly; it just advances a ticket in UT and events fire when the
timeline reaches them. One plan drives the renderer, physics, and save file.

Also closed the loop on “one source of truth”: the fancy integrator used to
run in a vacuum (zero gravity) when fired from a ticket. Now go, advance,
and reset all agree on where you are.

go

Pick a start and end orbit from the presets and it works out burns,
coasting, and delta-v, then schedules them:

> go current moon:3a
Transfer plan:
  Current (200,000m circular, 0.0 deg)  ->  Mun orbit (11,400,000m circular, 0.0 deg)  (about Kerbin)
  Burns: 2   Total delta-v: 1,112.7 m/s   Duration: 27,130.1s
    burn   @ 0.0s  dv=764.2 m/s  Raise apoapsis to transfer
    coast  0.0s -> 27,130.1s  Coast to apoapsis
    burn   @ 27,130.1s  dv=348.5 m/s  Circularize / match target
  Resulting orbit: pe=12,000,000m ap=12,000,000m i=0.0 deg around Kerbin

Presets are editable (and saveable to presets.json); the planner core is a
plain importable function (go_plan(ticket, ...).total_dv).

Usability

  • Time input isn’t a math exam: advance 2d 5h, time "Year 2, Day 100".
  • Per-use overrides without touching presets: go current preset:molniya incl=30.
  • go shows the plan and asks before committing (gradual / instant / cancel).
  • edit now handles ships, not just bodies: mass, fuel, orbit elements.
  • New-ticket wizard hands you an engine and 3,000 kg of fuel instead of a paperweight.
  • After a reset you can clear/redo the timeline without fighting the guard.

What’s next

Some math is still coarse: plane changes are exact only for moon targets,
synchronous orbits are a placeholder (no body rotation yet), arg-p/LAN drift
isn’t modeled, and error messages need work — for when you type
advance 5 bananas.

Fun one I found: escaping at exactly escape velocity puts the orbit at
eccentricity 1.000000 and the math gives up — the craft freezes and frame
switches / go turn to nonsense. Interplanetary go is broken because of it,
but burning slightly past escape fixes it (properly hyperbolic, maths happy).
Just needs wiring in.

In the meantime

Planning to put it up on PyPi and hope it works

0
9

Comments 3

@EthanKerman

Dang bro this is sick, 100% gonna use it

@Systemic_speed

by the way, i am going to ship in a few mins

@Systemic_speed

so please use it