#K2-D2
1 messages · Page 1 of 1 (latest)
I like the idea of this, but have you looked at https://discord.com/channels/1078696971088433153/1082063068445552731
Nope !!! @edgy river is so productive. Thanks a lot
I made some serious progress yesterday. still not very precise.
it is quite more stable. but the fact is that We really can't trust SAS and Autopilot Infos. need now a better direction check
Work in progress : https://github.com/cfloutier/autoexecutenode
Great progress this day. I found a solid ways to use private fields from ksp using c# reflexion.
Vector of manoeuvre nodes are available this ways. And many other important information. Really more accurate than following what the public SAS class gives.
I just stopped bothering about SAS. my first version will only check the vessel direction before autoWarp.
This project has been renamed to K2D2
K2-D2
thanks for @nova rain for the name
and we start a collaboration with @neat badge
🍾
damnit the patch have been released. should rebuild I think
@wraith glen is this a good place to discuss K2-D2? Looks like you've not used this channel since 3/16.
There may be a minor issue with how you're setting up the maneuver nodes - or it's a design feature that I don't grasp the utility of. In Maneuver.cs you have the following code.
mapCore.map3D.ManeuverManager.GetNodeDataForVessels();
mapCore.map3D.ManeuverManager.UpdatePositionForGizmo(maneuverNodeData.NodeID);
mapCore.map3D.ManeuverManager.UpdateAll();
mapCore.map3D.ManeuverManager.RemoveAll();
So, you get the node, updated the gizmo position, then UpdateAll, and then remove the gizmo. This has two effects. First, the player can't easily modify the K2-D2 generated node manually, and secondly they can't see it or modify it using Maneuver Node Controller.
Is this an intentional feature? In my version I do something similar, but don't call RemoveAll(), and so when Flight Plan creates a node I can use MNC to inspect what I've created. One use case for me (not a common one at all) is that I'd like to create a node with Flight Plan, and then create a node for the same purpose with K2-D2 to see if our results are similar. That has got to be the most obscure corner case for a use case, but there it is - quality control checks on created maneuver nodes.
Would you prefer discussion/feedback on K2-D2 in some other channel?
Oh, another side effect of RemoveAll. Not only is the gizmo gone, but the burn control window is still there except the delete button wont get rid of the node... This can be addressed by creating another node and then deleting that one.
@late bane Thanks for the help . I know there where a trouble in editing nodes. Got many errors in some cases adding nodes.
I'll try your way. Sure it will help. Thanks a lot
Currently I'm working hard on an auto landing. It's quite good for the moment. Yesterday i've landed 90 % of my vessels in various situations of mass a rocket thrusts.
Still got trouble when the land is not really flat. The landing point is quite tricky to find if the direction of speed is horizontal. But if you avoid a too much horizontal speed it's quite working. I've used your ships in the Ksp2 forum as crash test. And I've add no real trouble with them.
I think I just need some UI adaptation for the next release. Your UI trick With edit fields will help thanks again
I've been getting some NRE's from my maneuver node creation code and had a good discussion with munix and scarecrow in the mod-making-help channel last night. We tried a few things to issolate where the NREs are coming from, but they appear to be internal to KSP2 functions. I'm going to set up VS to be able to debug KSP2 plugins and try with breakpoints to see if I can find out what is really causing it. We even tried making the function a IEnumerator type so that it can wait for a tic of the sim before updating the gizmo in case the calls to update that were just too soon.
private IEnumerator MakeNode(ManeuverNodeData nodeData)
{
// Add the new node to the vessel
GameManager.Instance.Game.SpaceSimulation.Maneuvers.AddNodeToVessel(nodeData);
// Wait a tick for things to get created
yield return new WaitForFixedUpdate();
// Update the map so the gizmo will be there
MapCore mapCore = null;
Game.Map.TryGetMapCore(out mapCore);
var m3d = mapCore.map3D;
var mm = m3d.ManeuverManager;
try { mm?.GetNodeDataForVessels(); }
catch { Debug.LogError("[Maneuver Node Controller] caught exception on call to mapCore.map3D.ManeuverManager.GetNodeDataForVessels()"); }
if (nodeData != null)
{
currentNode = nodeData;
try { mm.UpdatePositionForGizmo(nodeData.NodeID); }
catch { Debug.LogError("[Maneuver Node Controller] caught exception on call to mapCore.map3D.ManeuverManager.UpdatePositionForGizmo()"); }
try { mm.UpdateAll(); }
catch { Debug.LogError("[Maneuver Node Controller] caught exception on call to mapCore.map3D.ManeuverManager.UpdateAll()"); }
}
// Refresh the node (may not need this unless we're actually updating it)
var universeModel = game.UniverseModel;
var vesselComponent = universeModel.FindVesselComponent(currentNode.RelatedSimID);
var simObject = vesselComponent.SimulationObject;
var maneuverPlanComponent = simObject.FindComponent<ManeuverPlanComponent>();
if (currentNode != null)
{
maneuverPlanComponent.UpdateChangeOnNode(currentNode, burnParams);
maneuverPlanComponent.RefreshManeuverNodeState(0); // Getting NREs here...
}
}
When I go to create an empty node with that code I call it like this
if (addNode)
{
// Add an empty maneuver node
Logger.LogInfo("Adding New Node");
// Define empty node data
burnParams = Vector3d.zero;
double UT = game.UniverseModel.UniversalTime;
if (activeVessel.Orbit.eccentricity < 1)
{
UT += activeVessel.Orbit.TimeToAp;
}
// Create the nodeData structure
ManeuverNodeData nodeData = new ManeuverNodeData(activeVessel.SimulationObject.GlobalId, false, game.UniverseModel.UniversalTime);
// Populate the nodeData structure
nodeData.BurnVector.x = 0;
nodeData.BurnVector.y = 0;
nodeData.BurnVector.z = 0;
nodeData.Time = UT;
StartCoroutine(MakeNode(nodeData));
}```
I sometimes get an NRE from maneuverPlanComponent.RefreshManeuverNodeState(0);, and I'm trapping NREs with try/catch blocks around the various ManeuverManager.* calls. I do reliably get nodes, but I don't know why I'm also getting NREs when there's an active vessel.
@late bane The RemoveAll() should actualy be in the front. I think i need to change that in my code. Thanks👍
Thanks @neat badge I'll give that a shot and see if it has any impact to the NRE's I'm getting with the other ManeuverManager calls.
so cool, thanks a lot
This seems to be fixing some NREs! I don't seem to be getting any from the ManeuverManager.* calls, though I do still get them from the maneuverPlanComponent.RefreshManeuverNodeState(0) call. Not sure what I'm doing wrong there.
and we can be sure it will change a bit in the next KSP2 patch
@late bane I've looked at your FlighPlan code and found the way to forbid key Input
if (gameInputState && inputFields.Contains(GUI.GetNameOfFocusedControl()))
{
// Logger.LogInfo($"[Flight Plan]: Disabling Game Input: Focused Item '{GUI.GetNameOfFocusedControl()}'");
gameInputState = false;
// game.Input.Flight.Disable();
GameManager.Instance.Game.Input.Disable();
}
else if (!gameInputState && !inputFields.Contains(GUI.GetNameOfFocusedControl()))
{
// Logger.LogInfo($"[Flight Plan]: Enabling Game Input: FYI, Focused Item '{GUI.GetNameOfFocusedControl()}'");
gameInputState = true;
// game.Input.Flight.Enable();
GameManager.Instance.Game.Input.Enable();
}
thanks for that. But I was wondering how you defined the EditorField names.
Oh sorry, i've found : GUI.SetNextControlName(entryName);
everything is clear now
Yesterday. I've met the the overwrap bug.
So I need to fix it before next release.n
BTW the next version is close.
- The landing is working quite well even with very heavy ship
- The UI has been totally revisited. Creating a new gui skin.
But there are still some issues to fix
- The autowarp. I'll just try to use the standard timewarp mode
- The node creation issue. @neat badge do you thing you would have time to take a look to @late bane fixes ?
See you
Ill take a look at it rn
I've been messing around with node creation in my fork of Maneuver Node Controller as well. I'm closing in on what I hope is an improved thing where I wrap the calls to ManeuverManager inside an IEnumerator method that has a couple of yield return new WaitForFixedUpdate(); calls in strategic places. This hasn't completely fixed an issue I've had with that, but I have driven all exceptions out of that code. I'm not catching any and no unhandled exceptions are popping up. That said, there are a few places where I find I need to hit the button twice to get the maneuver gizmo to be in the right spot. When I get this a little closer I'll propagate this back to Flight Plan
private IEnumerator UpdateNode(ManeuverNodeData nodeData)
{
MapCore mapCore = null;
Game.Map.TryGetMapCore(out mapCore);
var m3d = mapCore.map3D;
var maneuverManager = m3d.ManeuverManager;
var universeModel = game.UniverseModel;
VesselComponent vesselComponent;
if (currentNode != null)
{
vesselComponent = universeModel.FindVesselComponent(currentNode.RelatedSimID);
}
else
{
vesselComponent = activeVessel;
}
var simObject = vesselComponent.SimulationObject;
var maneuverPlanComponent = simObject.FindComponent<ManeuverPlanComponent>();
// Wait a tick for things to get created
yield return new WaitForFixedUpdate();
// Manage the maneuver on the map
maneuverManager.RemoveAll();
try { maneuverManager?.GetNodeDataForVessels(); }
catch { Logger.LogError("UpdateNode: caught exception on call to mapCore.map3D.ManeuverManager.GetNodeDataForVessels()"); }
try { maneuverManager.UpdateAll(); }
catch { Logger.LogError("UpdateNode: caught exception on call to mapCore.map3D.ManeuverManager.UpdateAll()"); }
try { maneuverManager.UpdatePositionForGizmo(nodeData.NodeID); }
catch { Logger.LogError("UpdateNode: caught exception on call to mapCore.map3D.ManeuverManager.UpdatePositionForGizmo()"); }
// Wait a tick for things to get created
yield return new WaitForFixedUpdate();
try { maneuverPlanComponent.RefreshManeuverNodeState(0); } // Occasionally getting NREs here...
catch (NullReferenceException e) { Logger.LogError($"UpdateNode: caught NRE on call to maneuverPlanComponent.RefreshManeuverNodeState(0): {e}"); }
}```
Previously the calls to RefreshManeuverNodeState(0) were giving me some real trouble. I doubt I need all that try/catch stuff around the maneuverManager calls now that I've got RemoveAll first.
private void AddManeuverNode(ManeuverNodeData nodeData)
{
Logger.LogInfo("AddManeuverNode");
GameManager.Instance.Game.SpaceSimulation.Maneuvers.AddNodeToVessel(nodeData);
// For KSP2, We want the to start burns early to make them centered on the node
nodeData.Time -= nodeData.BurnDuration / 2;
Logger.LogInfo($"AddManeuverNode: BurnVector [{nodeData.BurnVector.x}, {nodeData.BurnVector.y}, {nodeData.BurnVector.z}] m/s");
Logger.LogInfo($"AddManeuverNode: BurnDuration {nodeData.BurnDuration} s");
Logger.LogInfo($"AddManeuverNode: Burn Time {nodeData.Time}");
// Set the currentNode to the node we just created and added to the vessel
currentNode = nodeData;
StartCoroutine(UpdateNode(nodeData));
Logger.LogInfo("AddManeuverNode Done");
}```
private void CreateManeuverNodeAtUT(Vector3d burnVector, double UT)
{
Logger.LogInfo("CreateManeuverNodeAtUT");
PatchedConicsOrbit referencedOrbit = GetLastOrbit() as PatchedConicsOrbit;
if (referencedOrbit == null)
{
Logger.LogError("CreateManeuverNodeAtUT: referencedOrbit is null!");
return;
}
if (UT < game.UniverseModel.UniversalTime + 1) // Don't set node to now or in the past
UT = game.UniverseModel.UniversalTime + 1;
ManeuverNodeData nodeData = new ManeuverNodeData(activeVessel.SimulationObject.GlobalId, true, UT);
IPatchedOrbit orbit = referencedOrbit;
orbit.PatchStartTransition = PatchTransitionType.Maneuver;
orbit.PatchEndTransition = PatchTransitionType.Final;
nodeData.SetManeuverState((PatchedConicsOrbit)orbit);
nodeData.BurnVector = burnVector;
Logger.LogInfo($"CreateManeuverNodeAtUT: BurnVector [{burnVector.x}, {burnVector.y}, {burnVector.z}] m/s");
Logger.LogInfo($"CreateManeuverNodeAtUT: BurnDuration {nodeData.BurnDuration} s");
Logger.LogInfo($"CreateManeuverNodeAtUT: Burn Time {nodeData.Time} s");
AddManeuverNode(nodeData);
}```
I call that one above to create a node, but I think you guys would call this one?
private void CreateManeuverNodeAtTA(Vector3d burnVector, double TrueAnomalyRad)
{
Logger.LogInfo("CreateManeuverNodeAtTA");
PatchedConicsOrbit referencedOrbit = GetLastOrbit() as PatchedConicsOrbit;
if (referencedOrbit == null)
{
Logger.LogError("CreateManeuverNodeAtTA: referencedOrbit is null!");
return;
}
double UT = referencedOrbit.GetUTforTrueAnomaly(TrueAnomalyRad, 0);
CreateManeuverNodeAtUT(burnVector, UT);
}```
Also, I've observed that it's seems to be important NOT to create a node at the current UT. When I do that I don't get a gizmo. Offsetting by as little as 1 sec can be enough, but I usually offset by 30s just to give the playerr a minimal amount of time to get ready for the node.
thanks again for help.
It make sense the yield return...
we've got to wait for the next frame to let KSP2 the time to create all gizmos and internal classes are created before going further.
It was actually something @lilac parrot suggested! I'm not nearly smart enough to come up with something like that on my own. It does appear to be helping, but there are still some issues with how it's working in Maneuver Node Controller - not things I think would be an issue for K2-D2 or Flight Plan though.
I hope we will find all the ways to avoid KSP2 troubles. And with patches and update it will sure change a lot. our fixes will have to change with new new versions. We can hope that with time it will be stable and more easy to use. like having a simple addManeuver(..) from the KSP api that work all the time without disturbing the core.
By the way, I've integrated you editorfield code. It's working perfectly ! excellent.
Watch out for one slight glitch with that code. Every so often I think is somehow fails to re-enable game input even though it says it's done it. When this happens you'll probably notice that you can't use the mouse to adjust your camera view, etc. I put an extra re-enable in the window close so that closing the window may unfreeze things. I haven't seen this much, but it may be an issue to watch for and keep an eye on.
@wraith glen I think I may have found a bug in the maneuver node creation method. If you manually create a node that node will start with a false for the is on trajectory property. The code above sets this to true and also attaches the orbit. When I change the initial creation of the node to have a false in that call Maneuver Node Control works great with all the various Snap To buttons. When I set it to true then all sorts of bad things ensue.
I want to investigate this further, but I suspect that it may be unwise to start the node out with a true on that property. I also noticed that with a manually created node it does not start with a maneuver patch attached, but that the method above attaches one. I had thought that was coming in with the call to SetManeuverState, but commenting that out didn’t appear to get me closer to a node that’s like a manually created node.
I just don’t know enough yet about how this is supposed to work, but my change to false seems to be making MNC behave much better. I’ve gone to that with Flight Plan to, but that has so many other issues just now.
For Flight Plan I think I’ll make a list of all the KSP1 to KSP2 conversions I’ve assumed. It may be possible to ping the KSP1 modding community to try to help confirm these. If I’ve made poor assumptions that will definitely cause issues! And having a guide like that may aid those transitions from KSP1 modding
Sure it would be really useful for next modders. I'll try from my side to write a little documentation about different coordinate frames.
I think I'll put a KSP1toKSP2.md file into the project to keep my notes there. We can pass such a thing around to let people correct and update it as we learn more!
yes it's a good staring point.
from my side I'm struggling with computing a real altitude. not from cockpit but from the legs....
I've tried many ways to compute it without a good sucess.
when I landed the altitude meter seem to show the altitude of the cockpit. But I can't figure out where the cockpit is from the center of the vehicle. We can have a bounding rect and sphere but the center is not relative to the cockpit
Today I've tried to fix the overwarp trouble. I've tried to use KSP WarpTo function. but I soon remembered why I did create my own warp mode. when going back to x1 there were random position in my vessels part, like dismembered.
I then changed a bit the way time warp speed is computed. I hope it did fix the bug.
But I still have trouble computing real burned DV.... I need to check to the way it is computed in MicroEngineer
work in progress, still some errors in the auto-node. i've overburned before landing
Voyage vers la lune et atterrissage auto.
on vois que j'ai encore quelques soucis dans quelques cas :)
j'ai du arreter le burn auto car il faisait n'imp près de la lune
and The landing is quite far from ground...
Outstanding! Nice landing. I really like how your burn execution is working, too.
That was literally the smoothest landing I've ever seen. And this is just the mod?
You're a bloody genius!
Yes this is the mod. Thanks a lot. I hope i'll release it this evening.
not for tonight but i'm really close to it
I've gone ahead and released FlightPlan 0.6.0. If it's any help to you and your work, I beleive I've sorted out a way to take delta V vectors computed in the orbital frame and translate them into burn vectors. See the code snips here: https://discordapp.com/channels/1078696971088433153/1095126151673938051
excellent ! I'll have a look during lunch.
for the dv as advised by @cursive ibex, I used a very similar way to compute it
Vector velocity_after_maneuver = current_vessel.VesselComponent.Orbiter.ManeuverPlanSolver.GetVelocityAfterFirstManeuver(out ut);
var current_vel = current_vessel.VesselComponent.Orbit.GetOrbitalVelocityAtUTZup(ut);
var delta_speed_vector = velocity_after_maneuver.vector - current_vel;
var sign = Math.Sign(Vector3d.Dot(initial_dir, delta_speed_vector));
remaining_dv = delta_speed_vector.magnitude;
there is no major error for the moment. the tricky part has been to compute sign to avoir overburn
a new version is available
Kerbal Space Program 2's new mod : K2-D2
First working tests with The latest version of Mod.
download it on available on SpaceDock
I like your new banner on your SpaceDock page! Nice! Very engaging! I'll give this version a try - I'd like to see how well it can execute some of the nodes FP is generating, and also want to take your spiffy new Landing capability for a spin!
I've executed every Node created by flight Plan and it was I think quite precise. the new way to compute the burn you pointed out work pretty well
Thanks! There's some real synergy with these mods I think. I've got a lot more work refining things and driving bugs out, but I'm really pleased I don't need to worry about precision node execution when there's K2-D2 to solve that! Plus Landing?! Even better!
excellent. I hope you'll find out what happens to the direction of your Nodes. I really think it's only a trouble of reprojection in different coordinate systems. But it can be tricky to find out how to do it properly.
damnit the last patch broke my final landing detection.
Nuts! That's a shame. I found I needed to recompile with a fresh copy of Assembly-CSharp.dll and that fixed some things. It seems New Pe and New Ap are now more reliable! I hope your fix is just as easy.
there are good things in this new release. the collision point is more precise, but it disappear when reached an altitude near to the ground. I used it during the whole process. so I consider to be on orbit... I've tried to correct that without real succees for the moment. I need to change my controller logic a little bit.... But it won't be hard
for the execute node I've met many overburn the engine restarted at the end of process. I still need then to check what happened. It seems to be like your trouble in FlighPlan. the projection of the vector does not match.
But it happens when the simulation wasn't stable at all. after a fresh reload all was better... But It would be cool to detect those behavior of ksp before burning the entire fuel....
ok released a new version. with only correction (but important corrections)
Hey @wraith glen , when using K2-D2 to execute a node I've created, I notice that it first points in the direction of the burn (good), then time warps to the burn (good), then starts the burn a little late (maybe a second?), and then gradually allows the craft to wander away from the burn direction (not good at all). Is the intended use that the player should click on the Maneuver Node Targeting for SAS? I've not been doing that assuming that K2-D2 would either turn on target mode in SAS for me or otherwise control the pointing.
hello @late bane. thanks for the test.
for the start. I thought it was an erreor but in fact There is difference between what is show in the maneuver planel (bottom of the screenà and real UT time in float. it shows zero when the time is between 0 and 1. I've tries to remove this second but it added a small direction error after execution. I'll add this option as a debug option to let you try by yourself.
same thing for the direction of the node. I stick to the startup direction. because rotation while the maneuver node is moving was a mistake. it was for sure in previous KSP2 version, and results was awful. specially when doing plan changes maneuvers.
I'll add this option too because this can change in next KSP versions.
I could also add the option to burn half of the time before start dt....
I've made the little changes and it appears that starting before T0 seems to be a good point. I'll let you test.
i've added new settings :
the Rotate During Burn does not seems to be a good option. It's in fact different from KSP1 behavior. The marker start to move at the very beginning of the burn process. it's possible that ksp2 compute the direction based on new orbit direction. where KSP1 compute this using previous orbit....
new version updates with the options
enjoy @late bane. tell me if it answers your questions. the mid duration burn seems to be the better option.
Hey I fixed some NREs I was getting with my maneuver node creation code by adapting what I found KS2 doing. In my AddManeuverNode method I've got this now
// GameManager.Instance.Game.SpaceSimulation.Maneuvers.AddNodeToVessel(nodeData);
ManeuverPlanComponent maneuverPlan;
maneuverPlan = activeVessel.SimulationObject.ManeuverPlan;
maneuverPlan.AddNode(nodeData, true);
activeVessel.Orbiter.ManeuverPlanSolver.UpdateManeuverTrajectory();```
which is now setting things up so that when I call this
cs```
if (currentNode != null) // just don't do it... was: if (currentNode != null)
{
// Manage the maneuver on the map
maneuverManager.RemoveAll();
try { maneuverManager?.GetNodeDataForVessels(); }
catch (Exception e) { Logger.LogError($"UpdateNode: caught exception on call to mapCore.map3D.ManeuverManager.GetNodeDataForVessels(): {e}"); }
try { maneuverManager.UpdateAll(); }
catch (Exception e) { Logger.LogError($"UpdateNode: caught exception on call to mapCore.map3D.ManeuverManager.UpdateAll(): {e}"); }
try { maneuverManager.UpdatePositionForGizmo(nodeData.NodeID); }
catch (Exception e) { Logger.LogError($"UpdateNode: caught exception on call to mapCore.map3D.ManeuverManager.UpdatePositionForGizmo(): {e}"); }
}```
I'm not getting NREs with each try block
The true in the call to maneuverPlan.AddNode(nodeData, true) triggers "rebuilding", which seems to be the trick I think.
Now off to Tylo!
Haaaa cool digging in ksp tricks.
I'll try it. Thanks a lot
Yesterday, I've experimented differents Coordinate system. it starts to be clearer than before. i'll write the doc adding pictures...
I've also started the Auto Ascent pilot. It's working quite well but the configuration is awful
I'll try to simplify it
I've alos addd a V-speed controller. enabling to pilot your lander like a drone
Made progress today in creating nodes. I'm quite close to a new relase.
Please tell me how Drone Mode works! I'm dying to know. I want to use that!
I love that rocket! So Buck Rodgers!
yes it's a mode that emerged during Landing coding. as during touchdown I've had to master the vertical speed, It was fun to let the player choose it by hand
It is the rocket name 🙂 BuckRodger II
Outstanding! Perfect name! Did you share it online?
If not, I'm going right out to build one like it. That thing is gorgeous!
Thanks!
no I didn't put it on the forum yet. could do it. I use it in infinite fuel mode to test my code.
rcs everywhere to fit direction. little drag, very small but 2000 dv.
Of course.. Not necessarily a practical design, but a beautiful one nonetheless
I have to be nice 🙂 it's totally surrealistic
The Lift work well. and adding the final Ap from FlightPlan works perfectly too
Yes,
Yes settings is not intuitive at all. but it works well.
you choose the start and end altitude, and the 2 slider guide at wich altitude we point to 45° and 5°
I see, you've got a way to describe the gravity turn there
One thing that would make this even more awesome. If you can pick a celestial target and set the launch time and heading to get into a co-planar orbit. Fantastic for getting to Minmus.
I think MJ has some code for that which we may be able to borrow. I'd have to look. Just want a solution for the launch time and set the heading based on target inc
Oo That would be so cool.
I'll look around for it and point you to it. That should be in your mod.
I've never taken from mechjeb for the moment, cause I wanted to figure out thing mby myself. but this kind of astro math stuff is too hard for me.
thank you if you have a clue to where to find, i'll add it 🙂
If you prefer.. But I'll look regardless. I suspect it's not that hard.
thanks again for the synergy. FlightPlan and K2-D2 are perfect togethers.
see you, it's time for rest 🙂
Good night then!
There's this code in MechJebModuleAscentMenu.cs
if (!_launchingWithAnyPlaneControl)
{
// Launch to Rendezvous
if (targetExists && _ascentSettings.AscentType != AscentType.PVG
&& GuiUtils.ButtonTextBox(CachedLocalizer.Instance.MechJeb_Ascent_button14, _ascentSettings.LaunchPhaseAngle, "º",
width: 40)) //Launch to rendezvous:
{
_launchingToRendezvous = true;
_autopilot.StartCountdown(vesselState.time +
TimeToPhaseAngle(_ascentSettings.LaunchPhaseAngle,
mainBody, vesselState.longitude, core.target.TargetOrbit));
}
//Launch into plane of target
if (targetExists && GuiUtils.ButtonTextBox(CachedLocalizer.Instance.MechJeb_Ascent_button15, _ascentSettings.LaunchLANDifference, "º",
width: LAN_WIDTH)) //Launch into plane of target
{
_launchingToPlane = true;
(double timeToPlane, double inclination) = Functions.MinimumTimeToPlane(
mainBody.rotationPeriod,
vesselState.latitude,
vesselState.celestialLongitude,
core.target.TargetOrbit.LAN - _ascentSettings.LaunchLANDifference,
core.target.TargetOrbit.inclination
);
_autopilot.StartCountdown(vesselState.time + timeToPlane);
_ascentSettings.DesiredInclination.val = inclination;
}
...
}```
Cool just have to follow the time to plane
And this in functions.cs
/// <summary>
/// Find the time to a target plane defined by the LAN and inc for a rocket on the ground. Wrapper which handles
/// picking the soonest of the northgoing and southgoing ground tracks.
/// </summary>
/// <param name="rotationPeriod">Rotation period of the central body (seconds).</param>
/// <param name="latitude">Latitude of the launch site (degrees).</param>
/// <param name="celestialLongitude">Celestial longitude of the current position of the launch site.</param>
/// <param name="lan">Longitude of the Ascending Node of the target plane (degrees).</param>
/// <param name="inc">Inclination of the target plane (degrees).</param>
public static (double time, double inclination) MinimumTimeToPlane(double rotationPeriod, double latitude, double celestialLongitude,
double lan, double inc)
{
double north = TimeToPlane(rotationPeriod, latitude, celestialLongitude, lan, Math.Abs(inc));
double south = TimeToPlane(rotationPeriod, latitude, celestialLongitude, lan, -Math.Abs(inc));
return north < south ? (north, Math.Abs(inc)) : (south, -Math.Abs(inc));
}
This will also get you close to Launch to Rendezvous! How cool will that be! Rescuing Jeb has never been easier!
You'll want to look at this, too.
/// <summary>
/// Find the time to a target plane defined by the LAN and inc for a rocket on the ground.
/// </summary>
/// <param name="rotationPeriod">Rotation period of the central body (seconds).</param>
/// <param name="latitude">Latitude of the launch site (degrees).</param>
/// <param name="celestialLongitude">Celestial longitude of the current position of the launch site (degrees).</param>
/// <param name="lan">Longitude of the Ascending Node of the target plane (degrees).</param>
/// <param name="inc">Inclination of the target plane (degrees).</param>
public static double TimeToPlane(double rotationPeriod, double latitude, double celestialLongitude, double lan, double inc)
{
latitude = Deg2Rad(latitude);
celestialLongitude = Deg2Rad(celestialLongitude);
lan = Deg2Rad(lan);
inc = Deg2Rad(inc);
// handle singularities at the poles where tan(lat) is infinite
if (Math.Abs(Math.Abs(latitude) - PI / 2) < EPS)
return 0;
// Napier's rules for spherical trig
// the clamped Asin produces correct results for abs(inc) < abs(lat)
double angleEastOfAN = SafeAsin(Math.Tan(latitude) / Math.Tan(Math.Abs(inc)));
// handle south going trajectories (and the other two quadrants that Asin doesn't cover).
// if you are launching to the north your AN is always going to be [-90,90] relative to
// the zero of the launch site. or facing the launch site your AN is always going to be
// in "front" of the planet. but launching south the AN is [90,270] and the AN is always
// "behind" the planet.
if (inc < 0)
angleEastOfAN = PI - angleEastOfAN;
double lanNow = celestialLongitude - angleEastOfAN;
double lanDiff = lan - lanNow;
// handle planets that rotate backwards
if (rotationPeriod < 0)
lanDiff = -lanDiff;
return Clamp2Pi(lanDiff) / TAU * Math.Abs(rotationPeriod);
}```
Here is TimeToPhaseAngle if you want that one
//Computes the time until the phase angle between the launchpad and the target equals the given angle.
//The convention used is that phase angle is the angle measured starting at the target and going east until
//you get to the launchpad.
//The time returned will not be exactly accurate unless the target is in an exactly circular orbit. However,
//the time returned will go to exactly zero when the desired phase angle is reached.
private static double TimeToPhaseAngle(double phaseAngle, CelestialBody launchBody, double launchLongitude, Orbit target)
{
double launchpadAngularRate = 360 / launchBody.rotationPeriod;
double targetAngularRate = 360.0 / target.period;
if (Vector3d.Dot(-target.GetOrbitNormal().Reorder(132).normalized, launchBody.angularVelocity) < 0)
targetAngularRate *= -1; //retrograde target
Vector3d currentLaunchpadDirection = launchBody.GetSurfaceNVector(0, launchLongitude);
Vector3d currentTargetDirection = target.SwappedRelativePositionAtUT(Planetarium.GetUniversalTime());
currentTargetDirection = Vector3d.Exclude(launchBody.angularVelocity, currentTargetDirection);
double currentPhaseAngle = Math.Abs(Vector3d.Angle(currentLaunchpadDirection, currentTargetDirection));
if (Vector3d.Dot(Vector3d.Cross(currentTargetDirection, currentLaunchpadDirection), launchBody.angularVelocity) < 0)
{
currentPhaseAngle = 360 - currentPhaseAngle;
}
double phaseAngleRate = launchpadAngularRate - targetAngularRate;
double phaseAngleDifference = MuUtils.ClampDegrees360(phaseAngle - currentPhaseAngle);
if (phaseAngleRate < 0)
{
phaseAngleRate *= -1;
phaseAngleDifference = 360 - phaseAngleDifference;
}
return phaseAngleDifference / phaseAngleRate;
}```
perfect ! it should be easy to adapt.
just wondering how to get vessel Longitude ... adding local Longitude + Body rotation.
The mechJeb seem to be an excellent pack of code.... I'll dig a little into to get answers.
🤟
Either FP or ME can show how to get longitude. It's easy.
public static double GetLatitude(this PatchedConicsOrbit o, double UT)
{
double latitude, longitude, altitude;
Position position = new Position(o.referenceBody.coordinateSystem, o.SwappedAbsolutePositionAtUT(UT));
o.referenceBody.GetLatLonAltFromRadius(position, out latitude, out longitude, out altitude);
return latitude; // * UtilMath.Rad2Deg;
}
public static double GetLatLon(this PatchedConicsOrbit o, double UT, out double longitude)
{
double latitude, altitude;
Position position = new Position(o.referenceBody.coordinateSystem, o.SwappedAbsolutePositionAtUT(UT));
o.referenceBody.GetLatLonAltFromRadius(position, out latitude, out longitude, out altitude);
// longitude *= UtilMath.Rad2Deg;
return latitude; // * UtilMath.Rad2Deg;
}
public static double GetLongitude(this PatchedConicsOrbit o, double UT)
{
double latitude, longitude, altitude;
Position position = new Position(o.referenceBody.coordinateSystem, o.SwappedAbsolutePositionAtUT(UT));
o.referenceBody.GetLatLonAltFromRadius(position, out latitude, out longitude, out altitude);
return longitude; // * UtilMath.Rad2Deg;
}```
Suggestion: disable game input when player is editing a text field. Something like this: https://github.com/Falki-git/MicroEngineer/blob/new-entries-and-more/MicroEngineerProject/MicroEngineer/Utilities/Utility.cs#L247
i've already integrated such a thing. It ddnt wor for you @cursive ibex ?
Nope, and I just downloaded the newest version via CKAN. I'll try again to be sure
@wraith glen , I see now. Most fields are locked, but these ones aren't
Oh and BTW, I really like the mod and how it's developing, well done 🙂 👍
Ah yes you're right. this page is a work in progress and I haven't used the right field there. Thanks for testing the ckan way. I didn't had time to check if it was really added. Excellent
good news for K2D2
thanks to @lilac parrot the font loading work at last. it was quite easy in fact.... thanks for taking time to help me without just saying read the f***** manual 🙂
the font rendering works quite well
🤟
I've got many change to aplly since the rendering is quite totally different. I'll try to fix this version. and then have a look to UITK.
The new SpaceWarp windows is awesome.
I worth a look definively
Nice fonts!
UITK is pretty slick I think. I'm getting very close to an MNC solution.
@wraith glen , @late bane , would you mind if I st... borrow your close and settings buttons? I like them! And they'll fit the new UITK styling better.
Those are @wraith glen's work, and I like them too! I think we've got some great mods going on here that really deliver a lot of capability that integrates well, so the more we look alike the better as that gives a coherent feel to it.
Damn I love the look of that
@cursive ibex of course you can uses the icons. I'm proud you like it
new version on spacedock
better looking ui
I've added a new controller for the heading using a compass style infinite slider
the main directions are buttons. You can easily turn East or North by a clic.
updated the attitude pilot, quite usefull for planes
editors turn yellow on focus
and the value is validated using Enter key pressed or loose focus
wrong values are detected and never sent to K2D2
you can select altitude in drone mode
many UI change.
I still using old Unity imgUI. and it has been quite difficult to create the slider and editor fields.
but I'm happy that the rendering is quite clean
and easy to use
FTR:
- Upgrade: K2-D2 v0.9.0 to v0.9.1 (spacedock.info, 1 002,9 KiB)
Downloading "https://spacedock.info/mod/3325/K2-D2/download/v0.9.1"
Finished downloading K2D2 v0.9.1, validating and storing to cache...
Trying to install K2D2 v0.9.1, but it's not downloaded or download is corrupted
Error during installation!
If the above message indicates a download error, please try again. Otherwise, please open an issue for us to investigate.
If you suspect a metadata problem: https://github.com/KSP-CKAN/NetKAN/issues/new/choose
If you suspect a bug in the client: https://github.com/KSP-CKAN/CKAN/issues/new/choose
you mean the file is corrupted on spacedock ??
no not yet, still using IMGUI
i cant down load on ckan file corrupted
weird, when I download from space dock directly it is good
I can reupload it just for ckan.....
@lilac parrot i've reuploaded my version, It seems to have done a mess in ckan
I made some little changes and changed the 0.9.1 version in spacedock
I could removed it and add it back ...
@wraith glen ok thank you love your mod
thanks ❤️
ok a v0.9.2 is available. I hope this correct the Ckan trouble
and I've corrected a little trouble on repeat button on the fly
work perfectly now
cooool thanks a lot @trail lily
@lilac parrot about ckan . do I need to check the ckan toggle on spacedock every each time I post an update ?
nope, unless you make changes such as adding/removing dependencies, it only needs to be done once
if you do need to update the metadata, you need to directly make a PR to the NetKAN repository
ok, thanks
and about the CRC check.
i've added a version and discovered a little bug inside.
i've then uploaded a new file on spacedock using "edit version"
I think it is the source of the crc error in ckan download
I've encountered the same issue with the template version 1.2.0.1, which was why I made the update 1.2.0.2 right on the same day
I was using the MSBuild task ZipDirectory and that had consistently produced that issue for some reason
ok, i'll try to avoid updating the mod without changing the version. thanks
What I meant to say was, the issue was caused by the ZipDirectory task not zipping the files correctly
I had to replace it with a call to PowerShell's Compress-Archive command
for my trouble the zip was correct. i've downloaded it back from spacedock and it was well formated
got a funny crash
I've added a profile drawn picture in the lift settings.
far more easy to understand.
the code is adapted from mechjeb of course. it's my first picking in mechjeb code
excellent source of UI tricks
and the basic ascent profile was in fact working quite close to what i've made. good surprise for me too
the elevation angle is just computed from current altitude. I wasn't really sure that MechJeb did something like this
what It did more accuratly is to adapt heading to current speed direction to ahev a final plane more procise. I'll try to do something like that by mirroring the current aimed direction by the wanted heading value. it could just do the stuff.
Sweet! I like this!
I'm close to release the Lift pilot v2. But anyway i've got a little noob question to the modder community.
i would like to add a GameObject (mesh+endering+script) into an AssetBundle.
no problem for material and texture but how can I embbed the script as it should all be added to the mod dll.
What is the good practice : adding the script using addComponent when the GameObject is instanciated (and setting up all public fields by hand) ? Or is there any better approach.
So the script doesn't go into the asset bundle, just build the script inside of your mod solution and drag the dll into unity
Then after you get past all the missing references
you can add it w/in unity
Thanks a lot @edgy river. When you say unity, you mean the unity editor ? Then after correcting missing ref, if I build a bundle with my prefabs it will hold the proper scripts components ?
Yep!
cool I've learn a lot !
final version of the ascent profile curve
Still many features to add to the auto ascent : final curse to AP and add a circulize node using FP.... it will be for next version
for the moment I've just build the version with 1.3.0 version ok KSP2
Looking cool!
Might there be an autostage option in there?
Hey @wraith glen , your KSP forum page formatting is a little bit off
Thanks @late bane I'll fix it. And i'll add auto stage feature.
Hey, I synched my fork and then updated it to work with KSP2 0.1.5. Seems to work fine at my end. I put in a PR for you. The only changes needed should be in swinfo and the csproj. I bumped the version 0.10.1 since it's such a minor change.
thanks bro. i take it
Awesome! Happy to help! We need our loyal little droid. It would be crazy not to have him!
i've updated the Ksp version to 1.5.0 and i've got many new bugs on Attitude. the SAS is making weird correction when the control dock is not aligned.
docking using a port not aligned with the Z vector does not work anymore.
where do you think I should post a bug for the ksp team ??
Here is the place for bug reports in the forums: https://forum.kerbalspaceprogram.com/forum/144-ksp2-bug-reports/
However I don't think you can make reports that directly reference the game's code there, you might want to speak directly with Dakota here for that
Thanks @pale meteor the bug is not about code but just behoviour of the main SAS.
anyway, I've added an updated version, thanks again @late bane
This is wonderful! Thanks! We're getting a bump in players rn with all the improvements in 0.1.5, so I'm sure they'll be grateful that K2-D2 is there to help them. I know I am!
@pale meteor i've not posted a bug because, with a brand new campain i've not met it. the bug occured using saves from previous version
I've rebuild the code yesterday. Added a resizing option. And prepared an auto staging option.
I'll try to post it this week
If you've got bugs with 0.2 ksp version please post a message. I'll quicky rebuild a version to fix it
@wraith glen I don't know if it's K2-D2 problem or Flight Planner but it seems to don't work together, screenshot by @worldly prism
Yeah even the node controller doesn’t create any node. Odd
So both flight plan and nose controller is broken
K2d2 seems to work vibe for auto lift off but not other things
Maneuver Node Controller works if you first create the node yourself, then you can edit it with MNC fine
Generally, everything that tries to create a new node fails
But editing existing ones works
So Flight Plan is currently useless, since it only creates nodes
K2-D2 works perfectly fine from my testing
No
The bug is in Node Manager
Since MNC and Flight Plan use the library to create nodes
And all three are made/maintained by schlosrat
I already offered in the IG server to take a look at fixing it and at least providing a temporary release of a fork that fixes it
But if anyone else wants to take a look at that I would absolutely not complain
Would be so lovely if you could fix the bug on fork ❤️
I had a hunch it might be in Node Manager. The good news is that’s a fairly simple mod. If you’re able to fix a fork I’ll be happy to help get it up onto Space Dock
the way we had to create node was odd . I hope the KSP2 team have corrected it. I'll have a look this evening
If it is obvious I'll propose a fix
Go for it
It doesn’t work to time warm while k2d2 is executing a node. Together with flight plan. Had a 5minute burn time and needed to wait through it. If done manually you can obviously time warp while burning but not when done by autopilot. Idk if that’s supposed to be this way.
+1
Hummm that's true K2D2 forbid the timewra^p during execution as it want to manage it by it self. i'll add a little fix to allow x2 and x4 timewarps and stop it only at the very end.
Awesome
Also can you please add gradual deceleration when doing lift autopilot
It overshoots the set AP because its at 100% throttle until kill unlike when doing manoeuvres
Like if I set 120km it will get like 121km. I know it’s not a big difference but just something for more precision
Maybe it can scale with how much time a burn needs to be. Like when interplanetary comes out or what if ur using an ion engine. 5min burn = 2x,4x speed. 10min = 8x, 16x. (Idk the warp multiplying time lol) but you get what I mean
Idk if you have seen the series called The Expance but ships there and in real life travel at insane speeds specially to be efficient between planet transfers. You accelerate a huge amount and then when ur close you will have to keep decelerating for at least like 20min if not more to get in to orbit. Like ur travelling 20k m/s and need to get down to 3k m/s. And all you have is an efficient hydrogen engine or ion. So yeah😩😅😄
yes thats a good point. I'll add an option in the Execute Node tab
And for the lift I really need more work on this pilot. I use to be lower than expected
because of the air friction. I'll tryy to be more precise
the issue is that while you're in space (or maybe only in orbit), you cannot do physical time warp at all
so even if you only allow 2x or 4x warping, the vessel might not stay pointed on the node marker
but it's probably worth testing it a bit more
basically, when you initiate any level of time warp while in space, the vessel gets stuck in that orientation until the speed is set back to 1x
isnt that how it works. I mean it will have to for interstellar
well, yeah, but it also makes for example burning prograde for 2 minutes impossible when using 2x-4x warp
they could enable it just for the high speeds
also it has a very dumb side effect
let me illustrate
without timewarp
with timewarp
but it will bite you in the ass at the end
you can have as much offset thrust as you want, and you can go straight, you just have to time warp
but yeah, I understand it's a difficult compromise between performance and usability
I just wish they kept the alt+warp key as physical time warp, like in KSP1
now it's literally impossible to initiate physical time warp in space, it just switches automatically
oh lol. I wish parts didn't disintegrate when crashed lol. Like crashing a vessel in to a station and it splits in to several debris like in Space Engineer
Anyway, I've posted a new Version of the Droid
* Rebuild with KSP v0.2
* Added a resize option using Matrix trick. It can be blurry but it's a quick solution for large screen.
* Added Autostaging tool !
The little S button in the toolbar can switch it on/off quickly.
The Stagin tab is only used for information on next stage. I'll try to add a little timer.
Will Active Next Stage when at least one tank is empty in the current stage.
Added a delay to avoid rotation during Lift pilot. 1-2 seconds are good values.
It can avoid a crash if a tank hit the vessel during staging.
AutoStage is a global feature, meaning it is active even if no K2D2 pilot is running. Use it with causion then
* Dock has been removed because of rendering issues of the "Augmented Reallity" lines
woaaa, the 0.2 version have brought back many players. really cool to see.
@wraith glen hey there, just wanted to let you know that when switching from flight view to mission control, K2-D2 starts spamming this exception:
[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
KSP.Sim.impl.VesselVehicle.AtomicSet (KSP.Sim.State.FlightCtrlStateIncremental flightControlUpdate) (at <dd6137ea2e634c0ba20d8eb5ac23d499>:0)
K2D2.KSPService.KSPVessel.SetThrottle (System.Single throttle) (at <53a60794a2614acd8d33ee90c5fd2522>:0)
K2D2.Controller.DockingAssist.set_isRunning (System.Boolean value) (at <53a60794a2614acd8d33ee90c5fd2522>:0)
K2D2.Controller.DockingAssist.onReset () (at <53a60794a2614acd8d33ee90c5fd2522>:0)
K2D2.Models.ControllerManager.onReset () (at <53a60794a2614acd8d33ee90c5fd2522>:0)
K2D2.K2D2_Plugin.ResetControllers () (at <53a60794a2614acd8d33ee90c5fd2522>:0)
K2D2.K2D2_Plugin.ValidScene () (at <53a60794a2614acd8d33ee90c5fd2522>:0)
K2D2.K2D2_Plugin.Update () (at <53a60794a2614acd8d33ee90c5fd2522>:0)
Ok thanks @lilac parrot I'll fix it
So there is no warping during burnout?
Not yet. It's on my todo
Quick question; will K2D2 automatically wait for the perfect time to do an interplanetary transfer burn, or will it jsut pick the most efficient burn time in the next orbit?
I want to set up a series of probes ready to ttransfer to the other planets, but none are currently in the right window
K2-D2 doesn't create nodes at all, as far as I know, it can only execute existing ones
yes soory it's more for FlightPlan
huh? now i'm confused; are they 2 seperarte mods that work so seamlessly together that i thought they were the one mod?
possibly 😆 Flight Plan can automatically invoke K2-D2
omfg, y'all are amazing; i legit thought flightplan and K2D2 were the Same mod
not at all 🙂 we worked together with @late bane
Flight pan is all about node creation
and K2D2 work on engines and attitude
both mods can work alone but work better together
@kindred furnace If you want to set up options for K2D2 using the TechTree we can discuss it here
From my idea I will add another option class taht can enable feature depending on the techtree state
in sandbox all will be available but in exploration mode I can add a set of "enabled options". the UI tab will be grayed or hidden if not set
I can add it to next K2D2 version with a simple api like : setOptionnalFeature(string feature_name, boolean enabled)
that sounds good. if its a method that I can use or a list that I add to. ether will work.
thats perfect.
I'll try to add it for next version. but I couldn't do it until mid January i think
in the tech tree editor it will be a text list box where you can add
classname.methord(),
anotherclassname.methord()
it's a little bit fuzzy for me for the moment
but I'm confident we will find a simple way to do it
that timeline is perfect.
excellent, let's go then
v0.11.2
- Correction of the Staging tool : working with asparagus models. (I hope)
- Docking pilot is back without the A.R
- Time Warp is now allowed during node burn execution.
K2D2 is just following the same rules as "Warp Before Node execution". A Max time warp is computed and applied. - fixed an issue when switching to Space Center (errors in logs, thanks to @munix)
- Warp Tabs has been removed (needed to be fixed)
I've tried to fix all the little issue and trouble found here or on the forum. removing the warp limit during node execution is soooooo confortable
thanks @gloomy bobcat for the idea
As I Mainly code K2D2 I forgot to play and can't see this kind of useless limitations
Happy new year !!!
How si the attitude control supposed to work, it seems to want to shut off my engines
Hummm weird. It just try to point to the wanted direction. There should not be any engine control.... But a bug could occurs of course
@lilac parrot the error in the docking when going back to Space center is still here. I'll have a further look.
And I was wondering if there was a way to have K2-D2 part of the "feature Mods" on spacedock with FlightPlan as they works together ?
I agree that K2-D2 belongs on the featured list. Just ask @pliant zodiac and he can make that happen.
Or me
Should I defeature MNC to make room for K2-D2, as its a dependency for both K2-D2/FP
Ohhh brain failed
but you could probably still do that
I was going to say that Flight Plan is probably the more popular of MNC and FP, but to my surprise MNC is
Yeah, then I'll defeature MNC as its near the top of popular
yeah
and put K2-D2 there
can you manually choose the order they're featured in? because if so, you could just move MNC off to the full page, behind the 6 first ones
I can't it's sorted by the most recent to be featured
It's whatever
unless we want to make our own mod website
one of these days I'll just PR a full front-end redesign

and you do the same for CKAN
lmao
Heh, both projects very much welcome contributions, I can walk you through the dev setup for either (but probably someplace other than this channel)
@wraith glen I've seen quite a few people report the autostaging in K2-D2 as a bug, probably because it's not very well described in the main forum thread, and it seems like it's enabled by default, even if you've never opened K2-D2. Would you consider disabling it by default, so that it doesn't confuse the people who install the mod?
Thanks a lot for the adding on the feature mods !!!! 🤟🤟🤟
Very good idea @munix. I'll do it asap
I found that during the lift, if the engine is not in the same stage as the stage separator, the engine is not activated and needs to be done manually....
That would be the normal and expected behavior. If you were to fly such a craft manually, you'd need to stage twice in such a case as the first staging activates the separator and the second one activates the engine.
I always like to do that way since it gives some time between the separation and the engine start. Not an issue for me, but just consider that the VAB sets normally the separator and the engines in different stages, so by default will be in different ones and a player will be unaware of that. Mechjeb used to stage those without an issue btw.
yes there are still some many issues in autostaging.
I'm not sure to have the good rule to trigger it. For the moment it is only : if a tank is empty call the staging. But it seems thats thoses tanks needs to be attached to engines to be detected. I'd have to change it.
@sturdy token could you give me a vessel file from KSP2.
it should be located in
C:\Users\[YOUR_NAME]\AppData\LocalLow\Intercept Games\Kerbal Space Program 2\Saves\SinglePlayer\[Campaing Name]\Workspaces
Anyways I've well progressed this evening .
@kindred furnace I've added a fullAPI to disable any pilot of K2D2
public bool isPilotEnabled(string pilotName)
public void EnableAllPilots(bool enabled)
public void EnablePilot(string pilotName, bool enabled)
public List<string> GetPilotsNames()
Here are the functions added to the plugin interface
@late bane I've finally added a link to Flight Plan to call the Circulirize function !!
It is called at the end of Lift Pilot.
The Lift pilot has been improved with fine adjust of AP, auto warp and adding Circle Node at the very end.
I still need some more adjustement to finalize this
Awesome! This will be a very popular feature!
the new version is posted !!!!!
@late bane I've met many issues adding the circulirize node. it's quite hazardous to reproduce, and depends on the ascent profile i used.
very veritcal profiles gives poor result.
either the node is weird but created, either i've errors in console....
but when it works it is a real pleasure to lift off
i'll try to post savegames files to reproduce it easily
thanks again for adding the api in FlightPlan
That's so odd. When I use the K2D2 Lift capability I've not once had an issue with a circularization node from FP. I wait till it's coasting to the apogee, make the node in FP and have it tell K2D2 to fly it. No issues. I'm definitely curious what might be going on here that would create issues. Could it be the rocket? Could it be the K2D2 Lift params? I believe I'm flying with pretty close to stock K2D2 lift params.
I'm not sure of what is happening. And it's happens only with bad ascent profile when the orbit is quite sharp. I'll send save games when it reproduce it clearly
When the ascent orbit is quite long it works perfectly.
Well, that makes me think this could relate to the problem I've seen in the low thrust scenarios. With a bad ascent profile that is very sharp you will have a much longer burn to circularize as you don't have nearly what you need for the horizontal component of velocity. Also, since the very sharp trajectory has such a sharp bend in it for the prograde vector then that may be also part of the problem. The burn vector is in body coordinates, but needs to start well before Ap and continue on well past Ap. See discussion in the FP channel.
Speaking of a bad ascent profile. I found the default settings were overly agressive in turning for a particular craft, so I reverted back to launch and got stuck with this
Here, my second stage was burning (should be able to put me in orbit but wasn't even close as I was at 51K ft with an AP of like 53k, so I reverted to launch to try some different settings. Apparently, K2D2 was stuck in some staging thing, and now here I am back at the pad and Lift is saying Staging in progress.
Closeing K2D2 and reopening it doesn't help.
Reverting to launch again (while still at the pad) doesn't help.
Eventually the countdown will conclude on K2D2's staging, but will happen then I'm not sure.
Thanks! I can imagine that when working out the best profile for a particular craft you might want to revert to launch a few times to try things out.
In this case, I may end up reverting to the VAB to re-do the first and second stages...
Yes that's the idea...
Hey @wraith glen, I've been using the new K2D2 capability to call FP to circularize at the Ap after Lift is done with its part. I've noticed a couple of things. First, when I do this K2D2 is pausing my game (perhaps that's be design and intended). So I go to the Node tab, tell it to circularize at Ap and click Run, then I need to unpause the game for it to actually run. Second, sometimes it starts the burn then stops it well before it's completed with a note stating "No Maneuver node in the future". This makes it so I have to fly the remainder of the node manually, and I generally get much poorer results like this
Here you can see there is a node (though its not in the future) and my manual burn has taken me from a 100 km Ap - 450 km Pe to a 215 km Ap, 80km Pe (I'm a crappy pilot apparently)
Right not excellent but we progress...
First : The pause after adjusting AP is by design and can be toggled off in settings. As I've got unexpected node sometimes I prefered to pause the ascent to be ready to use Flight Plan + MNC to finally adjust the orbit.
Sometime FlightPan create a node that is weird. I suspect a bug in KSP. the direction is good and the burn duration and dv is well computed. but the computed result in the map view is wrong. Like if I haven't enought Fuel. In this case, pause and unpause can correct the situation and gives better result in a second or two later.
The Execute Node in the Lift tab will unpause the game. I'll add it to the Main Node execution soon. And perhaps add an option to pause after node execution gives can some time to add a final corrections node.
For your trouble with "No Maneuver Node in the future" it is tricky. I've met it sometime but was not able to reproduce it.
I get node this way :
public ManeuverNodeData GetNextManeuveurNode()
{
var maneuvers = Game.SpaceSimulation?.Maneuvers;
if (maneuvers == null) return null;
var current_vehicle = VesselVehicle;
if (current_vehicle == null) return null;
var activeNodes = maneuvers.GetNodesForVessel(current_vehicle.Guid);
ManeuverNodeData next_node = (activeNodes.Count() > 0) ? activeNodes[0] : null;
return next_node;
}
and sometime the returned node have weird value. It can be corrected by going to map view. but it's not fully working anytime.
My only way to fix it is cleraly to remove the Node and retry it.
it also can be that the PlanSolver can not be loaded.
anyway I changed a little bit the way node are get from KSP. we will see if you meet the bug again
I've also made a correction for the autostaging bug
v0.12.1
- Fix in Node Tab. in rare case the Node was not detected properly.
- Fixed an issue with staging when loading a scene during a stage change.
- Node execution
- The game is Unpaused on Start
- added a button to pause the game just after execution of a node.
- Lift : added a heading correction. it will try to adapt the heading depending on the current speed direction.
The final orbit should be in the proper plane !
little update in order to correct some of the issues you've met.
unfortunately i've also met a weird node situation.... but couldn't reproduce in debug...
so your there is still a trouble @late bane I'll try to track it
the new lift option is quite cool to use
coool the precision of my first try in exploration mode is quite good.
@late bane Flight Plan is really doing a good job when the starting orbit is quite flat.
Awesome! I'm updating to 0.12.1 now
Huuuummm the heading correction is not as good as that.. it works fine for east or west but bad on north and south. Cause the speed is taken from surface and not orbit
It will be an easy fix
This would be really awesome! What a nice way to improve the already great landing capability. There are times when I've roughed in my descent in map view to get me into a region (by using @cursive ibex's Orbital Survey in overlay mode), then I switch to flight view and see that the part of the region I'm heading for is really steeply sloped or otherwise not so good. If K2D2 had a visual indicator of where it believes you're likely to land and N/S/E/W buttons you could activate to nudge your landing point this would be fantastic for dodging boulders or slopes.
Even without a visual indicator of the predicted landing point I think N/S/E/W buttons would be useful as you can tell about where youre' likely to set down and could guestimate how much nudge you need.
If the craft has RCS available, it would be nice to have a toggle to use that so that the main vessel attitude and descent engine can keep things going safely while RCS provides the nudge to adjust the descent without needint to point the craft or gimbal the engine.
It's exactly what I was thinking about.... But it won't be easy to make.
I think the lift off pilot is quite good now. My next step will be about landing. I've many many things to improve.
I'll try to add markers on the final touch down position. But it will need to find a way to properly add points on map view and main view. If anyone have a clue on how to do that, it would be welcome
It just so happens that Cheese may be working on something that can help - an API in SpaceWarp to add waypoints which are visible in both map and flight view! If you'd rather not use a waypoint, then KS2 has the capability to paint markers for desired and current estimated landing points just like those MJ had. In fact, KS2 has been doing this for quite some time - many months! Probably the easier way would be to let Cheese add the waypoint tools to SW, then have K2D2 call those. Read more here: #🔴space-warp message
That said, I am very fond of the old MJ style landing markers... Adapting that form KS2 is probably a real chore though, but all the code is OS and available on GH.
excellent point the marker stuff !!!!! I'll use it for sure.
I'm getting this weird situation and I don't know why. I can create a node in FP, but K2D2 will not fly it.
Prior to this I was asking FP to make a new Ap at 500 with a burn time option of at apoapsis. This was giving me a 0.0 m/s node (which I think it shouldn't have done). Now I'm trying the same thing only with the burn time option being at periapsis, and FP gives me a 248 m/s node, but K2D2 still thinks there's a 0.0 m/s node and doesn't execute anything for me.
I've tried warping past the current Ap point (where the old node was) and that didn't solve it. I've tried switching to other vessels and then comming back to this one. I've tried save and reload. None of these have gotten K2D2 to work for me on this vessel right now.
Plenty of gas in the tank, and the node looks like it's good.
Also, the maneuver seems to be wacky. Look at where it's got me pointed!
This is basically right on top of the node
What's up with this? Clicking run makes the dV go to zero?
And something is definitely wacky as it's not rotating my craft to point properly, nor is it warping to the node.
Here I've done a manual burn to raise my Ap to 500-ish and am trying to circularize at that new Ap.
Start time is wacky. MNC looks like it's got the truth
thanks for trying to reproduce it. I'll try to re-writte from scratch the way I get the node to execute... it will perhaps fix something
if you've got a savegame taht reproduce it it would be of great help
I'll look for one and send it along
I think something must have been wonky in my game as I'm now unable to reproduce it.
damnit 🙂
it has always been the same for me. I reproduce it quite often but always when playing not when debugging the mod
I think i've got a clue on what to fix....
good news ! I've found the bug and it was fully from K2D2 Code.
I've posted a little update. I hope it will correct the Node Execution.
v0.12.2 - Small fixes update :
- Fix : Corrected a weird behavior in Node Execute Pilot when deleting a node during burn.
- Node ex : corrected the pause button UI.
- Ctrl-O key shortcut will execute your next Node
As @lilac parrot has suggested for my mods, you might want to create a mod release thread under https://discord.com/channels/1078696971088433153/1168292144507793488 so that update notices arn't lost in the discussion thread.
you're right.
Hello, you motivated quite positvely for starting a port to UITK.... but I'm a big lost on where to start.
I've started reading UITK pages on the unity official web site
I've downloaded of course UITK source but i'm not sure It will be useful.
perhaps I should also adapt current workspace to @lilac parrot Mod template
the MNC is a good example.... perhaps. But I have surely missed something...
I think the first step is to create the “new” UI as a unity project. When I did that my objective was to make it as similar visually to what I had before. Once you have that you’ll be able to build the asset bundle for it and then there is a coding part of the task where you adapt what you’ve had before to use the new UI asset bundle. Moving to the new template will surely help with this, but I think where I’d start is just to make the UI in unity
The easiest way to start would definitely be a new project with SpaceWarp.Template
The "General project with UI" template has a Unity project with an example window all ready
right you're right. the template is an excellent starting point.
what a huge work @lilac parrot you made there....
if you need help with anything, let me know!
I've used the template to create a new workspace with the UI Sample
the build / deplay and run works perfectly. I won't need all my batches that does the same work
I've added some vscode tasks. I'll propose it to your template as a pull request once I'm sure of the best syntax for it.
I met a bug in the Template .bat if I use a - in the mod name
- are replaced by _ but not in every place.
I'm not sure but the created folders had some - and the link in workspace had _
oh yeah dashes are not allowed in project/assembly names
since the project name is also used for names of classes and some variables
yes that's it and it's a good rule. it could be shown in the prompt (no dashed allowed)
and those cannot contain dashes in C#
good idea
for the rest I've build the mod. it is detected in spacewarp !
but I've had no button in the appbar buttons list
in spaceview, map and vab...
i'm not debugged it yet
it probably didn't get that far because of an exception
no exception at all
so the window shows up in the main menu?
no uitk window for the moment. i'll debug it this evening and tell you if there need a correction
did you build the bundle in Unity first?
..... hummm not 🙂
that's the issue then
ok that's it
and that would definitely cause an exception that prevents the buttons from being added
because the window is created in the same method
before the buttons
I didn't see an exception but it was late and I could have missed something
Yes I saw it but forget it immedialy 🙂
the github action seems to be really cool. great job
i'll try it deeply
Glad you like it!
I've got another question :
- I need to create some new controls (the compass for instance). I need to create a new class derivated from VisualElement ?
If I create it from unity the code will not be available through the asset bundle (asset bundle does nto have code if my memory is fine)
I want to test it in the unity editor before using it in my mod. It would be simplier than testing it in KSP
actually it will be, that's why there are two nested YourProject.Unity folders
any code you add to the Runtime folder in the Unity project will also be compiled into your C# project
ok !!! that's really great
to test ImgUI component I've had another project not integrated in k2d2
it was quite difficult to maintains
very good point !
yeah, the main reason why I did it like this was actually to create custom controls
so I'm glad to see someone finally use it
coooool
i'll come with new question once i've digged a little bit more.
perhaps my new control could be added one day in UITK for KSP2
if useful
here is an example on how to create a custom control with the Vector API: https://docs.unity3d.com/Manual/UIE-radial-progress-use-vector-api.html
I think it will be useful
yes quite, and it shows the full power of Uitk. there are many thing I would have deeply struggled to write using imgui
it opens many new doors .....
🤩
Hey, I've got a feature request for either K2D2 or Flight Plan, but I think it would be K2D2. When I have a really big burn, especially with a vessel that has some balancing problems, K2D2 doesn't execute the burn correctly. That's more than understandable, because the vessel is having trouble staying at the maneuver spot. What I would like is when K2D2 finishes the burn the best it can without changing the maneuver direction, it knows the delta v vector that it wasn't able to hit, correct? I'd like it to calculate a new maneuver direction that would enable it to finish the burn.
It could do it automatically, but I'd be happy to just have some kind of recalculate burn that would set a new maneuver direction and let me execute the remainder of the burn.
How hard would this be to implement? It would be a huge quality of life increase as I wouldn't have to recalculate another burn by hand.
BTW -- I love this mod! I personally like creating my maneuver nodes, I just don't like executing them! This mod is perfect for that!❤️
Are you saying the vessel is having trouble staying pointed? You might want to check the alignement of the center of thrust in the VAB. There are situations when that can get borked up - which is a game bug unfortunately.
Yeah, I try to keep my ships as balanced as possible, but it seems even when I don't see a visible difference between thrust and center of gravity it still can have a bit of drift.
it's not really noticeable for small burns but big ships with long burns can be quite a bit
when this happens, a significant amount of the burn (maybe 5%) is left unburned.
I asumme that is because K2D2 has calculated that more thrust in the marked direction of would not decrease the needed delta v, because it is probably perpendicular to the difference at that point
so in an imperfect burn execution (which wouldn't be K2D2's fault) you need to adapt the remaining burn direction.
That would enable K2D2 to execute the burn almost perfectly in imperfect conditions... the only error would be the time difference from the burn time, which in my use cases would not cause problems
The game bug I've observed produces a very visible difference when it does take effect - nothing subtle about it at all. If you're checking the center of thrust, CG in the VAB and they look aligned then this is not the source of the problem I think
The place I am really hitting this is when doing transfers that I set up manually using maneuver node controller.
I don't think this is what is causing my problem. It's subtle. (I've seen what you're talking about)
I suspect this is not the case, but @wraith glen would know for sure. I suspect that K2D2 is operating on a burn timer and the assumption that the vessel's pointing can and will be controlled effectively.
So when the burn has been executed and shows maybe 5% left, is there any way to change the maneuver direction so that it shows a new vector direction for the remainder? Let's step back from K2D2 and just think generally.
I'd like a way to execute the remainder. Could a mod do that?
The burn amount left in the progress bar of the burn is showing the magnitude of the difference, but it's really a vector. I want a pointer to the direction of that vector. If I had that I could complete the burn (even though it would be a little late)
Since the game is showing the magnitude, I bet it has the vector under the covers.
Yes, a mod can do what you're asking. As an example, I think MJ does (functionally) something like this but better. I think it's looking at the accumulated dV the burn ahs delivered and adjusting both the pointing and the throttle as well as the cutoff time in an attempt to zero out the burn (difference between what you asked for and what has happened).
So, one way to solve problems like this would perhaps be a node execution autopilot upgrade in K2D2. Another would be some sort of new compensating node (a course correction node) made in FP. As it happens, FP has a course correction capability - it just works really poorly and isn't really designed to work on this problem, but rather to take whatever initial conditions exist when you call it and try to give you a node that would get you the result you want.
Yes, I agree. I would be very happy with either of these solutions. BTW thanks so much for FP!!!!!
or might it be in maneuver node controller, that one is yours too, right? These three mods seem very interrelated... 🙂
Probably FP rather than MNC
I think your ask, and the dialog here, is good - there are possible solutions in either K2D2, FP, or maybe both - probably not MNC. I know @wraith glen is busy with a big overhaul to port K2D2 into UITK and the latest mod template. That will make other things easier in the long run, and this may be already on his list for things to do - I would not be surprised.
@urban kestrel I've met such trouble in various cases. So I'm know that there are still some situation where K2D2 could do better
Currently K2D2 checks the difference between wanted direction and current orbit. It use vectors of course and stops when the two vectors are in opposite direction. I'm not using a timer @late bane as it would imply that I should do a full burn the whole time. You can see that the computed timer always stops before K2D2 finished the burn.
@urban kestrel could you send me a savegame file of the situation before the burn ? It would help me a lot
By the way. Uitk port will take some time. And next release will all be about that. I don't want to remove a feature. So I'll need to recreate new UI components. But there are excellent exemple there
The MNC update have excellent clues on repeat buttons and foldouts. Thanks a lot @late bane and @lilac parrot great job
Do you actively change the direction of the burn to compensate for mistakes? I am NOT saying that there's a bug in K2D2 if you are not using an adaptive burn direction but just trying to hit the maneuver direction marked in the compass. In the situations I have, the SAS isn't able to keep the burn direction right on target. It's close but tends to oscillate a bit and seems to skew in a particular direction. The skew is subtle with SAS spending time on either side of the target, but the skew definitely affects the burn over time.
If you are actually already trying to do adaptive burn directions, my save game might be useful to you but it also includes a so-far unpublished patch-only mod by me which increases ISP values and total thrust for certain engines. My mod also increases reaction wheel strength for some parts. Could these be causing problems for K2D2?
Do you think I should try to reproduce the issue without my mod active? I could probably do so, and I'd be happy to try if you confirm you're already using an adaptive direction for the burn.
If you're not, then I think there's an opportunity here. You and schlosrat can decide which of the possible solutions he described above might be best. One of them involved a K2D2 possible change, the other to FP. He seemed to be receptive to putting it in his but was looking for your opinion. I think we only need one of the solutions, and would be very grateful for either one.
Thanks for K2D2 BTW, I use it all the time!
If you decide you want to put this in K2D2 I certainly don't mind waiting for it. I understand there are higher priorities like the Uitk port
I'm not trying to fix this K2D2 loss of precision for the moment but It's surely a thing that I'll try to enhance in a way later. I could compute the error dv vector after a first burn phase and try then to correct with a second one using this data. It's one of my future plan but I not sure it will do a good job. but it worst a try.
sounds great! Thank you! But do you think this should be in K2D2 automatically or should the user see the burn and then need to request the update vector? That might even be a better user experience because they would get feedback that their vessel wasn't capable of doing the burn and could see the updated compensation. I wonder if this might be a better FP thing at first and then move it into K2D2 later? Maybe FP could even provide the api interface to K2D2 to calculate the updated maneuver.
🤔 I'm not sure of where the feature could be best placed. I'll sure set the final second burn as an option in the UI for example if the error dv magnitude is greater than a value. and you're right it must be an option triggered by the player. not fully automatic.
I finally think that this option have a better place in K2D2 because the droid can more easilly compute the error vector.
@lilac parrot I've got a first question for UITK :
What should be the best way to use the same style between our differents mods ? I see that MNC and FlightPlan have their own uss file. I can do the same for K2D2 and merging this kind of files seems to be quite simple as pure css like text files.
but there can be something I'm missing there.
I think you could borrow the css file from either one - though they're not identical. It would be a jumping off point you could tailor from I think.
How about making a new GitHub repository with basically just a common theme style sheet, and then making it a submodule of all three of you two's mods? That way, the styles could be modified in one place based on an agreement of you two, while not introducing yet another library for users to install
(the better one to start off with is definitely Maneuver Node Controller)
I like idea much, I'll try to start my K2D2 port on that idea, taking all stuff I need from MNC and putting it in the shared repo
MNC and then FlightPlan could use it later.
Yeah, munix worked on FP first, then did MNC, and so the update to the MNC UI is the most recent and best. I think the plan may be to go back and take another shot at FP to fold in improvements from what was he did with MNC.
yeah, I do want to take a look at redoing the FP styles at some point
but there's so much in it that when I opened it to try and do that, I gave up in a few minutes, realizing how long it will take
😅
I can believe that 🙂
I need to continue experimenting a little bit. I'm in first half of my learning curve on uitk. I'll propose a first repo whenever i'm ready. I'll take all from MNC as a reference.
The UITK seems to be quite powerful, and It worth the port definitvely any new UI will be easier to make
but I've got another noob question :
do you know why there are some difference in the Unity Editor between the game tab and the UI Builder ?
there are differences in margin...
you just need to resize the canvas (the dark gray border) in the UI Builder
it's too small by default so it squishes the elements together
you can also do it by clicking on the "MNC_UI.uxml*" label at the top and changing the size numbers in the inspector
you can make it as big as you want, it's just used in the builder, not in the game or anywhere else
that's excellent
I've got another question @lilac parrot ... about the nuget stuff.
do I need to manually change the dependencies version in the csproj ?
or is there a simple way to update them all ?
You can put the following into a nuget.config file in the root folder of your solution
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="SpaceWarp NuGet repository" value="https://nuget.spacewarp.org/v3/index.json" />
</packageSources>
</configuration>
I think that should allow you to use the package manager in VS more easily with the SpaceWarp NuGet server
then you can update all packages simply like this
I will add the nuget.config file in the next template release
I honestly just haven't been using the package manager at all, I'm used to just changing the package versions by hand in the .csproj file
but this will be very useful for many people
ah right, sorry, forgot you use VS Code
but nuget update does not do anything
NuGet Command Line 6.8.0.122
Usage: dotnet nuget update [options] [command]
Options:
-h|--help Show help information
Commands:
client-cert Met à jour la configuration de certificat client qui correspond au nom de source de package indiqué.
source Mettez à jour une source NuGet.
Use "update [command] --help" for more information about a command.
sorry it's all in mixed english/ french
ok 🙂
seems like the command line tools just don't support it
dotnet list package
give me good clues
that's enough for me to get the proper version
theoretically you can use wildcard versions, like for example UitkForKsp2 2.*
but that will automatically update the packages
whenever you restore
yes and it will be my solution, using x.y.* versions
thanks for your help, I'm really less afraid of making this port now
one thing to keep in mind is that you will need to also update the dependency versions in swinfo.json when they change in the project
ok I saw it in MNC
{
"id": "UitkForKsp2",
"version": {
"min": "2.4.2",
"max": "*"
}
},
it's wasn't not include in the template. It is read by BespinEx ? and CKAN ?
I don't specifically include a dependency on UitkForKsp2 by default because SpaceWarp already depends on it
but it's a good idea to add it for UI projects because they could be using a newer version than SpaceWarp does
Hello, I'm still in deep reflection on how I could do the port.
- I've adapted the workspace to fit the @munix template : OK
- I've read maaaaany docs on uitk on unity web manual
and I've got two directions :
- either using a pure code approach like we have to do in IMGUI. https://docs.unity3d.com/Manual/UIE-IMGUI-migration.html
- either use the UI Builder to create pages for each pilot
this second approach have the avantage to have direct UI preview in the UNITY editor. But It will require some round trip between visual code and Unity.
I've also a long list of new components to create.
- Tabs (there are no real tabs in the UITK)
- Editor Field : I need to have editor that validate their content only when enter is pressed. if the value is taken when number are pressed this can affect the pilot with wrong values. the yellow color means that the value is not currently used.
- The compass : looping values in 180° (south) : but is can be replaced by a simple slider in the first version
- the profile for lift... the vector api will be a great help for that
I recommend the second approach, that's what I did for FP and the tabs work quite nicely. Essentially, each tab is a VisualElement containg the objects that need to be displayed in that tab, and since the VisualElement is named and is the parent, it can be switched on and off via it's Display property.
The same is true with the tab buttons I have. They are all children of the TabBar VisualElement, and the code they trigger controls which tab is displayed, as well as the user's situation controlling which buttons are available.
So, there is code (all in FpUiController.cs) that takes care of setting up and managing the UI. In that sense, it's a Code + UI Builder approach.
While starting with the styles in MNC may be better, exploring how the FP UI works could perhaps show examples of how to have a K2D2 UI that gives the user different tabs with different objects.
There will still be the challenge of the custom objects you need, but most of the structure will be easy I think.
THANKS @late bane
The first approach is closer to current UI but will sure be more difficlut to test and maintains.
but it will be easier to port from current code
the UIBuilder approach is a complete new way of coding, requires many chnages in the code structure. But will be easier for anyone to adds some changes .
I needed your advice before going further. i'll try then this approach first
if I met man y difficulties I 'll switch to the pure codeing approach
I would suggest, if the tabs are really different
and you want a custom controller to keep them separated
to create an UXML for each tab
and then switch them at runtime
you can load a "piece" of the UI the same way you load the window main UXML
the other approach is to just have the contents of all tabs in separate VisualElements that you will simply show or hide based on which tab "button" was pressed
I do plan to add a tab view element to UITK 3, but with how much work I'll have in the foreseeable future in addition to school, I can't make any promises about when that will come
It's pretty much the same yes, it depends more on how much "modular" you want to work
The only thing I'd suggest, is keeping the C# Controllers separated, so you don't have to keep everything in one C# file
like
_myTabOne = _root.Q<VisualElement>("tab-one-content");
_myTabOneController = new TabOneController(_myTabOne);
_myTabOne.userData = _myTabOneController;
I'd probably still go with a single C# component per UI Document, but you can structure it so that each of the tabs will be taken care of by a different class
that's another way to achieve it for sure, though I would be more for using userData to attach models related to the views, and stuff like that
but then that's only really relevant if you're going for a design pattern like MVVM
I still don't have a good idea on how to use design patterns with UI Toolkit, so my examples are pretty much from my limited experience
never really got the binding part, so it's a manual refresh function
yeah, that's something I definitely want to explore in UITK 3, two-way binding is really missing here
More like an UIToolkit than UITK for KSP2 problem I want to say anyway 😄
well, specifically Unity 2022 problem, since runtime binding is in 2023 I'm pretty sure
gotcha
so you were thinking something like custom struct with boxed values to trigger updates?
in UITK3 I mean
I'm honestly not sure at all yet
I've been looking at some implementations
and most of them sucked, to be completely honest
lmao
haha
the KSP2 logic used internally, the PropertyViewHandle, seemed a bit overwhelming
I've started a little c# Class for mainWindow and another for a custom tab... The K2D2 is quite specific because it should show cactive tab and running pilot. it holds 2 informations. It won't be hard to make but to adapt my brain to UITK take a little bit of time.
I've struggled for example on uss...
I'm using Button for my "Tab" button and I can't really succeed in changing the background color. in the UIBuilder I can see that the style of the button is affected several time. if I add styles to the element, some of their settings can affect the rendering but not all like the background color.
it could be because there are other classes with the same specificity (you can learn more about it here https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity)
it should help if you make the selector stronger, for example: .unity-button.tab.currentlySelectedTab
which means that all three classes have to be applied at the same time
right thanks again. it worth a try
that's it my color has changed
it is quite more complex to write but this is how to do it
glad that worked!
I can imagine it's a difficult transition from just writing the UI in C# for someone who isn't a web developer
I have to admit for me, UXML and USS are way easier than C# UI, since I am a web dev
and this is basically like working with HTML and CSS
yes it is a bit. I'm not used to css working on front end not really often.
But it worth a try.
it's a bit of a learning curve, but I think the options that this opens up are amazing
yes I can see that. but i'm at the very beginning of readapting it to k2d2. I've so much to rebuild....
But the result will be really more easy to enhance ...
my offer still stands - if you ever want me to help out with it, I definitely will
thanks a lot. I know you're really busy.
But I'm not completly lost for the moment, and answering my question here is so helpful. I can't ask for more in fact.
I'll continue rebuilding the whole Ui brick by brick and ask for help like it.
alright, I'm more than happy to answer any questions 🙂
While you're at it, would you consider moving the Hide Profile button on the Lift tab to the same position as the Show Profile button, or simply make it toggle between the two options? That way one could more easily take a quick peek at the profile.
yes this is a good idea.
In fact I Won't reproduce the way ui is composed with imgUI
For now on I'm only at the very start of my port. I've created the tab code and I'm on the Editor Fields.
Progress!
small progress but progress 🙂
well in fact I'm really struggling with UITK. USS is a kind of hell for me
I'm simply trying to make my tab button with a label and an icon
the icon shoudl indicate that the pilot is running
i'm trying to align it at the top right corner of the button
the button should fit it's text content size
If I add a Visual Element to the button content and set it's position to absolute. the button won't fit it's content size
I could manually set it's width but it's not satisfying at all
how can I adapt a Visual Eleent size to it's child content ??
With absolute positioning I don't think it's possible with simple USS, do you need the absolute position?
But by setting the element's flex-grow you might be able to make it take as much space as it can
https://flexboxfroggy.com/ pretty fun little thing to learn the ins & outs of flexbox positioning
For more "serious" stuff: https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox
(USS is not exactly CSS but it's close enough for flexbox stuff)
one thing I hate they didn't add is gap
like why
I hate having to add margins to elements in a flexbox
if you share a screen I'd be glad to help
if you want obviously
I think I did find a good way to do it. I changed how elements hierarchy and I've got a clue on how to get further.
thanks for the help.
Trying not to distract from the joys of wrestling with Unity 😃 , but could you put this on the wishlist for K2-D2?
An option to have the autostaging stop after a user-selectable stage number.
Use case: For instance when I don't want to risk my methalox boosters being decoupled while still under power due to some fumes left in the tank. 🙂
Thanks!
Hi, I remember in older versions of K2D2 that I could throttle down during launch (lift), it allowed me to keep drag in check for high TWR moments. It's not a biggy, as I can trottle using the part-manager, but a welcome return if possible.
I think there is a max thrust control on K2D2 launch tab. You can change that mid launch. Does that do what you want? That's what I do in similar situations
Yes there is a max thrust controler during the lift it just change the main engine thrust factor....
I'll change it to max TWR value. But I'm full on UITK for the moment. the max stage is needed.... and the asparagus autostage without engine is not working neither for the moment.
about UITK and uss styles I'm still struggling with sizes and I need a little more help.
Of course, what do you need?
And as usual I've found what was wrong....
as i'm starting with uss style i'm always wondering why my Element does have this size.
Is it because of the parent flex attribute
is is because of one of the uss affected on it. i'm still not sure of what have influence on what I see and this mke my progress quite difficult
I'm encountered alos many times where the UI Builder just reset my changes when I press play in the editor or Ctrl + S.... I just loose a lot of time doing again and again the same thing....
You can set elements to shrink 0 and grow 0, and only set it to 1 when you want an element to resize automatically
This sounds definitely terrible 😢
I usually just see the preview in the Ui Builder (with the Preview button), since I want to double check it in game anyway
the shrink and grow stuff is quite counter intuitive for me.
But it will enter my brain
🙂
I hope
i've got a question for @lilac parrot
in MNC uss file there are definition like that :
I've not see the -- syntax anywhere it's like aliases ?
they are variables
I use them there so that I only have to define each color once, and then if for example I wanted to change the color of all "invalid" labels, I only need to change the variable
how could you setup for instance fonts like that ?
you define in UIBuilder and then copy paste as a variable ?
yes, it seems like there isn't a way to create them directly in the builder:
so the best way to do it is like you said, set the Font Asset property on any selector, and then copy the value directly from the USS text and make it a variable
and then you can assign them in the editor like this
I'm making some progress. I have complete a bunch of components.
many options for each component
option are adapted to my current K2D2 needs.
next step are new generic tabs. I'm not satisfied of my current implementation.
Then Editor Fields, Foldout. Im close a a full set of controls
but there is still much work to do
Awsome progress! Can't wait to see it as it comes together! How are you likeing UITK now? Is it getting easier?
Great job!
The learning curve is harder than expected. I still learn many details everyday. I've struggled with attributes of components yesterday. It is properly saved id we declare a uxmltraits and if the main class have geteer setters with a proper name. Ex 'Min Max Label' field is declared like that in the traits 'min-max-label' and Must be declared as minMaxLabel in the class.... Quite tricky to understand
This creating components phase is quite long but I have made the same thing on imgui. And I was already well trained for that.
But the very good news is that yes uitk is complex, but it have maaaaany advantages. Anything can be tested in uibuilder.
It use simples classes to be manipulated. Very cool thing
It can be created live in runtime and in uxml file.
The event system is accurate
The USS styling is excellent. Once you understand well it
So I'm beginning to like it very much. But last week I was more disappointed 😞😔
added progress bar, Fields and exclusive foldout (important for settings pages)
I'm close to have my full set of tools. but the tabs would need to be reworked once more.
the third time !!! 😐
I also need to clean up and organize uss files.
I know it is compatible, but does K2-D2 automatically warp to points made in maneuver controller (second, third, fourth, etc)? I haven’t seen it do that as of yet so idk
AFAIK, it doesn't do an automatic warp to nodes - but I believe you may be able to command it to warp to the next node. I'd have to check.
yes it can be @signal shale
why did it appear ?
It's possibly the docking helpers that I had not completly been removed
you can reset the settings be removing the K2D2 folder and reinstalling sorry for that
when i restarted the game it was gone ,, didnt need to do that
ok good thing, You can reset the K2D2 settings by removing the setting.json file in the root of k2D2 folder
Is there any documentation on how to use the Drone mode, or what it's actually supposed to do?
I was hoping for some kind of autopilot for atmospheric plane flight, i.e. holding heading and altitude, but that doesn't seem to be possible right now?
I also have a question about the Lift mode. What exactly does the 90 degree altitude setting do?
Ohh is it how high the launcher stays perfectly upright before starting the turn?
Yeah no I'm dumb. It's so obvious now lol
No sorry there is no good documentation for the moment.
The drone has been writtent for fun. using only infinite fuel mode. I was trying to create a new way to navigate on planet surface. As you can see you can
- setup altitude directly or a vertical speed
- the main trust is computed in order to fit this command. there can be oscillation trouble (the vessel going up ans down depending on Drone settings. There not a good adaptation on the vessel trust capacities. and The settings are here to adapt the behaviour of the ship depending on weight and twr factors. A real good pilot should compute is by itself.
when you move, pointing in a direction, Vertical speed is maintained, the main trust is adapted to fit the trust direction and continue to float. the Horizontal speed is then deeply affected. you can then play you the up direction to fly in the direction you want.
The Kill Speed mode is used to stop the horizontal speed. it will try to point in a good direction to remove the horizontal speed factor. The Ratio Slider is used like like a brake. be carrefull to start it from zero slowly. On High speed and full ratio, the vessel could try to be almost horizontal.
@marsh breach A last thing it can be used in atmospheric flight. as it works only with a vertical trust.
@placid nymph, cool you've found
The same of this field is awfull, and if you got a suggestion for that, I'll use it
for the progress I've worked on Tabs for the last time i hope
It does not seem much but the tabs organisation is fully handled in the UIBuilder using custom Classes for button, tab bar and a content manager.
UITK is quite verbose when needed to do such things.
Here is just the code for the pages manager. I've wrote many more classes like this
The full code will be available as a separate git subtree.
I dunno how complicated it would be, but it’d be cool if there was the ability to target a specific spot to land (I think Mechjeb had something similar to that)
That may be more of a flight plan request. I'm working on a capability where you can give a lat/lon (or pick a waypoint) and then create a deorbit burn to put you on a collision course for impact at your selected point. From there, you could switch to K2D2 in FlightView and ask it to land. The K2D2 improvement needed would be to also take a lat/lon or waypoint and attempt to make N/S/E/W adjustments during the landing burn to bring you in close - but it does need you to be on a collision course to somewhere near your intended destination.
precision bombing on non atmospheric planets
I think the request is for K2-D2 to actively steer to land you on a specific spot
you can't exactly do that with a maneuver node
but yeah
basically what you said at the end
still, it would make more sense to me to only pick a landing spot once and click one button in K2-D2 to initiate the deorbit/adjustment burn, then the coast phase, and then the landing burn, rather than switching between two mods to do various parts of it
basically like in MechJeb
of course, with the possibility of K2-D2 calling a FP method to get the initial node
it'would k2-D2 when close to the point . but more flight plan to set up the maneuver before landing. I'd like to do it one day. But I'm not sure I'll suceed.
But with a little help from my friend.... I could be done.
for the moment I'm still on new UI components.
the compass in progress
@lilac parrot I've using the vector api (Painter2D) as found in the radial progres example.
it's open many possibilities.
really cool to draw lines and it will be used also in the lift profile graph
really more optimised than using imgui for that where all point coordinate had do be computed every each frame
yeah, definitely 😆 and UITK generally has much better performance than IMGUI
the rendering of lines is excellent. but for the text is can't do it with Painter2D, and I'll need to handle it with UITK Labels
next step
I agree. We can have FP call K2D2 and vice versa. It would not need to matter which UI the player uses. They could start with FP and then it handles calls to K2D2 or vice versa
I finaly got something decent for the compas
UITK is powerfull but the code is quite verbose when compared to imgui
Damn this is some compley uitking
I've had to create pools of Label instanciated when needed. the uss file can adjust many things like each label size and font.
I'm kinda thinking now that this could have just been a texture set as a background for an element that you move to the left and right, and loop around
quite complex but I'm happy of the result
You're right munix but it was less fun to make 🙂
at least this way you know it will look good on any resolution 😆
yes and it was the primal goal.
you can zoooooom as you like
and it's so easy to add just a small shadow. UITK is powerfull, you're right @lilac parrot
awesome @wraith glen !
It will be available as for any UI using UIBuilder. It can be useful for many purposes. I'll realease this as a separate repo
K2UI I thing for the name.
adaptations to fit in the UIBuilder directly : done
with custom styles for size and colors of the lines
Unfortunately it not yet accessible in the UIBuilder directly. It have to be setup in uss file directly
that looks very nice!
And It's really getting easier
I've tried to use Vector graphic to play perlin noise. it's fast and really responsive
You can see the my slider rendering. I'm quite proud of it too
I've wrote a simple Graph class that can be used in UIBuilder too.
It's a first try and was inredibly easy to make after the compas
That is awesome
thanks bro
@lilac parrot I've lost, in project based on the template, settings about how the panel can be dragged and stop on screen border
as in, you accidentally deleted the code, or it stopped working?
// Create the window options object
var windowOptions = new WindowOptions
{
// The ID of the window. It should be unique to your mod.
WindowId = "SpaceWarpModUI_MyFirstWindow",
// The transform of parent game object of the window.
// If null, it will be created under the main canvas.
Parent = null,
// Whether or not the window can be hidden with F2.
IsHidingEnabled = true,
// Whether to disable game input when typing into text fields.
DisableGameInputForTextFields = true,
MoveOptions = new MoveOptions
{
// Whether or not the window can be moved by dragging.
IsMovingEnabled = true,
// Whether or not the window can only be moved within the screen bounds.
CheckScreenBounds = true
}
};
// Create the window
var myFirstWindow = Window.Create(windowOptions, myFirstWindowUxml);
this is the example code
Yes I've modified some stuff at the beginning and it stop working
excellent thanks !
I'm currently rebuilding the whole stuff. It means I've started the final step. But it could take time too
can't wait to see it in action!
🙂
I've taken a little pause in dev (need to take care of my family 🙂 )
i'm back to code now and the final build is well advanced. My plan is to provide the exact full features that were available in the ImgUI version.
Outstanding! Can't wait to see it!
It will take a little more time.. I think
@munix I could need help there
I'm struggling with asset bundle and code including.
I've made many UIElements and I don't know how to include it in my mod properly
When loading the uxml I've got a set of errors in the BepinExLog
[Error : Unity Log] Element 'K2UI.ToggleButton' has no registered factory method.
[Error : Unity Log] Element 'K2UI.ToggleButton' has no registered factory method.
[Error : Unity Log] Element 'K2UI.Tabs.TabbedPage' has no registered factory method.
[Error : Unity Log] Element 'K2UI.StatusLine' has no registered factory method.
[Error : Unity Log] Element 'K2UI.ToggleButton' has no registered factory method.
[Error : Unity Log] Element 'K2UI.ToggleButton' has no registered factory method.
[Error : Unity Log] Element 'K2UI.StatusLine' has no registered factory method.
[Error : Unity Log] Element 'K2UI.ExFoldoutGroup' has no registered factory method.
[Error : Unity Log] Element 'K2UI.SlideToggle' has no registered factory method.
[Error : Unity Log] Element 'K2UI.InlineEnum' has no registered factory method.
[Error : Unity Log] Element 'K2UI.K2Slider' has no registered factory method.
[Error : Unity Log] Element 'K2UI.SlideToggle' has no registered factory method.
[Error : Unity Log] Element 'K2UI.K2Slider' has no registered factory method.
[Error : Unity Log] Element 'K2UI.K2Slider' has no registered factory method.
[Error : Unity Log] Element 'K2UI.SlideToggle' has no registered factory method.
[Error : Unity Log] Element 'K2UI.K2Slider' has no registered factory method.
[Error : Unity Log] Element 'K2UI.K2Slider' has no registered factory method.
[Error : Unity Log] Element 'K2UI.K2Slider' has no registered factory method.
[Error : Unity Log] Element 'K2UI.SlideToggle' has no registered factory method.
[Error : Unity Log] Element 'K2UI.Tabs.TabButton' has no registered factory method.
[Error : Unity Log] Element 'K2UI.Tabs.TabButton' has no registered factory method.
[Error : Unity Log] Element 'K2UI.Tabs.TabButton' has no registered factory method.
that just means you didn't create a factory class for your controls
they are loaded properly
it shouldn't have any actual negative effects
all it means is that your controls can't be added from the UI Builder
All my controls works fine in the UI Builder but not when loading in KSP
I think the classes are not imported properly
Not sure if it is built in the K2D.Unity.dll
I can't add .cs file to asset bundle
I have a look
well they are in that file if you put them into the K2D2.Unity project
I did but perhaps they are loaded after the uxml....
and then as you can see in the template, they get loaded here: https://github.com/SpaceWarpDev/SpaceWarp.Template/blob/main/src/templates/SpaceWarpModUI/src/SpaceWarpModUI/SpaceWarpModUIPlugin.cs#L109-L116
that could be the case, then you can just change the order in which you call the methods
/// <summary>
/// Loads all the assemblies for the mod.
/// </summary>
private static void LoadAssemblies()
{
// Load the Unity project assembly
var currentFolder = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory!.FullName;
var unityAssembly = Assembly.LoadFrom(Path.Combine(currentFolder, "K2D2.Unity.dll"));
// Register any custom UI controls from the loaded assembly
CustomControls.RegisterFromAssembly(unityAssembly);
}
I've added logs and It is loaded correctly
[LOG 17:01:28.465] Trying to load K2D2 Assemblies
[LOG 17:01:28.475] assemblie : K2D2.Unity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Just before the uxml load
perhaps I've missed something about uxmlfactory
I'could I've missed something like that
that just means that you would be able to use your controls like <StatusLine> instead of <K2UI.StatusLine> I think
I've never actually seen anyone use it
ok ... damnit 🙂
oh wait, I just looked at your GitHub
only .cs files inside the Assets/Runtime folder get compiled into K2D2.Unity.dll
that's the issue
yours are in Assets/UI
generally, C# scripts in Unity projects are divided into Editor (scripts that use UnityEditor APIs and cannot run in the game) and Runtime (basically everything else) folders
Thanks that's quite important I move it at once
that should hopefully fix the issue, everything else looks like good
When do the k2d2.Unity.dll is built ?
during the build asset bundle ?
or during the main mod build ?
it's built with the main solution
we don't use Unity's build pipeline for C#
(though it is also possible with ThunderKit)
great
Ohhhh joy
I finally can start link it to pilots... thanks a lot @lilac parrot
awesome!
like usually you are a great help
I've got another question about Nuget
In the previous code in order to call FlightPlan I used to have a version of the dll in an external_dll folder
is there a way to get it using nuget ?
The ddl file should be added to a server....
and how it is done for the main KSP2 dll ? You are adding this manually when a new release occurs
yes, I run a script to strip the KSP2 dlls of all implementation code, leaving only type/member definitions, and then upload the results to the server
for every KSP2 version
and definitely, @late bane would just need to send me the .nupkg file to upload
since the last uploaded version is 0.8, which is outdated: https://nuget.spacewarp.org/packages/flightplan/0.8.0
BaGet
though, I don't know how much the public API has changed, if not much, you can probably just use that version
I'll use this version, thanks. I've also planned to open MNC
but it can't be found in your nuget
yeah, don't think schlosrat ever made a nuget package for that
I'll try to create one for k2d2 when the uitk port is finished
I didn’t not think the API has changed since 0.8 but to be sure I’ll make an updated FP nuget and I’m happy to make one for MNC as well. I don’t think it’s got much of an API, just a way to call it to raise its UI
yes I won't need anything else
thanks
oh pure happiness. i've got, at last, Node Execution pilot fully running with UITK
It have been quite a long way to reach this simple first step. But I have rewritten most parts of the whole mod.
The next steps will be quite easy, as I think I've implemented all UI stuff I need to fully make all other pages
the settings for the Node are there too
I've got many little color adjustment to make. The purple is far too much visible.
But I'm quite happy, The next steps could be really easier than the past 2 months
This is fantastic progress! I think you may have found the tipping point where things become much easier going forward.
🙂 yes this tiping point was hard to reach but now my code is so much simplier than it was with imgui.
the whole complexity is now hidden in my K2UI package.
I can bind VisualElement (sliders, editor fields etc...) from and to settings value.
this make Ui code really simple, juste find the visual element and bind it to a value....
UITK :
- [ ] rebuild full set of controllers
-
[x] big toogle button (rename to toggle button)
- [x] cs
- [x] uss
- [x] add icon
- [x] active color
-
[x] small slider toogle
- [x] cs
- [x] uss
-
[x] slider with options
- [x] cs
- [x] uss
-
[x] Simplified Progress Bar
- [x] cs
- [x] uss
-
[x] Tabs Panel
- [x] Button cs
- [x] TabBar cs
- [x] TabbedPage cs
- [x] Panel cs
- [ ] Enable / disable Tabs
- [ ] Avoid update Ui if tab is not visible
- [ ] default tab on startup
- [ ] UI look (back to simple buttons !)
-
[x] Status Line
- [x] cs
- [x] uss
-
[x] Console Label
- [x] cs
- [x] uss
-
[x] Label
- [x] uss
-
[ ] Value Fields
- [x] uss
- [ ] test delayed
- [ ] Bindable
-
[x] Windows Header
-
[x] Settings bindable
- [x] settings pages + button Settings
-
[ ] Repeat button
-
[ ] Field with repeat button (for the drone)
-
[x] Compass
-
[ ] Curve Panel
- [x] Graph Line
- [ ] Gradient
-
[ ] full uss file
- [ ] Header transparency
- [ ] Fold out background
-
[ ] draggable and window limit
-
[ ] bug on size change
-
[ ] Ui is not resizable @munix help
-
[ ] Node ex
- [x] Main UI
- [ ] button binding on active
- [ ] add Node using Flight Plan
- [ ] Settings
- [x] UI
- [ ] Binding
- [x] Main UI
-
[ ] Lift
- [ ] Main UI
- [ ] UI
- [ ] Settings
- [ ] UI
- [ ] Binding
- [ ] Main UI
-
[ ] Land
- [ ] Main UI
- [ ] UI
- [ ] Code
- [ ] Settings
- [ ] UI
- [ ] Binding
- [ ] Main UI
-
[ ] Drone
- [ ] Main UI
- [ ] UI
- [ ] Code
- [ ] Settings
- [ ] UI
- [ ] Binding
- [ ] Main UI
-
[ ] Attitude
- [ ] Main UI
- [ ] UI
- [ ] Code
- [ ] Settings
- [ ] UI
- [ ] Binding
- [ ] Main UI
I just share my todo list .... i'still got work to do....
Discord has md highlighting?
not really.
it has basic markdown support, not the full set
and probably some more
oh and of course,
public static void Main()
{
Console.WriteLine("Code");
}
and
Blockquotes
I meant syntax highlighting
it is partial too 🙂
the Lift pilot is on his way. gradient are ok lines too, compass ok. just have to assemble those bricks now
do planet declares their albedo color ... ? I'll check this
Oh this is awesome! Will it be color coded based on the atmosphere of the planet you're lifting off from? But what then when lifting off from an airless moon like Minmus?
there won't be a color... as the gradient is based on the planet atm density it won't be visible.
Very good progresses today
the lift pilot is fully functionnal !
the color shoudl need some small fixes
as I've not found how to get it I've created a little function to get color from just the body name
Color colorTable(string body_name)
{
switch (body_name.ToLower())
{
case "laythe": return ColorTools.parseColor("#2662af");
case "jool": return ColorTools.parseColor("#549324");
case "duna": return ColorTools.parseColor("#e47350");
case "kerbin": return ColorTools.parseColor("#3f54ff");
case "eve": return ColorTools.parseColor("#9152c6");
}
return Color.black;
}
this is not completly perfect but I made it simple
does anyone have an idea on how to get a "mean color of the planet" ?
@cursive ibex I saw that you did quite the same thing for OrbitalSurvey.
anyway the lift is finished I thinK, but I've still have the Dock, Drone and Attitude pilot to add....
It will be really easier
you could probably just extract the texture files from the game and write some small script to give you the average pixel color
but honestly I think just approximating is the best thing to do, it doesn't need to be perfectly precise
you're right, I'll have full control of colors.
But it's a shame if new planet are added by modders.
yeah, the game doesn't have any API for associating colors with planets
but that can easily be added with something like Shoemaker, once we actually figure out how to add planets
Yes K2D2 could take infos from there when it will be ready.
I just used one website where you upload an image and it gives you a color pallet for it. Then I tweaked it manually to get more contrast for different regions. Since custom planets aren't a thing yet I didn't' bother to automate this.
But yeah, it would be easy to write a script that gives you the average color of all pixels.
The Landing Pilot is running quite well too, there were no much work on that because no complex ui there
The next one is the Drone pilot and it can be tricky because of Repeat Buttons
I've see them in MNC and I will check how it is made
then there will be Dock pilot (mid complex) and Attitude that is really simple
literally just the RepeatButton control from Unity
Ho there was one ! great.
anyway I've finally full tested the Mod in a real full trip. and It's working well, better than before in many cases
I've added some new options that make the landing, a lot safer.
The direction of burn was computed with a max of 5° of tolerance.
I've added this option and many ships should have a tolerance of 15° or 30° for unprecises ships
Landing on Kerbal like on a moon is now quite easy now. but it cost of course a lot of fuel, reserved to infionite fuel mode
I was wondering about releasing this version that is quite incomplete but fully functionnal for Node execution, Lift and Landing.
Dock, Drone , attitude is still missing
Do it!