Jump to content

What's new in 0.90


Recommended Posts

0.90 is out and the mod update frenzy is starting.

This time I'll share some of the changes modders in the Experimental group have found. I won't share their name since they may not want to get harassed by PM to get some info once the next version in in Exp. Thank to them for those.

Share your findings.

  • The IPartCostModifier IPartMassModifier IPartSizeModifier interface allow a PartModule to change the Cost, Mass and Size(the last don't seem to work) of a part.
    Any mod that need to change a part Cost runtime should implement those.
    For example add the interface to your PartModule class declaration

    public class MyPartModule : PartModule, [B]IPartCostModifier[/B]


    And add the call required by the interface :


    float GetModuleCost(float defaultCost)
    {
    return defaultCost * 0.01; // defaultCost is the Part default cost. So this would make this module add 1% to the part cost.
    }


    IPartSizeModifier is an unknown factor. Stuff sure did not get bigger when I tried:)
    IPartMassModifier does not change the part mass, but only change the reported mass in the Editor...

  • GameScenes.SPH is gone. Both the VAB and the editor have HighLogic.LoadedScene == GameScenes.EDITOR
    You know where the ship point to with : EditorLogic.VesselRotation * Vector3d.up
  • Obviously most of the Editor related code need to change. Anything using EditorLogic or the part list will need a serious overhaul
  • New ConfigNode.values.GetValues() and ConfigNodevalue.nodes.GetNodes() return all the values and child nodes as an array.
  • New events in GameEvents :
    Misc : OnAppFocus onGUILock onGUIUnlock onGUIEditorToolbarReady OnExperimentDeployed
    Editor onEditorScreenChange onEditorScreenChange onEditorSymmetryMethodChange onEditorSymmetryCoordsChange onEditorSymmetryModeChange onEditorSnapModeChange onEditorConstructionModeChange onEditorPartEvent onEditorShowPartList onEditorUndo onEditorRedo
    Upgrade : OnKSCFacilityUpgrading OnKSCFacilityUpgraded OnUpgradeableObjLevelChange
  • Building upgrade related stuff
    First get a building current level : ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.VehicleAssemblyBuilding)
    Then get use those to get the various active restriction. Finding which SpaceCenterFacility level each of those use is left as an exercise to the reader.
    public int GetPartCountLimit(float editorNormLevel)
    public bool UnlockedFuelTransfer(float editorNormLevel)
    public bool UnlockedActionGroupsStock(float editorNormLevel)
    public bool UnlockedActionGroupsCustom(float editorNormLevel)
    public float GetCraftMassLimit(float editorNormLevel)
    public Vector3 GetCraftSizeLimit(float editorNormLevel)
    public int GetActiveStrategyLimit(float adminNormLevel)
    public float GetStrategyCommitRange(float adminNormLevel)
    public float GetStrategyLevelLimit(float adminNormLevel)
    public int GetActiveContractsLimit(float mCtrlNormLevel)
    public float GetContractLevelLimit(float mCtrlNormLevel)
    public bool UnlockedFlightPlanning(float mCtrlNormLevel)
    public int GetActiveCrewLimit(float astroComplexNormLevel)
    public float GetCrewLevelLimit(float astroComplexNormLevel)
    public bool UnlockedEVA(float astroComplexNormLevel)
    public bool UnlockedEVAFlags(float astroComplexNormLevel)
    public bool UnlockedEVAClamber(float astroComplexNormLevel)
    public bool EVAIsPossible(bool evaUnlocked, Vessel v)
    public string GetEVALockedReason(Vessel v)
    public GameVariables.OrbitDisplayMode GetOrbitDisplayMode(float tsNormLevel)
    public int GetTrackedObjectLimit(float tsNormLevel)
    public int GetPatchesAheadLimit(float tsNormLevel)
    public bool UnlockedSpaceObjectDiscovery(float tsNormLevel)
    public UntrackedObjectClass MinTrackedObjectSize(float tsNormLevel)
    public float GetScienceCostLimit(float RnDnormLevel)
    public float GetDataToScienceRatio(float RnDnormLevel)
    public float GetExperimentLevel(float RnDnormLevel)
    A warning : none of those limits are configurable.
  • Kerbal can now be Pilot, Engineer or Scientist. So ProtoCrewMember now have an experience, experienceLevel and experienceTrait field.
    The experience trait effect seem to be defined in the Experience.Effects namespace but we don't how they work yet.
  • Vessel have
    - 3 new control callbacks. OnPreAutopilotUpdate OnAutopilotUpdate OnPostAutopilotUpdate. Those 3 are called before OnFlyByWire and in the order I wrote them. I suggest any mod that control a vessel to use them instead of OnFlyByWire. The new SAS/Pilot seems to use OnAutopilotUpdate. I'll have MJ use one of those soon
    - VesselValues.RepairSkill/ScienceSkill/ScienceReturn/AutopilotSkill and other give you info on the skill level of your crew.
  • ModuleCommand now has a State to know why it's not working : NotEnoughCrew / NotEnoughResources / Good

Link to comment
Share on other sites

So far I have also found that the new pilot abilities seem to be underpinned by a new VesselAutopilot class.

For my specific situation, this means that Vessel.VesselSAS is gone and replaced by VesselAutopilot.VesselSAS instead.

So I had to change:

FlightGlobals.ActiveVessel.VesselSAS

is now

FlightGlobals.ActiveVessel.AutoPilot.SAS

D.

Edited by Diazo
Link to comment
Share on other sites

Any ideas where the new forms of SAS (lock to pre-defined vectors) are doing their control logic? The PID tuning for stability assistance still works fine after updating as Diazo has already specified, but the new forms are not responding to the PID tuner at all indicating they are working on a different mechanism.

Link to comment
Share on other sites


Part.SetHighlight(bool active)

is gone..

there is now:


public void SetHighlight(bool active, bool recursive)

I also found these, but have not figured out how to use them.


Part.HighlightType highlightType

//can hold these:
Part.HighlightType.AlwaysOn
Part.HighlightType.Disabled
Part.HighlightType.OnMouseOver

//also
UnityEngine.Color Part.highlightColor

Edited by philotical
Link to comment
Share on other sites

I'm guessing that the new Skills must work like Modules now?

The new Experience Folder has a file called Traits and Traits are written like Modules and have a effect hook that seems to be the reference to the actual Trait Effect.

Have not broken it down that much more, can't seem to find out much more. You can check out

Experience and Experience.Effect to see a list of things. But as for how to write a new trait... Not sure yet.

Actually seems to be a lot more traits then are used, unless they use each other. But so far looks like some of the options inside a trait are including the old engine trait that they dropped earlier I believe.

GetDefaultValue()

GetDescription()

OnRegister(Part)

OnUnregister(Part)

The its own actual Code and experience use. Experience like most other values is a float.

Edited by malkuth
Link to comment
Share on other sites

Can anyone describe how the new autopilot hooks work and how they differ from OnFlyByWire, conceptually? Specifically, how they interact with a human pilot also trying to control the same vessel at the same time - who "wins". With OnFlyByWire it was generally whomever added the lastmost hook.

Link to comment
Share on other sites

They work the same way but change the state before OnFlyByWire.

So if a mod A uses OnAutopilotUpdate but a mod B overwrite the state in OnFlyByWire then the copntrol are those used by B.

I think a clean way to use this would be to stay out of OnFlyByWire so the user can override any mod control, and use OnAutopilotUpdate for mods. More complex mod like RT2 could use that to intercept and delay control by using OnPostAutopilotUpdate that run later, and clean OnFlyByWire of human are unusable.

Link to comment
Share on other sites

Figured out how to add an experience trait.

9iRI7Kx.png?1


using System;
using KSP;
using UnityEngine;
using Experience;
using System.Collections;

namespace GeoSciencist
{
[KSPAddon(KSPAddon.Startup.Instantly, false)]
public class SurfaceScientist : MonoBehaviour
{
Type tp = typeof(ExperienceTrait);
ProtoCrewMember kerbal;
public ExperienceTraitConfig GeoConf = ExperienceTraitConfig.Create(ConfigNode.Load(KSPUtil.ApplicationRootPath + "GameData/MoreTraits/Traits.cfg"));
public void Awake()
{
Experience.ExperienceTrait.Create(tp, GeoConf, kerbal);
}

}
}

I have not been able to make a new effect for the Geologist yet, but that is what I will work on next. I am not actually sure whether this works, After deleting the .dll in the folder it still shows up because I left the cfg in there. :blush:

Edited by Robotengineer
Link to comment
Share on other sites

Which trait is assigned to a kerbal (ProtoCrewMember) is purely based on a hash of their name, done whenever the PCM object is created, there is no saving or loading mechanism for saying which PCM has which trait.

Would it be possible to make it based on a Kerbals courage and stupidity?

Link to comment
Share on other sites

Any ideas where the new forms of SAS (lock to pre-defined vectors) are doing their control logic? The PID tuning for stability assistance still works fine after updating as Diazo has already specified, but the new forms are not responding to the PID tuner at all indicating they are working on a different mechanism.

VesselAutopilot.VesselSAS has methods to set pitch, roll, and yaw PIDs. (eg VesselAutopilot.VesselSAS.SetLockPitchPID(float, float, float, float))

Link to comment
Share on other sites

Any ideas where the new forms of SAS (lock to pre-defined vectors) are doing their control logic? The PID tuning for stability assistance still works fine after updating as Diazo has already specified, but the new forms are not responding to the PID tuner at all indicating they are working on a different mechanism.

Can you use the API to lock the new SAS to any arbitrary direction you pick for it instead of just to the six cardinal ones? (i.e. "Please try to SAS your way toward the goal direction that I'm going to give you, oh and by the way I'll be slightly updating this goal direction each update because it's not fixed in space - its a dynamic direction (i.e. 5 degreees above the target, or in the same facing direction as my target is facing, etc - any sort of direction that will need to be moved a little bit each update.")

Because I'm fearful that if there's an API method to give it just whatever direction you feel like, that constantly passing in a slightly moved direction each time will end up constantly resetting the PID controller making it not able to do its work properly. It seems like you have to leave the direction unchanged for a few ticks for the PID controller to do anything. (And this immediately begs the question why on earth it can lock the SAS to aim toward the target as it moves relative to its target - it clearly *is* able to deal with a seek direction that keeps getting re-updated again and again continually, but it seems as if it can't deal with such a seek direction if it's one you pass into it.

Link to comment
Share on other sites

Can you use the API to lock the new SAS to any arbitrary direction you pick for it instead of just to the six cardinal ones? (i.e. "Please try to SAS your way toward the goal direction that I'm going to give you, oh and by the way I'll be slightly updating this goal direction each update because it's not fixed in space - its a dynamic direction (i.e. 5 degreees above the target, or in the same facing direction as my target is facing, etc - any sort of direction that will need to be moved a little bit each update.")

Because I'm fearful that if there's an API method to give it just whatever direction you feel like, that constantly passing in a slightly moved direction each time will end up constantly resetting the PID controller making it not able to do its work properly. It seems like you have to leave the direction unchanged for a few ticks for the PID controller to do anything. (And this immediately begs the question why on earth it can lock the SAS to aim toward the target as it moves relative to its target - it clearly *is* able to deal with a seek direction that keeps getting re-updated again and again continually, but it seems as if it can't deal with such a seek direction if it's one you pass into it.

It uses an enumeration for the mode (stability, prograde, retrograde, etc). However, from what I've seen tinkering with it, the prograde, etc, depend on the mode the speed display is in - prograde will be orbit-relative if the speed display shows Orbit, and surface-relative if it's Surface. I assume it does target mode as well, but I haven't had enough time to test that out.

Link to comment
Share on other sites

Because I'm fearful that if there's an API method to give it just whatever direction you feel like, that constantly passing in a slightly moved direction each time will end up constantly resetting the PID controller making it not able to do its work properly. It seems like you have to leave the direction unchanged for a few ticks for the PID controller to do anything. (And this immediately begs the question why on earth it can lock the SAS to aim toward the target as it moves relative to its target - it clearly *is* able to deal with a seek direction that keeps getting re-updated again and again continually, but it seems as if it can't deal with such a seek direction if it's one you pass into it.

Correct, you can not set the SAS direction every frame, it results in the SAS doing nothing.

For my Landing Aid mod in which I use the SAS to control the vessel tip in order to slow down, I had to add a timer so I was only calling SAS.LockDirection every 10 or so frames. (I experimented with every 5 to 15 frames and did not see much difference in the number as long as SAS had frames to control the vessel before I set a new SAS.LockDirection)

It looks like SAS does nothing in the update frame the direction lock is set, only in the update frames afterwards.

D.

Link to comment
Share on other sites

VesselAutopilot.VesselSAS has methods to set pitch, roll, and yaw PIDs. (eg VesselAutopilot.VesselSAS.SetLockPitchPID(float, float, float, float))

Yes, and those work for stability assistance (I've been using them for a while), but have absolutely zero effect on the various target locks introduced by 0.90 (which is extremely frustrating because I've found them almost unusable due to vibration)

Can you use the API to lock the new SAS to any arbitrary direction you pick for it instead of just to the six cardinal ones? (i.e. "Please try to SAS your way toward the goal direction that I'm going to give you, oh and by the way I'll be slightly updating this goal direction each update because it's not fixed in space - its a dynamic direction (i.e. 5 degreees above the target, or in the same facing direction as my target is facing, etc - any sort of direction that will need to be moved a little bit each update.")

I haven't tried this myself, but under the autopilot there is the old SAS and a new RSAS which has the method setTargetOrientation(Vector3 target, bool reset). I'm fairly certain this is what is being called to operate the new vector locks, but as I said earlier, there is nothing showing how the control is being actuated unlike VesselSAS.

Edited by Crzyrndm
Link to comment
Share on other sites

(I experimented with every 5 to 15 frames and did not see much difference in the number as long as SAS had frames to control the vessel before I set a new SAS.LockDirection)

Given how PID controllers work, I suspect the magic minimum number is 3. 2 is enough to learn the diff between current value and previous value, derive a change rate from that, derive a future predicted position from that, and then you need one more iteration after that to actually see an effect happen from the input settings that it changed in iteration 2.

a new RSAS which has the method setTargetOrientation(Vector3 target, bool reset).

Just on pure guesswork from the method signature that sounds like what we might need. I'll pass that on to erendake (although, if it's a Vector and not a Quaternion, then that means it has no roll information, which is going to annoy our users quite a bit. It's fine for rockets to ignore roll, but not for spaceplanes).

Link to comment
Share on other sites

Just on pure guesswork from the method signature that sounds like what we might need. I'll pass that on to erendake (although, if it's a Vector and not a Quaternion, then that means it has no roll information, which is going to annoy our users quite a bit. It's fine for rockets to ignore roll, but not for spaceplanes).

From my observations the heading locks only seem to be doing some form of damping on the roll axis which fits with that observation. That damping works terribly with planes, and I have not yet found a tuning method

Edited by Crzyrndm
Link to comment
Share on other sites

Here's another question: If you're writing some changes to a mod to make it take into account the new space center building tech levels, and you need to test what happens to career games at different points of progression, is there a quick cheaty way to set the building tech levels where you want without having to actually play out the entire career to that point? I also have the same question for pilot skills.

Basically, I'm contemplating making kOS obey the Tracking Center limits. For example, kOS allows scripts to access a nearest pass orbit solver (a function that lets you pass in two Orbit objects and it returns the next timestamp at which it guesses they'll have the closest rendezvous). I'm contemplating making it not work until after your Tracking Center can do it, under the thematic idea that your space agency isn't very good at that yet. (And to keep kOS from being a mechanism by which you can cheat your way past the limitations of career mode).

But to test a thing like that, I'll need savegames in which the tracking center has different tech levels. Being able to quickly fake that for mod testing would be useful.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...