Jump to content

Untoldwind

Members
  • Posts

    39
  • Joined

  • Last visited

Reputation

33 Excellent

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. A good starting point are the scripts in the `BepInEx/plugins/KontrolSystem2/to2` folder. E.g. the minimal script to launch a rocket is `BepInEx/plugins/KontrolSystem2/to2/launch_rocket.to2` which just looks like this: use { Vessel } from ksp::vessel use { CONSOLE } from ksp::console use { atmo_launch } from std::atmo pub fn main_flight(vessel: Vessel, target_apoapsis: int = 100000, low_turn: float = 0.007, high_turn: float = 0.7) -> Result<Unit, string> = { atmo_launch(vessel, target_apoapsis, 90, low_turn, high_turn)? } `atmo_launch` itself is just a function that can be found in the `BepInEx/plugins/KontrolSystem2/to2/std/atmo.to2` file. You can just tweak those in place or copy them over to the to2Local folder to create your own variants. As long as the `use` does not start with `ksp::` or `core::` it usually refers to another to2-file in the to2 or to2Local folder. The `ksp::` and `core::` packages are build-in and are documented here: https://kontrolsystem2.readthedocs.io/en/latest/reference/index.html But you are right, there probably should be a more structured getting started guide.
  2. This was a tricky one. The compilation of the to2 scripts is done in a background thread to interfere with the game-loop as little as possible. Turns out that the BeInEx logger is not thread-safe ... or more specific, the log-console handler of spacewarp might create a dead-lock if logs are created outside the main thread. Anyway: This should be now fixed with the 0.4.2.2 version. PS: Flipping these two lines will fix the compilation errors: https://github.com/appenz/kerbal2/blob/9b26c6f49f75098993e32aca6e180aec0a3b53b7/glib/landing.to2#L38-L39
  3. There have been quite some updates to SpaceWarp in the last weeks. I did a reinstall with these versions (from SpaceDock): SpaceWrap_BepInEx 1.3.1 UITK_for_KSP2 1.4.1 (required by SpaceWrap) KontrolSystem2 0.4.2.1 This works for me. Special note for linux players: The zip file of UITK_for_KSP2 has incorrect access flags of its assets folder, so you have to do a "chmod 755 BepInEx/plugins/UitkForKsp2/assets"
  4. That error indicates might indicate a stack overflow, which can indeed freeze the game engine. I will take a look if that can reproduce that. I will join, but will not be online that often. Problem is that I already have to use multiple messenger apps for work and that is only so much that fits on a screen
  5. Please try out the 0.0.7 (pure coincidence) version of the vscode extension: https://github.com/untoldwind/KontrolSystem2/releases/download/v0.4.2/to2-syntax-0.0.7.vsix All the versions before that had multiple issues concerning type-inference. Initially the window should have two section (both empty). When you collect data in one of your script (e.g. run the simple-example once) some time-series should appear on the right side that you can select. The general idea is that you should be able to define your own telemetry data you need to solve a specific problem. ... though it actually might be a good idea to have some predefined data collectors (like height, velocity, thrust, weight etc.) that you can just activate in UI. I will put it in the wishlist
  6. Sorry, I was on vacation for a bit. I will try to catch up over the weekend. In the meantime I release version 0.4.2 (https://github.com/untoldwind/KontrolSystem2/releases/tag/v0.4.2) which should be compatible with 0.1.3.0 Please note: For the menu item to appear it is also necessary to update SpaceWarp to >= 1.3.0 (which in turn now has a dependency to UitkForKsp2)
  7. The final circularize/exec_node part after the launch still has issues, mostly because maneuvering node calculation is done slightly different in KSP2 (especially for longer burn times). I am still wrapping around my head around that one. In the mean time you can try tweaking the "high_turn" value as well. If you lower it to 0.6 or 0.5 the rocket will tilt sooner on ascend so that less delta-v is required for circularization.
  8. Ad 1: I still have to wrap around my head about that one. The technical side mostly straight forward, the problem though is that either the plugin has to open a listening port for that or connect to some other network service and I'm not sure about the policies for mods from the side of the game developers are in this regard. (You may remember that kOS had a lengthy confirmation dialog for this to conform to the policies in KSP1 ... and this kind of thing can mess with the networking for multiplayer big time). My current plan is to do this in a separate mod that can be installed in addition to KontrolSystem2 ... so if that one gets banded for a breach of policy (or something) it will not jeopardize the entire project. This would also be a nice opportunity to add something of an "official" API for the mod for others to use. Ad 2: I'm currently working on improving the VSCode plugin to give more detailed (and direct) feedback to write scripts, this should help with getting started. As for direct tutorial videos, I'm not aware of any (it's all pretty new after all). The syntax of TO2 was mostly inspired by Rust and Typescript. The former I can not recommend to get into programming, Rust is a very complex language that requires quiet some experience to get used to ... and some extra time to actually appreciate it. Typescript on the other hand might be a good starting point and its pretty useful a more an more web-projects are using it- There should be plenty of videos around to get started with that one. If you are entirely new to programming though ... that is still a tough one. I probably would start with something like golang or python, which both have a rather simple syntax. Personally I started with Basic and Pascal ... but that was a long long time ago Ad 3: So far we only had 2 patches, the first one had no compatibility issue whatsoever, the second just a minor one that I was able to fix in 5 minutes or so. It certainly will be different once we get a feature patch. Ad 4: The 0.4 pre-release is currently on probation, which allows creating your own UI. I'm still testing that one and probably make it the primary version next week. After that it probably will be mostly about expanding and improving on the already existing features for a while. As laid out in my answer to (1) maybe it is not the best idea to pack all the features into a single mod.
  9. I release 0.3.6 and 0.4.0.2 (pre-release) which has a binding for FlightPlan * https://github.com/untoldwind/KontrolSystem2/releases/tag/v0.3.6 * https://github.com/untoldwind/KontrolSystem2/releases/tag/v0.4.0.2 Short example to test it out: use { Vessel } from ksp::vessel use { flight_plan } from ksp::addons use { CONSOLE } from ksp::console use { current_time } from ksp::game pub fn main_flight(vessel: Vessel) -> Result<Unit, string> = { const fp = flight_plan().ok_or("Flight plan not available")? CONSOLE.print_line("FP: Version " + fp.version) fp.circularize(current_time() + 300) } ... probably needs a bit of polish, but this could serve as a template how to add optional dependencies.
  10. Hello,

    as you suggested, I took a brief look at FlightPlan.

    I guess everything below this line: 

    I took a brief look a FlightPlan.

    I suppose everything below this line: https://github.com/schlosrat/FlightPlan/blob/c0431bb3ce4c18de62e2ac74367d26db09a395a5/FlightPlanProject/FlightPlanPlugin.cs#L956
    Is up for external usage.

    It should be pretty straight forward to create bindings for those functions. The hardest part is probably to make that an optional dependency.

    1. schlosrat

      schlosrat

      Yep, those are the public methods. I’ve got some info in the README.md on how to call them, but that’s down at the end of that file

    2. schlosrat

      schlosrat

      If you look at the README.md you'll find info on how to setup FP as a soft dependency so you can check to see if it's there and then if it is you can call it's public methods via reflection methods.

      Also, if FP is loaded, then Node Manager should also be loaded and it's methods can be called similarly.

      Also, both are available as nuget packages, so you can access them that way just like SpaceWarp and BepInEx so you don't even need to have their DLLs in your external_dlls folder.

  11. I am still trying to figure out how "Control from here" is working internally and how exactly it changes the "control_frame" of the vessel. ... so yes, it is a bit buggy in this regard. As for problems with the launch script: This is really hard to reproduce, is there a way you can provide the vessel you are testing with.
  12. Thanks for the praise. 1), I totally agree that there should be something of a "legend" to the diagrams. I will eventually fix this in the 0.4 trunk (as pretty much everything UI related has changed under the hood ) 2) In 0.4 I already added an option of tweak the size of the console font (as well as the font itself), it should be possible to do that for the standard UI font as well (though I'm currently using the Bepinex configmanager, which is somewhat clunky) 3) ... that should (hopefully) work now in 0.4 And I will certainly provide an API for other mods to use, though this probably has to wait until there is something of an "official" mod support. I currently only own the Steam version, so this is kind of guesswork: As far as I know BepInEx is pretty generic and should work with any Unity based game. The main trick though is the "winhttp.dll", which is a wrapper for the real "winhttp.dll", the idea is that Unity needed to do something http-related, therefore has to load the "winhttp.dll", which then serves as a "Backdoor" for BepInEx to modify the game at a very early stage of the loading process. Here are some things to check: * "winhttp.dll" has to be in the same folder as the KSP2_x64.exe executable (because DLLs are first searched there) * Try to run KSP2_x64.exe directly (if possible via commandline in the game directory) If it still is not working: There is a BepInEx "Hardpatcher", which alters the executable itself. Presonally I'd only use that method if there is really no alternative. From the technical point of view: If there will an be internal API for mods in different game clients to send arbitrary messages to each other ... sure, why not.
  13. The last days I had a tunnel-vision to prepare the pre-release of 0.4.0, which will introduce an UI overhaul. Here is a short demonstration video how it looks like: The pre-release is currently only available on github: https://github.com/untoldwind/KontrolSystem2/releases/tag/v0.4.0 Documentation of the new ksp::ui module can be found here: https://kontrolsystem2.readthedocs.io/en/ui_rewrite/reference/ksp/ui.html And all the example scripts used in the video here: https://github.com/untoldwind/KontrolSystem2/tree/ui_rewrite/examples/ui_demos
  14. Please check "C:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program 2\BepInEx\LogOutput.log" for errors. I noticed that there is now a dependency to SpaceWarp 1.1.3 (most likely because I recently updated to that version myself). I will check if that can be downgraded a bit.
  15. It probably would be a good idea to separate the `std::` lib (i.e. all the stuff in the `to2` folder) from the mod itself and move it too its own repository. This is most certainly on my wish-list as well. I have some old versions that where kind of working for KSP1: https://github.com/untoldwind/KontrolSystem/tree/master/GameData/KontrolSystem/to2/std/rendezvous But these will most certainly need some tweaking to work with the current version.
×
×
  • Create New...