Skip to content
This repository has been archived by the owner on Oct 26, 2020. It is now read-only.

KCT API - Looking for suggestions/thoughts #33

Open
magico13 opened this issue Jan 9, 2015 · 13 comments
Open

KCT API - Looking for suggestions/thoughts #33

magico13 opened this issue Jan 9, 2015 · 13 comments

Comments

@magico13
Copy link
Owner

magico13 commented Jan 9, 2015

I think it's about time KCT got an API, but I don't know what people would want out of it.

This currently isn't a high priority as I don't know of anyone who needs it yet, but it should be considered while I move forward along other development paths.

Some ideas of things that should be exposed/available:

  • Events for when a ship is added to the build list, finished being built, scrapped. Or parts are added to/removed from the inventory. Extend this also to general IKCTBuildItems (tech, reconditioning/rollout, and KSC upgrades/repairs)
  • Expose the inventory and part tracker systems for other mods to reference. Move these to their own separate mod (The ScrapYard?)?
  • Allow control of simulations? Definitely need to expose whether a simulation is active, when the save file is being reverted (an event?), and the various helper variables such as the total funds to take from the player when a simulation completes (used for when they buy more time, or there's another one that removes the cost of the ship).

Also, should it be a separate .dll, a wrapper class, or require a hard dependency of KCT? Or a combination, with some features available in a wrapper and the majority of the features in a separate .dll that can be bundled (with KCT or with your mod?)

What do you all think should be exposed, and especially if there's anyone out there considering integration with KCT, what do you want or need exposed?

@jwvanderbeck
Copy link

Off the top of my head, I would like to see events for PreStart/PostStart and PreEnd/PostEnd of simulations.

@jwvanderbeck
Copy link

Also maybe a way of getting at the rates, like the build rates, the R&D rates, etc, as well as being able to query the amount of BP something takes?

@johnqevil
Copy link

How about events when something is added to the build list? And I don't just mean vessels, I mean techs, parts, etc. Anything programmed to take time.

@magico13
Copy link
Owner Author

So I'll probably start adding in some basic things next major release (so, not in the update for KSP 1.0 next week). Based on feedback so far I'll definitely add:

  1. Events for items added to a build list/removed from a build list (what about when a list gets rearranged?)
  2. Events for simulation start/end. I'm going to be redoing simulations soonTM so I will add more external controls when I do that.
  3. A way to get all build rates and all settings. Those actually might go hand in hand since build rates are defined entirely in a config file.
  4. I'd like to add a "Mod Build List" where other mods can add arbitrary IKCTBuildItems to a list and define the build rates for them themselves. Additionally I'd like to make it so other mods can add things to the main build lists, but I won't promise that in the first iteration. And I'll add events for things being added/removed from that list too I suppose. That list will be hidden until something gets added to it, btw.

I'm planning on a pseudo-reflection based method (maybe a full reflection based method), so your mods will include a "wrapper" style file where you can call functions which either directly call the KCT functions or call them through reflection. It won't be that pretty, since my experience is limited, but you can take a look at the StageRecovery API (wrapper class, internal API manager) since it will work in a similar way. Do you want each function to gracefully fail if you call it without KCT installed (ie, the function checks for KCT first) or do you want to HAVE to manually check for KCT first and be forced not to call any functions if KCT isn't there. Basically, do you want me to make each function check or should I rely on you all being smart? ;)

E: Events will likely operate under the method that StageRecovery uses. In that, you just pass a function of your own that you want triggered when the event fires. See the StageRecoverySuccessEvent in the KCT_Events class, line 145 (maybe Github lets you link directly?)

@jwvanderbeck
Copy link

  1. Events for simulation start/end. I'm going to be redoing simulations soonTM so I will add more external controls when I do that.

Also an event for when a simulation is restarted please. I need a way to know when the sim is restarted so I can reset any data gained in that sim.

As for how the API works, I am not all that partial. I went overboard to make TestFlights API easy to use an robust, but I don't necessarily expect the same from others, I was just anal that way lol. In my case I will mostly just be responding to events, so a way to register a callback function is perfect.

@magico13
Copy link
Owner Author

magico13 commented May 1, 2015

I posted a poll a few days ago on what the community wants me to work on next, the API is currently in the lead, so it'll be the focus of next update. Regarding simulatons, @fingerboxes is going to be releasing a mod called HoloDeck within the next few weeks that will be replacing KCT's simulations. I'm sure he'll provide an API for that as well, which TestFlight can integrate into. If, for whatever reason, HoloDeck isn't in a working state around the time that I finish the API, I'll include simulation related events in the KCT API.

I too want the KCT API to be easy to use, but I might not provide quite as many ways of working with it as Test Flight :P

@jwvanderbeck
Copy link

Updating all my open issues and just wanted to pop in and check on this stuff.

@magico13
Copy link
Owner Author

I'm going to implement presets probably this weekend, then afterward start work on the API. Simulations will be moving out of KCT into HoloDeck once that gets to a good enough point.

With simulations being moved out of the core KCT, is there anything you still want access to? I'll likely have to release the API in stages, so if there's anything you want done first let me know. School just finished for me (but I still have work) and I believe a similar situation is true for enneract, but I expect development will kick up a bit more for both of us soon.

@jwvanderbeck
Copy link

I have a heavy workload at work as well :) I am actually refactoring my projects on GitHub to move to a weekend based sprint model, with major releases every two weekends if possible. We'll see how it goes. A little structure never killed anyone :)

I missed the public announcement of HoloDeck so I shall go there and catch up and see if anything is missing.

Thanks!

@shederman
Copy link

Did anything happen with this? I'd really like to be able to figure out sim start/end events so that I can make my mod play nice with simulations.

@magico13
Copy link
Owner Author

Simulations are being deprecated in favor of using KRASH for simulations.
If you need to interact with them i recommend talking to the KRASH author
about an API. I'm pretty much just in maintenance mode with my mods at the
moment, so nothing new is being added anytime soon.

On Sep 10, 2016 17:22, "Sean Hederman" notifications@github.com wrote:

Did anything happen with this? I'd really like to be able to figure out
sim start/end events so that I can make my mod play nice with simulations.


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
#33 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AFC21ZeEGVL2r-OkLMwQUPMR2wVU-jcyks5qox-KgaJpZM4DQhru
.

@shederman
Copy link

Okay, cool.

Hmmm, longer term I had some plans to integrate a bit more fully, having "improvement points" which could be used to, among other things, speed up construction time in KCT.

If, when I get there (which may well be never), would you be amenable to accepting a Pull Request to enable that integration?

@magico13
Copy link
Owner Author

Sure! I really want to just rewrite KCT now that I have a better idea of
what I'm doing, I just need to find the time.

On Sep 10, 2016 5:36 PM, "Sean Hederman" notifications@github.com wrote:

Okay, cool.

Hmmm, longer term I had some plans to integrate a bit more fully, having
"improvement points" which could be used to, among other things, speed up
construction time in KCT.

If, when I get there (which may well be never), would you be amenable to
accepting a Pull Request to enable that integration?


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
#33 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AFC21cPWKPjBv2Kqg4y5QQ_CHliDpNB3ks5qoyLGgaJpZM4DQhru
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants