Giter Site home page Giter Site logo

hebarusan / planningnode Goto Github PK

View Code? Open in Web Editor NEW
1.0 5.0 1.0 1.52 MB

Discoverable learn-by-doing method for finding transfers

Home Page: https://forum.kerbalspaceprogram.com/index.php?/topic/200375-*

JSON 0.71% Makefile 2.44% C# 96.41% YAML 0.44%
ksp transfers

planningnode's Introduction

Planning Node

This repository contains a mod for Kerbal Space Program. Its goal is to create a stock-alike method for planning interplanetary transfers that preserves the flexibility and "learn by doing" approach of stock maneuver nodes.

See the README in the download for installation and usage instructions.

See the README in the Localization folder for instructions for adding or improving translations for languages other than English.

Download

The latest version is available on Github.

How to donate

Donate

Building

  1. Install mono
  2. If you don't have Steam, make Source/KSP_Data a symbolic link to your game's KSP_Data folder
  3. make

References

This was 5thHorseman/Superfluous J's idea:

Three years later I started promoting the same concept. I thought that I came up with it on my own, but it is possible that I saw some of the above posts at some point and they sank into my subconscious.

I have a rule that if I catch myself pining for something on the forum multiple times, and no one else starts working on it, I have to; hence this mod.

How to draw orbits!

Acknowledgements

  • Thanks to 5thHorseman for originating and tirelessly advocating for the idea
  • Thanks to @DBooots for posting about how to render your own orbits
  • Thanks to the good folks of the Discord for random help when I needed it
  • Thanks to my wife for assistance with the icon

planningnode's People

Contributors

cfyl avatar hebarusan avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

cfyl

planningnode's Issues

Exception in OrbitDriver.Start โ†’ Orbit.Init on toolbar button click

Background

PlanningNode version: 0.1.2

KSP version: 1.11

Problem

When you click the toolbar button, the mod works, but an exception is thrown, visible on screen and in the log:

[EXC 15:54:20.691] NullReferenceException: Object reference not set to an instance of an object
	Orbit.Init () (at <2afc64dea36946459d4707808bdac511>:0)
	OrbitDriver.Start () (at <2afc64dea36946459d4707808bdac511>:0)

Cause

I think this happens because the Orbit, a default object created by OrbitDriver at its own initialization, doesn't have a reference to a CelestialBody.

However, if I fix that by setting the OrbitDriver's orbit to our real orbit, then something worse happens:

[OrbitDriver Warning!]: DUMMY had a NaN Orbit and was removed.

Or:

[F: 1234567]: Vessel DUMMY crashed through terrain on Kerbin.

After either of these errors, our dummy Vessel is deleted, and our ProtoVessel, Orbit, OrbitDriver, OrbitTargeter, PatchedConicsSolver, PatchedConicsRenderer, and even our toolbar button are deleted along with it. In other words, the mod disappears completely immediately upon clicking the button. The cascading deletes are probably due to sharing GameObjects at whatever level, but I am not confident that having part of the structure deleted would be any more recoverable. Some kind of more advanced Unity magic may be needed here to work around this.

In the meantime, this exception doesn't stop anything from working, so it should be safe to ignore.

Hide marker text behind planets

Motivation

The bullseye rings are blocked by planets, but the text isn't:

image

Originally reported by forum user Krazy1.

Cause

The rings are LineRenderers, which exist in world space and so can be covered up by other things.

The text strings are GUI.Buttons, which are in a separate layer on top of everything else, so nothing covers them.

Ideas

Switch to UnityEngine.UI.Button and UnityEngine.UI.Text objects in world space.
So far when I try this, nothing displays, so I'm not initializing them right. Need some sample code from another mod to understand how to use them.

Also the rings should be switched from layer 9 to 31. I think the former came from TransferWindowPlanner, but stock orbit lines use the latter. This makes them disappear when you zoom out even slightly; layer 9 looks better for now.

I tried asking for help on the forum, but nobody seems to have an example of this component working in world space.

Log spam when editing nodes

Background

PlanningNode version: 0.1.2

KSP version: 1.11

Problem

LOTS of these messages (a user reported 1 MB/s; I saw a 13 MB total log after testing) are filed to the log by stock code some of the time while the node editor is active:

[LOG 19:17:05.807] dT is NaN! tA: NaN, E: NaN, M: NaN, T: NaN
  at System.Environment.get_StackTrace () [0x00000] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at Orbit.GetDTforTrueAnomaly (System.Double tA, System.Double wrapAfterSeconds) [0x00000] in <2afc64dea36946459d4707808bdac511>:0 
  at Trajectory.UpdateFromOrbit (Orbit orbit, System.Int32 sampleCount) [0x00000] in <2afc64dea36946459d4707808bdac511>:0 
  at PatchRendering.UpdatePR () [0x00000] in <2afc64dea36946459d4707808bdac511>:0 
  at PatchedConicRenderer.LateUpdate () [0x00000] in <2afc64dea36946459d4707808bdac511>:0 

It isn't consistent from what I have been able to gather; sometimes it happens, sometimes not.

Cause

The message says that dT, tA, E, M, and T are all NaN, which suggests to me that those are orbital elements of an orbit that hasn't been initialized. Since the orbit is a parameter to Trajectory.UpdateFromOrbit, it must be originating somewhere in the PatchRendering.UpdatePR call. So maybe there's a render patch that doesn't have a valid orbit? If we could find that patch, maybe we could set activePatch = false to prevent it from being checked like this. Don't know when that should be done, though. Before PatchedConicRenderer.LateUpdate, I guess.

Career mode compatibility

Background

PlanningNode version: 0.1.3

KSP version: 1.11

Problem

Exceptions are thrown in early careeer mode:

image

And:

Then I tried clicking the node to open the handles like other nodes do. I got orange errors and more red exceptions; the view jumped back; the Esc, Tab and M keys stopped responding.

Thanks to forum user Krazy1 for running career mode so I don't have to.

Cause

Vessel.patchedConicSolver is null until patched conics are unlocked.

var nodes = v.patchedConicSolver.maneuverNodes;

renderer.vessel.patchedConicSolver.UpdateFlightPlan();

There may be other issues once this is fixed, and I should decide how planning node creation and editing should fit into career mode progression.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.