Jump to content

Gotmachine

Members
  • Posts

    694
  • Joined

Everything posted by Gotmachine

  1. Spatial queries and Rigidbody simulation is far from being the main bottleneck in KSP. And PhysX is actually decently multithreaded. There are definitely some inefficiencies both on the Unity side, which doesn't expose some very useful parts of the PhysX API, but mainly on the KSP implementation side. But all in all, RB and collider physics are objectively the most optimized part of KSP, taking 15-20% of the frame time in part count constrained scenarios. The single-thread bottleneck has no main culprit, it's a combination of an inadequate general architecture and of tons of tiny or not so tiny inefficiencies in all subsystems. This being said, the main issue with physics in KSP is that a solver primarily made to simulate ragdoll physics is wholly inadequate for the task of simulating a rocket structural integrity. And it can even be argued that the idea of simulating structural integrity out of RBs whose shape and mass is primarily defined by function is a silly idea in the first place.
  2. This sentence, my friends, is the best summary of the 40k+ posts in the KSP 2 subforums. Sorry for the interruption, could not resist. Keep going.
  3. I don't think OP said anything about random part failures, but about part reliability. Part operational lifetime limits is to unmanned missions what life support is to manned mission, a way to introduce mission time as a gameplay element, they go hand to hand to build a game mechanism introducing both more depth and more realism to a contemporary spaceflight, more real life grounded playstyle. KSP is a relatively casual, goofy rocket and orbital mechanics game. That doesn't mean there isn't any room for something else in the subgenre.
  4. I guess the piece of code you're showing is just for testing purposes, but you can't do what you're doing from a KSPAddon, because FlightGlobals.ActiveVessel will change when switching vessel, docking, undocking, etc You need to either use a VesselModule, or alternatively to manage you callback registrations by pooling the active vessel list (technically you can also use GameEvents, but there are many corner case to handle with that approach).
  5. Nobody has a source on that. But RSS and RO are in the top 10 downloaded mods on CKAN. "Real rockets" part mods like BDB and Tantares are also hugely popular. System rescale mods or larger system scale mods like JNSQ or KSRSS, quite popular too. "Simulation" mods like TAC-LS or Kerbalism are also still quite sought after, despite being essentially abandoned. If you look at KSP youtube videos produced and views or discord servers populations, you can see that there is quite some interest for "more simulation". Yes, there is definitely a greater potential playerbase for a more casual game, that's exactely what I said. But it can't be so easily dismissed that a large part of the success of KSP is due to the enthusiasm and dedication of the hardcore space nerds. Beside, the Orbiter comparison is irrelevant. Orbiter is a simulation, not a game. I never said KSP 2 shouldn't be a game, just that it could have had more real-world and contemporary scope. Anyway, the point is that I just wanted to expand on OP statement : You're definitely not alone.
  6. I've been saying this since the start. An interstellar scope KSP fundamentally changes the granularity of the simulation and of the game, there is no way around that. I think it's a good move for making the game a large commercial success. A less directly exposed simulation with more gamey mechanics featuring shiny science-fiction stuff is what attracts crowds, and if the devs did the job at least half right, it will definitely be fun to play. But there is a relatively large proportion of the KSP1 playerbase that are here for the "simulation" side. The KSP franchise is the only game that provide a relatively decent spaceflight/rocket simulation, and a lot of people are here because they are spaceflight nerds, not because they want to play a space game. Now, objectively, stock KSP 1 doesn't offer much on that front, but if you look closely at the modding community, a large proportion of it is about real world, historic and contemporary era spaceflight. And there is a lot of interest for real world constraints like more realistic system scale and overall part balance (including real world rockets/missions), and simulation-leaning implementations of features like fuel boiloff, tank ullage, thrust limits, engine ignitions, components reliability, life support, radiation, ISRU, comms, science, etc. To a lot of long time KSP 1 players having used mods extensively, the feeling of stock gameplay is that you're playing with toy rockets in a toy system. And that aside of the delta-v equation and orbital mechanics, you're not really facing any of the "real" challenges of spaceflight. And for those players, stock KSP 2 won't offer anything more than stock KSP 1, apart from a (welcome) technical/graphical upgrade. Time will tell, but long term I'm relatively confident that a segregationist "de-interstellarized" KSP 2 modding ecosystem leaning toward contemporary spaceflight will emerge. Speaking for myself, I think they could have made KSP 2 a slightly more simulation leaning game than KSP 1 without that interstellar scope and it would still have been a success. A world setting a la "The Expanse" with a slightly more realistically scaled system and featuring more planets, moons, comets and asteroids would have been very appealing to a lot of people, I think. But well, other stars and sci-fi colonies we shall have. To me, it seems early on they got quite stuck in the "we must keep/reuse everything that exists in KSP 1" safe zone. At least they dumped science/career mode.
  7. I won't go into that pointless debate. Low level modern C# is just as fast as low level modern C++. High level "usual" C# code tend to be slower than equivalent "usual" C++ code because the BCL abstractions are much higher level and offer handy features like automatic exception handling, managed memory and some level of thread safety. If you choose to deliberately to get ride of those high level features (which you can in modern .NET), C# code becomes again in same ballpark as C++. Edit : actually, did you look at the results on the GH repo you linked ? The fastest C# implementation (very low level) is 34% faster than the fastest C++ implementation. The "normal" C# implementation ("tannergooding") is twice slower. Which kinda illustrate my point nicely. I suspect that a middle-ground C# implementation not resorting to unsafe code but using .NET6/7 low level constructs would be roughly equivalent as C++.
  8. Nope. CLR and CoreCLR aren't and never were interpreters. Only Mono has (had ?) an (optional) interpreter, which isn't used in Unity. They fully compile the whole application on startup, with the downside being a vastly increased start delay. Which is why stuff like NGen or NativeAOT existed, and why CoreCLR has introduced tiered compilation where jitting is initially done with a minimal amount of work done on optimizations to get quick app startup, then it takes some times to do some deeper analysis and re-jit identified hot paths. The compact framework JIT is a bit different and does on-demand jitting, not compiling stuff until it actually used. The micro framework JIT however is an interpreter, but it's almost a completely separate product. Nope. Unity has forever been using Mono.
  9. Nope, Unity uses (a custom fork of) Mono on all platforms. And IL2CPP performs very marginally better than Mono in terms of execution speed. The main reason it exists is because it allow Unity games to run on platforms where JIT VMs aren't allowed (namely iOS), but it also has the advantage of producing a smaller distribution and using slightly less memory (because it strips unused BCL classes and doesn't need the JIT VM), which is relevant on mobile platforms in general. CIL is not statically interpreted. That's not how the JIT works. It is compiled to assembly when the application start. Which means that technically, you can get as much performance from C# as in C or C++. C# in practice is (slightly) slower than equivalent C++ code because of the overhead of the high level constructs of the BCL and of the GC. But at least on modern CoreCLR, if you desire so you can get quite close to the metal with the most low level C# constructs and get similar performance as C/C++.
  10. I'm quite skeptical. For that to work, you also have to create bindings for all types used as a parameter or return type, and consequently bindings for the methods in those types too. That mean a huge proportion of the BCL and Unity API surface. In a way or another, you have a ton of work to do if you want to expose a vaguely useful LUA modding API. While we have zero confirmation that LUA modding exists, we have a lot of confirmation that C# modding exists, and there is technically no way to do such sandboxing if they allow C# modding. And frankly, if they try, it would be a deal-breaker and a major failure on their "KSP 2 will be at least as moddable as KSP 1" statement. I can guarantee you that the first thing the modding community would do is to move on to BepInEx or similar and build it's own C# based no strings attached modding ecosystem. By definition, modding doesn't want to limit itself to what the developer has made. If you read carefully what was reported by Snark in 2019, I think the likely scenario is quite clear : embedded LUA scripts in config files in order to be able to define custom logic within the scope of the configured subsystem and its specific functionality. This seems like a very sensible choice to me, but extending that to a general purpose modding API that cover the full KSP (and consequently BCL & Unity) API surface seems a total waste of resources for very questionable benefits. Hu, what ? C# is compiled to machine assembly, it's not interpreted on the fly. Lua can either use a static interpreter reading byte code, or be compiled to machine assembly too. Either way, in practice, Lua mods would be much slower than C# mods. Not so much because it is intrinsically slower (which it is), but mainly because of the overhead of calling into the C# API while mutating the methods parameters on every call. The overhead here would be very significant.
  11. This is a lot of extrapolation. So, yeah, this just confirms that those LUA bindings still existed in february and are still used for internal developments. For reference, this is the only source we have (it's actually from 2019) : I see very little incentive for them to put together a whole user facing LUA-based modding API and framework, when thanks to the game being an Unity game they basically get full modding support for "free". What I realistically envision is some level of LUA embedding for specific configuration files use cases. Being able to have a fully functional programming language at the config files level can be very useful in some situations. There are many KSP 1 mods that provide in one form or another some level of logic embedding in config files (ModuleManager and ContractConfigurator for example). But anything is possible. Indeed, if they already have most of the LUA bindings they (we) need already in place and have used them in production for some final configuration systems, the gap to a LUA based modding framework might not be that much extreme, although the API coverage needed to be able to do anything useful is quite huge. It doesn't only need to cover the KSP API, but also large chunks of the Unity API. A LUA modding framework would maybe somewhat lower the perceived barrier of entry to modding (although if this is actually good is debatable). There are some possible benefits like hot-loading (to be fair that's also possible with C#), but there are many downsides. Beside API coverage limitations, LUA is slow, it's a very barebone language with a very barebone standard library. My opinion is that it would make modding harder, not easier, and without putting words in others mouth, I doubt any serious KSP 1 modder would disagree on that. Overall, my feeling is that this is a lot of work for the game devs and not that much benefits for the modders. As a modder, if I were to choose what I want, I'd rather have a good built-in CKAN/ModuleManager than a redundant LUA modding API. Don't get me wrong, having a scripting language with good API coverage would be an interesting feature. It would basically mean that KSP 2 has a built-in KOS, or at least something quite close from it, and that opens up a lot of possibilities if the LUA system itself is correctly exposed from the C# API.
  12. Nothing was ever confirmed regarding LUA modding. All we know is early 2020 tidbits from one random guy on the KSP 2 team. Who was saying that they had experimental LUA bindings on top of the C# API used in the context of some internal prototyping tools, which may or may not be used in the final product.
  13. RP-1 has it's own persistent rotation feature and is incompatible with PR. but is supposed to disable itself in the presence of PR.
  14. No. There are a few new modules like the inventory/cargo stuff, but they have near zero impact. That's not what I meant by "global overhead". What I meant is that for many methods, the exact same code seems to be executing slower in 1.12 than in 1.10.
  15. These messages are "normal", and would happen in stock KSP too. This happen because all your mods are adding non-stock modules to stock crafts. This being said, the log entries should probably not be emitted as warnings.
  16. I understand your point of view. I'd say that 20% is an absolute worst case scenario for a 650 parts vessel basically doing nothing in the least performance intensive situation. In more real-world performance heavy scenarios (atmospheric flight, active attitude control/engines, stuff running in the background, mods adding their own overhead, etc), that difference will become much lower and likely unnoticeable as the fixed overhead is dwarfed by other things that are just as heavy no matter the KSP version. In fact, I just tested a random craft file from KerbalX and got actually better FPS on 1.12 just because that ~500 part ship had a few converter parts, and those have perf issues on 1.10 but not on 1.12. I'm trying to think about what could be causing that global overhead. While the differences are measurable and consistent, there is always the possibility of some measurement bias, although I'm relatively confident in my methodology. Here are some compiled results : Hard to say what is at play here. Diffing some of the methods showing significant degradation, there are some methods where null checks against Unity objects were added, which can be somewhat expensive, but some methods are strictly identical between 1.12 and 1.10... But yeah, I need to do the same tests against other KSP versions Maybe. I guess the bulk of the overhead comes from the call to Part.isKerbalEVA(), which could be partially optimized. The above graph show other potential optimizations, like preventing SuspensionLoadBalancer to run when not landed,
  17. That's a strong statement. It's extremely difficult to make reliable performance measurements between different runs without automated benchmarks that reproduce exactly the same configuration and sequence of inputs. This being said, I'm somewhat able to reproduce what you're seeing, although not as dramatic as the 27% FPS difference you're showing in your screenshot. Using your craft file, I can reliably measure a 4-5ms per frame overhead on KSP 1.12 vs 1.10 (for a frame time of ~45ms). In practice, this mean a 0 to 20% drop in terms of FPS, depending on the baseline. This can partly be explained by new features. With your craft, Part.FixedUpdate() call time has jumped from ~0.65 ms/frame to ~1.22 ms/frame due to the new kerbal mass system. There are likely a few other methods that increased in complexity slightly, resulting in some fixed overhead in newer KSP versions. More surprising, there is also a consistent and repeatable overhead (about 5% overall) in many top level method calls, including methods that haven't changed at all between KSP 1.10 and 1.12. I'm not sure how to explain this apart from some global regression at the Mono/Unity level when KSP was upgraded to Unity 2019.4.18 for the 1.12.0 update.
  18. Thanks for the report. I managed to reproduce this on KSP 1.10, but not on 1.12, so this is caused by some differences in the stock robotic code between those versions. The RoboticsDrift patch is developed against KSP 1.12, I have a few other robotics related issue reports lying around, and I suspect at least some of them are caused by minor differences between KSP versions. I don't really have time (nor willingness) to investigate and fix such version-specific issues, so I will just disallow the patch to run on KSP versions prior to 1.12. The error you're getting is indeed caused by some mod uncorrectly managing resources, so "whatever adds this" is indeed the likely culprit. I would suggest finding which mod it is and asking on the forum thread for this mod, or to post in the "Technical Support (PC, modded installs)" forum, this has nothing to do with KSPCommunityFixes.
  19. Doing that will have the side effect of having KSP running from the wrong working directory. In stock KSP, the only likely side effect will be that the KSP.log file will be generated in the "PDLauncher" directory, but this will definitely cause cascading side effects on various mods. While you can specify a different executable in the Steam command line, you can't set the working directory, which is hardcoded to the "PDLauncher" directory. This being said, the proper workaround is to have Steam pointing at a shortcut instead of KSP_x64.exe : - Open your KSP root folder (In Steam, right click on the game > Browse local files). Usually this will be "C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program". - Right-click on KSP_x64.exe > Create shortcut - Rename the shortcut to "KSP_x64_Steam" - In Steam, open the game properties, and in the "Launch Options" field, put the path to the shortcut between quote, with : "C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Steam" %command% This will launch the shortcut instead, with the correct working directory.
  20. People are having that issue because they are trying to bypass the launcher by adding an extra command line option in steam to start a different executable than the launcher. This is what I have seen suggested : "C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64.exe" %command% This doesn't work because the executable working directory will still be set to the "PDLauncher" subdirectory, causing cascading issues all around. A workaround is to make a shortcut to KSP_x64.exe, let's say I'm renaming it "KSP_x64_Steam". Then in the steam command line options, point to that shortcut : "C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Steam" %command% This will launch the shortcut instead, with the correct working directory Said otherwise, the only issue here is people making a mess on their own by following random bad advice on the internet.
  21. Good idea. I don't have the time or motivation to implement this, but suggestions are welcome nevertheless Well, don't have much time either. The few "kraken fighting" patches in KSPCF are far from a definitive or reliable fix. KSP will forever stay prone to such events, and there might be indeed corner cases where KSPCF is doing more harm than good. This being said, if you can reliably reproduce a case where the same craft has issues when the PartStartStability patch is enabled, and is working fine when the patch is disabled, please provide the craft or save file. Please try to reproduce this in a stock install. There is a large probability this is caused by a mod. And if you manage to reproduce it, please provide your Player.log file (see https://forum.kerbalspaceprogram.com/index.php?/topic/83212-how-to-get-support-read-first/) It is fixable with a mod, but it would be a behavior change that has a significant chance to affect other mods in unexpected ways, so KSPCF isn't the right place for that. Same response. KSPCF doesn't change stock behavior like this one to avoid messing with what other mods are expecting. This is something that you can and should handle from your own mod.
  22. This data doesn't exists, not under a serialized (ConfigNode) form. KSP holds its data in various subsystems, most of it is easy to get from various static accessors or fields in singleton top level classes. For vessels (and everything they are made of) and bodies, you have FlightGlobals, for Kerbals you have KerbalRoster. Some other relevant top level classes are all subclasses of ScenarioModule, like ResearchAndDevelopment, ScenarioUpgradeableFacilities, Funding, Reputation, ContractSystem...
  23. I'm just another modder. Lets just say that we have ways to see what is happening exactly under the hood.
  24. It's quite simple. Part.buoyancy is the per-part equivalent of PhysicsGlobal.BuoyancyScalar (which you can tweak in Physics.cfg). In short, the formula for the magnitude of the force applied on a part by water is (physically "accurate" result derived from the drag cube and part mass) * PhysicsGlobal.BuoyancyScalar * Part.buoyancy. Default value for PhysicsGlobal.BuoyancyScalar is 1.2 (to account for the fact that stock parts are way too dense). Part.buoyancy default value is 1, and is sometimes tweaked up or down on stock parts to account for even sillier densities. In the context of rescaling a part, assuming both the drag cube and mass scaling are accurate, density is staying equal and nothing else is needed. Messing with Part.buoyancy mean that you're altering the part density, which is obviously wrong. I haven't read the whole convo in detail, but part.buoyancy set aside, if as @damerell suggested TS is only scaling the drag cube area and depth (and not size), it's no surprise that effective buoyancy results are inaccurate, as the formula make extensive use of the drag cube size. EDIT : to ensure a scaled part is keeping the same density, one can check the Part.partBuoyancy.displacement value. This is the intermediate result of the drag cube/mass computations before any "cheat" is applied (BuoyancyScalar/buoyancy), aka the "physically accurate" density of the part. Ideally, it should stay the same no matter the part scale.
×
×
  • Create New...