Jump to content

Warezcrawler

Members
  • Posts

    611
  • Joined

  • Last visited

Everything posted by Warezcrawler

  1. That's fine. Note there will always be Garbage Collection, it's just a matter of how often. Many mods create more garbage than they need to, but that is as it is when we are amateurs. However, the KSP community is more aware of this than many, so we do see improvements all the time.
  2. The red line indicates Garbage Collection done by the unity/C# engine. And as far as I can see, you are not that hard hit. Between you red line I have 6 extra. Stutter not related to GC/red lines are heavy calculations, which can happen with X-Science. There is an unofficial build on the X-Science page that can help reduce that. In the following thread we are discussing what can be done about it.
  3. well, in this last build, I get only very little stutter I can attribute to X-Science. If you are still getting significant stutter, I think you might have to look at other mods as well. Not saying nothing more can be done, but it should no longer be that bad. There are still specific cases where it does a full recalculation, but that should more or less be reduced to scene changes. EDIT: And if it wasn't clear, I've uploaded a new version of the dll. Same link.
  4. Hey... I've done another small update to the dll. I think I found a way to have the mod not loop all vessels for science on very update. Now they are more or less only loop once on very scene change. I simply cache the result and reapply it on the updates instead of recalculating. This way only the loaded vessels are actually updated, which should be exactly what is needed. Hope this might help even a little more on the stutter.
  5. wow, that's a lot of changes. Can't wait to see it in game!
  6. Now all we need is landing sites across kerbin, and refuel at them all...
  7. True... Just saying that I have not had problems so far. I'm I right in assuming that SCANcontroller does not write to unity/KSP object? Only reads? As far as I gather it just writes to it's own objects.
  8. Performance hits that are not because of garbage can possibly be countered by running them in a parallel thread. I've actually tried that for SCANcontroller and it does not seem to cause problems.
  9. I'm new at this GC thingy, and I did changes to all three mods at the same time, so I can be wrong about ScanSat. But, I did changes several places. I'll try to summarize as best as I remember it. I only looked at stuff I tracked from the "scanFromAllVessels()" method, since I identified that it is called from "Update()", hence running often. That's all I remember doing. If I'm wrong about some or all of the stuff above generating garbage, please enlighten me, I'm still trying to figure out how to reduce it best thanks
  10. I had a look at X-Science. On the X-Science page you can find a stutter reduced unofficial build for 1.4.2. To combat the Garbage Collector I've identified a few mods, which was heavy in creating garbage. (no particular order) Kerbal Engineer ScanSat X-Science After having rebuild and done some changes to them, based on the great input I got in this thread (+some more studying of the topic online) I managed to reduce my stutter from every 2-3 seconds to 10-15 second intervals. Mostly I went through the executions of the update functions that run often, and moved class references from local to global area. Hence paying for better performance with a little extra memory. I think ScanSat does create a lot a garbage alone, since it create reference variables inside loops. To my understanding this is not the best. Question, since this topic is still new to me. I know creating a lot of local class instances/references to the heap generates a lot of garbage. How does the function with primitives like int, string, float etc. and struct in general. Any advise on the. For now that let all creating of the latter be, since it is my understanding, that this does not affect the GC. Is this correct in any way?
  11. I have noticed that X-Science does a lot of recalculations when you hit those buttons. The does give lag. My latest build of X-Science does reduce that, in my experience. Try it out here. https://drive.google.com/open?id=1tKivW4S7YTOeMRHRTU7tm0oB1FNSKHnN Based on your video (nice demo by the way), I'm guessing the the "floating of the messages" are the message regarding the science having been sent and received, stating how much science you got. If that is the case, I'm 99% sure that has nothing to do with X-Science. That is stock. However, X-Science might be doing a reset at that point (I think it does).... If that is the case, the above build might reduce the lag. Please try it out.
  12. What are you referring to? I'm not sure I follow. Is it Kerbalism related? I've never tried Kerbalism, so might not have experienced what you are referring to. Any screen shots?
  13. I don't believe there is any. But you have delta v, and how long you can keep you burn going before running out of fuel.
  14. I think we all have something similar.... Don't believe it to be an issue at all. Probably a matter of the rocket not pointing exactly up, and maybe some roundings as well... Nothing to spend time on I think.
  15. I think I might have found a way to reduce the lag. I'm playing with it right now, and in the current build I have not identified anything broken yet. Stutter from changing biomes does seem to be significantly reduced. If anyone want's to help test, then here is a link. (according to the license rules if this mod, I believe this is allowed). It is only the .dll, and you will have to overwrite the original manually. https://drive.google.com/open?id=1tKivW4S7YTOeMRHRTU7tm0oB1FNSKHnN I do think there is more that can be done to the here and now, since I also get a stutter when applying experiments. But I have not figured anything out for that part yet. @Z-Key Aerospace I hope you can use the work done. There is probably something to optimize in my work as well, this is just what I could come up with. Changes to RefreshExperimentCache() in ScienceContext class //WarezCrawler 2018-04-03 BodySituationFilter BodyFilter = new BodySituationFilter(); //Reduce garbage collection. I think this class maybe could be changed to static? internal bool ExperimentCacheLoaded = false; //Make sure all experiments are only updated very seldom /// <summary> /// Refreshes the experiment cache. THIS IS VERY EXPENSIVE. /// CB: Actually doesn't seem much worse than UpdateExperiments() /// </summary> private void RefreshExperimentCache() { Debug.Log("[XS-GTI] RefreshExperimentCache()"); if (_allScienceInstances != null) Debug.Log("[XS-GTI] " + _allScienceInstances.Count); // Init var StartTime = DateTime.Now; //BodySituationFilter BodyFilter = new BodySituationFilter( ); _unlockedInstruments.Clear(); //WarezCrawler 2018-04-03 if (!ExperimentCacheLoaded || !HighLogic.LoadedSceneIsFlight) //Make sure all experiments are only updated very seldom { Debug.Log("[XS-GTI] Clearing experiments"); _allScienceInstances.Clear(); ExperimentCacheLoaded = false; } //_logger.Info( "RefreshExperimentCache" ); // Quick check for things we depend on if (ResearchAndDevelopment.Instance == null || PartLoader.Instance == null) { _logger.Debug("ResearchAndDevelopment and PartLoader must be instantiated."); return; } if (!ExperimentCacheLoaded) //Make sure all experiments are only updated very seldom { Debug.Log("[XS-GTI] Updating _allScienceInstances"); if (_allScienceInstances != null) Debug.Log("[XS-GTI]" + _allScienceInstances.Count); // Check this experiment in all biomes on all bodies // Loop around all experiments foreach (var X in _experiments) { var experiment = X.Key; //_logger.Trace( experiment.experimentTitle ); // Where the experiment is possible uint sitMask = experiment.situationMask; uint biomeMask = experiment.biomeMask; /* Need to look at public bool BiomeIsRelevantWhile( ExperimentSituations situation ); public bool IsAvailableWhile( ExperimentSituations situation, CelestialBody body ); On ScienceExperiment */ // OrbitalScience support - where the experiment is possible if (sitMask == 0 && _experiments[experiment] != null) { var sitMaskField = _experiments[experiment].GetType().GetField("sitMask"); if (sitMaskField != null) { sitMask = (uint)(int)sitMaskField.GetValue(_experiments[experiment]); //_logger.Trace( "Setting sitMask to " + sitMask + " for " + experiment.experimentTitle ); } if (biomeMask == 0) { var biomeMaskField = _experiments[experiment].GetType().GetField("bioMask"); if (biomeMaskField != null) { biomeMask = (uint)(int)biomeMaskField.GetValue(_experiments[experiment]); //_logger.Trace( "Setting biomeMask to " + biomeMask + " for " + experiment.experimentTitle ); } } } List<ExperimentSituations> SituationList = Enum.GetValues(typeof(ExperimentSituations)).Cast<ExperimentSituations>().ToList<ExperimentSituations>(); List<Body> bodies = new List<Body>(_bodyList.Values.ToList()); // Check for CelestialBodyFilter if (_experiments[experiment] != null) { //_logger.Trace( Experiments[ experiment ].experimentID ); if (CelestialBodyFilters.Filters.HasValue(_experiments[experiment].experimentID)) { string FilterText = CelestialBodyFilters.Filters.GetValue(_experiments[experiment].experimentID); BodyFilter.Filter(bodies, SituationList, FilterText); } } for (int body_index = 0; body_index < bodies.Count; body_index++) { //WarezCrawler 2018-04-03 //if (HighLogic.LoadedSceneIsFlight && (FlightGlobals.ActiveVessel != null && FlightGlobals.currentMainBody != null)) // if (bodies[body_index].CelestialBody != FlightGlobals.currentMainBody) // continue; if (experiment.requireAtmosphere && !bodies[body_index].HasAtmosphere) continue; // If the whole planet doesn't have an atmosphere, then there's not much point continuing. for (int situation_index = 0; situation_index < SituationList.Count; situation_index++) { if (SituationList[situation_index] == ExperimentSituations.SrfSplashed && !bodies[body_index].HasOcean) continue; // Some planets don't have an ocean for us to be splashed down in. if (SituationList[situation_index] == ExperimentSituations.SrfLanded && !bodies[body_index].HasSurface) continue; // Jool and the Sun don't have a surface. if ((SituationList[situation_index] == ExperimentSituations.FlyingHigh || SituationList[situation_index] == ExperimentSituations.FlyingLow) && !bodies[body_index].HasAtmosphere) continue; // Some planets don't have an atmosphere for us to fly in. if ((sitMask & (uint)SituationList[situation_index]) == 0) continue; // This experiment isn't valid for our current situation. if (bodies[body_index].Biomes.Any() && (biomeMask & (uint)SituationList[situation_index]) != 0) { for (int biome_index = 0; biome_index < bodies[body_index].Biomes.Count(); biome_index++) { ScienceInstance S = new ScienceInstance(experiment, new Situation(bodies[body_index], SituationList[situation_index], bodies[body_index].Biomes[biome_index]), this); if (BodyFilter.TextFilter(S)) if (!_parent.Config.FilterDifficultScience || BodyFilter.DifficultScienceFilter(S)) _allScienceInstances.Add(S); } } else { ScienceInstance S = new ScienceInstance(experiment, new Situation(bodies[body_index], SituationList[situation_index]), this); if (BodyFilter.TextFilter(S)) if (!_parent.Config.FilterDifficultScience || BodyFilter.DifficultScienceFilter(S)) _allScienceInstances.Add(S); } } } if (((sitMask & (uint)ExperimentSituations.SrfLanded) != 0) && ((biomeMask & (uint)ExperimentSituations.SrfLanded) != 0)) { if (_homeWorld != null && _kscBiomes.Count > 0) { if (bodies.Contains(_bodyList[_homeWorld])) // If we haven't filtered it out { if (SituationList.Contains(ExperimentSituations.SrfLanded)) { //_logger.Trace( "BabyBiomes " + experiment.experimentTitle + ": " + sitMask ); for (int x = 0; x < _kscBiomes.Count; x++) { ScienceInstance S = new ScienceInstance(experiment, new Situation(_bodyList[_homeWorld], ExperimentSituations.SrfLanded, _kscBiome, _kscBiomes[x]), this); if (BodyFilter.TextFilter(S)) if (!_parent.Config.FilterDifficultScience || BodyFilter.DifficultScienceFilter(S)) _allScienceInstances.Add(S); } } } } } } } //WarezCrawler 2018-04-03 if (_allScienceInstances != null) ExperimentCacheLoaded = true; if (_allScienceInstances != null) Debug.Log("[XS-GTI] _allScienceInstances.Count " + _allScienceInstances.Count); // var Elapsed = DateTime.Now - StartTime; // _logger.Trace( "RefreshExperimentCache Done - " + Elapsed.ToString( ) + "ms" ); } Changes to onGameSceneSwitchRequested() in ScienceChecklistAddon class // Runs when scene switch is requested private void onGameSceneSwitchRequested( GameEvents.FromToAction<GameScenes, GameScenes> action ) { Science.ExperimentCacheLoaded = false; //<-- make sure to reload experiments on change of scene (don't know if it is abolutely needed, but does not cost much) // The game likes to play music when we switch scenes, so we have to tell it to shut up once more HammerMusicMute( ); }
  16. @nightingale I think I know why we are still having that bug, even though you fixed it. I believe there is a typo in the version check you do. https://github.com/jrossignol/ContractConfigurator/blob/1.24.2/source/ContractConfigurator/ContractConfigurator.cs#L138-L139 Versioning v = Versioning.Instance as Versioning; if (v.versionMinor == 1 && v.versionMinor == 4 && v.revision == 2) I think it should have been if (v.versionMajor == 1 && v.versionMinor == 4 && v.revision == 2)
  17. Hi Diazo...

    It would seem that you AFK (Away from Kerbin) :o)

    One of your mods "Automatic Vertical Velocity" could use a recompile. If you have not plans to continue this work yourself, I propose I could take over that task until such time as you decide to return.

    What do you say?

  18. Really? Maybe you should try sending error logs and stuff. Just might be that @jrbudda would look at it?
  19. Why all The stress? There is an unofficial Update that Works fine. mods get updated when they get updated.
  20. @Z-Key Aerospace I have been looking for causes for bad performance on my KSP install, and came across the above old posting from @John007qwe seemingly having found a simple change to do to x-science to increase performance. I don't know if you have seen it? I looked through the code in the source, just to see if this was already implemented, but it does not seem to be. If you did see it, did you consider this small change? It seems to make sense to me, not looping through all experiments for all planet on every refresh. private void RefreshExperimentCache( ) { //... some code var _vessel = FlightGlobals.ActiveVessel; //NEW var _planet = FlightGlobals.currentMainBody; //NEW // Check this experiment in all biomes on all bodies for ( int body_index = 0; body_index < bodies.Count; body_index++ ) { // Only load current celestial body if(_vessel != null && _planet != null) if (bodies[body_index].CelestialBody != FlightGlobals.currentMainBody) continue; //NEW //... some code } //... some code } Also if the code runs often (like Update() or FixedUpdate()), please consider having reference variables created outside the method, as to create less garbage.
  21. Last time I looked at the code, the fuel source was pretty hard coded.... Don't know if linuxgurugamer made any changes to that part since he took over.
  22. toolbar, you mean blizzy toolbar? I have that on, working fine... Don't know about snacks though. There might be something.
  23. I'm playing 1.4.2, and have not noticed any significant issues with x science I did not have in 1.3.1. It's the same version as I used in 1.4.1 and the same experience there. Are you sure you do not have a mod that is conflicting with it? Which version are you running. Is it the latest 5.13? My modlist
×
×
  • Create New...