KontrolSystem2 icon indicating copy to clipboard operation
KontrolSystem2 copied to clipboard

Coding without running the game

Open versvisa opened this issue 1 year ago • 2 comments

Often I go in a loop of

  • Change code
  • Run compiler
  • Run unit test
  • Repeat

During that time KSP2 will run happily in the background, burn 200 W of power for no reason and heat up my room. It would be even more without a third party tool to cap the FPS. Sometimes I manually suspend the KSP process, but that is cumbersome.

I would appreciate a solution, maybe a standalone test runner. Or maybe there is a third-party solution to automatically suspend KSP2 when in the background? I have not found anything.

versvisa avatar Apr 30 '24 18:04 versvisa

I have to admit it's one of my wet dreams, but I didn't dare to ask for since I assume it implies to have a sideparty executable which could be frown upon the mod community. So I stack numerous hours on KSP² not for flying or building, but doing same loop as you :)

lefouvert avatar May 01 '24 14:05 lefouvert

As for running unit-tests without the game: There is this Xunit test that runs all the unit-tests of the std:: modules: https://github.com/untoldwind/KontrolSystem2/blob/master/KSP2Runtime-Test/TO2StdTestSuite.cs

This could be easily converted into a standalone executable ... or, if one wants to go nuts: Converted into a standalone WASM lib to be integrated into the VSCode extension (mostly because I am somewhat interested in the state of the dotnet->WASM/WASI stack ...)

But: This would be rather limited. The bulk of the code depends on the underlying Unity-GameObjects, which most likely will not behave properly without the actual game. For the orbit calculations I kind of "solved" this by providing my own mock-implementation of a Kepler-orbit + taking the orbital parameters of the Kerbol system from the KSP1 wiki. I am not sure if the same could be done for ... let's say the Vessel.

As for "pausing" the game: I am not sure the pssuspend command will work on the game. But at least it should be possible to lower the process priority via the task manager or with some PowerShell magic

untoldwind avatar May 03 '24 07:05 untoldwind

This issue is stale because it has been open for 60 days with no activity.

github-actions[bot] avatar Jul 03 '24 02:07 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jul 17 '24 02:07 github-actions[bot]