SSTU - Shadow Space Technologies Unlimited

SSTU - Shadow Space Technologies Unlimited

98.5k Downloads

Tech Limitations Not respected in career mode (KSP 1.1.3, SSTU 0.4.31.118)

shadowmage45 opened this issue ยท 2 comments

commented

Can confirm the issue in career mode.
Log is filled with 'R&D Instance is Null, no R&D information is available'.

  • It appears that loading sequence has changed in 1.1.3, insofar as that the R&D data is no longer available when switching to the editor at all (ResearchAndDevelopment.Instance==null), resulting in no research data being available while in the editor.
  • Potential solution is to only load the R&D cache a single time on game-load using a coroutine with a delayed startup. Further updates would be listened for via the technology-researched event, and the cache would be updated with the new research data.
  • Another alternative solution would be to merely cache the entire R&D state and do live-lookups from the cached data.
  • Sadly, it is not possible to rely on the -actual- R&D data, as the data is not available at most points where it is needed.
  • It appears that procedural parts merely delays the tech-limit initialization until the R&D center is ready, checking it in -every- fixed update; this is terribly inefficient and a fairly horrible hack and I would prefer to -not- go down that route if possible.
    • I need the data to be -always available-, from the moment the editor starts until the ship is launched.
    • This includes already-existing craft when the editor is loaded; I need them to have access to tech-data from the moment the part is initialized; it simply cannot wait until the R&D data is finally available.
    • As such, a caching method is the only thing that will work; that is the only way to work around the R&D instance being null when the editor is loaded.
      • A good question is why the R&D instance -ever- nulled out? it should be created ONCE per game; not recreated on every scene change. Wonder why KSP is so slow during scene changes / generates so much garbage? Well... thats it right there... destroying and recreating things that need not be destroyed or recreated.
commented

Have implemented a delayed/lazy caching update system. As long as the user visits the space center before they go to the editor/flight scenes, the tech-limit cache -should- be updated and ready to use.

Now any game load or scene change will trigger the 'needs cache rebuilt' flag, and it will check on every LateUpdate to see if the R&D instance is available, and rebuild the cache when it is first available.

Will need to do testing to make sure that the cache is built prior to first entering the editor under all circumstances / scene-changes.

commented

Fixed in dev; available with the next update.

Using a modified caching system that will update the cache at the first available opportunity.

Known problematic scenarios would include any time that the space-center scene is skipped entirely (e.g. load directly to vessel from main menu, or quick-loads). Though, it should not effect any in-flight craft, so the actual impact should be minimal.