tomf Posted April 20, 2016 Share Posted April 20, 2016 (edited) The KSP api has become pretty large now, with over 2000 classes, and as it has no documentation it can be a struggle to find out what anything does. There have been a couple of attempts to create community driven documentation, but they have all been difficult to update and have stalled. I present to you the KSP API Wiki It uses reflection to build up a framework of all the classes, methods, fields etc and then allows you to attach a comment to each. It also downloads the squad API documentation and includes that. It is pre-populated with the comments already created in the anatid documentation created by The_Duck Come if you want to know what the modding communities best guess of what a method does, and if there is a class that you have used that isn't documented, please help out by adding an appropriate comment. No account required. Huge thanks to @micha for providing working hosting allowing this project to continue. Edited March 19, 2018 by tomf 1.4.1 Quote Link to comment Share on other sites More sharing options...
Warezcrawler Posted April 20, 2016 Share Posted April 20, 2016 This can be great if everyone contributes! Quote Link to comment Share on other sites More sharing options...
Superfluous J Posted April 20, 2016 Share Posted April 20, 2016 As someone floundering in the morass that is learning to mod KSP, I salute you! Quote Link to comment Share on other sites More sharing options...
DMagic Posted April 20, 2016 Share Posted April 20, 2016 Ahh... GameEvents, nice choice for the image. It looks like I have a lot to update; there seem to be a huge number of new GameEvents since I last looked into it. Quote Link to comment Share on other sites More sharing options...
JPLRepo Posted April 20, 2016 Share Posted April 20, 2016 let's see if we can get it going again. Tried before with the old API that The_Duck had set-up, but with no luck. I populated some of the new GameEvents based on what I have discovered during the 1.1 pre-release as a tester. Very easy to use. Quote Link to comment Share on other sites More sharing options...
ShotgunNinja Posted April 20, 2016 Share Posted April 20, 2016 This is a wonderful idea, I did some editing in ModuleDeployableSolarPanel and will do more! Quote Link to comment Share on other sites More sharing options...
FauserneEist Posted April 20, 2016 Share Posted April 20, 2016 (edited) Are you moderating this wiki or can anybody change whatever he wants? Could you introduce some sort of markdown, to allow us to provide sample code? Edit: found the documentation in http://docuwiki-kspapi.rhcloud.com/#/about Edited April 20, 2016 by FauserneEist Quote Link to comment Share on other sites More sharing options...
ShotgunNinja Posted April 20, 2016 Share Posted April 20, 2016 I have a suggestion: detect the classes that have some documentation and make them bold in the list on the left. Quote Link to comment Share on other sites More sharing options...
tomf Posted April 21, 2016 Author Share Posted April 21, 2016 7 hours ago, FauserneEist said: Are you moderating this wiki or can anybody change whatever he wants? Could you introduce some sort of markdown, to allow us to provide sample code? Edit: found the documentation in http://docuwiki-kspapi.rhcloud.com/#/about Free editing, if it is good enough for Wikipedia on current affairs it ought to be good enough for the api for a computer game. Changes can be reverted and I could delete all changes by a given ip if vandalism becomes a problem. 6 hours ago, ShotgunNinja said: I have a suggestion: detect the classes that have some documentation and make them bold in the list on the left. Have you seen the drop-down that will filter to only show documented classes? I could make them bold too. Quote Link to comment Share on other sites More sharing options...
sarbian Posted April 21, 2016 Share Posted April 21, 2016 I like the idea but I am not a fan of the Class hierarchy. I would prefer seeing all the namespace at the start of the list instead of scrolling to find stuff like KSP.UI Quote Link to comment Share on other sites More sharing options...
FauserneEist Posted April 21, 2016 Share Posted April 21, 2016 2 hours ago, tomf said: Have you seen the drop-down that will filter to only show documented classes? I could make them bold too. It would be great for editors to be able to select "undocumented" as well. 1 hour ago, sarbian said: I like the idea but I am not a fan of the Class hierarchy. I would prefer seeing all the namespace at the start of the list instead of scrolling to find stuff like KSP.UI Or the possibility to choose between namespace or class listing. Quote Link to comment Share on other sites More sharing options...
tomf Posted April 21, 2016 Author Share Posted April 21, 2016 If you experience all the method names missing that is due to you browser caching a template that has changed. Shift-Reload will fix it. Quote Link to comment Share on other sites More sharing options...
Diazo Posted April 21, 2016 Share Posted April 21, 2016 I've added some edits, but I wanted to see how stringent we are being on confirming data. Notably I've edited the BaseAction class with stuff I've discovered on older versions of KSP, but I haven't actually confirmed it recently. The exact detail in question is that if BaseAction.active == false, the action will not execute even if you call it via code. I confirmed this back in the KSP 0.25/0.90 days and have assumed it is the case even since. Now, there have been no major changes to the actions system since then, but are we okay with adding possible stale data like that? I did tag the comment that is was an older KSP version, is that sufficient? D. Quote Link to comment Share on other sites More sharing options...
tomf Posted April 21, 2016 Author Share Posted April 21, 2016 Good question. I am going to say that anything that was true in previous versions is assumed to still be true. If you find yourself in the unlucky situation where the documentation is no longer up to date, you know what to do. Quote Link to comment Share on other sites More sharing options...
NathanKell Posted April 22, 2016 Share Posted April 22, 2016 I can't really devote time to _doing_ this per se, but if you have questions, poke me. Quote Link to comment Share on other sites More sharing options...
JPLRepo Posted April 22, 2016 Share Posted April 22, 2016 I've started dumping my copious notes into it.. Bit by bit, but focused on getting my mods working in 1.1 first. Quote Link to comment Share on other sites More sharing options...
Aerospike Posted April 22, 2016 Share Posted April 22, 2016 15 hours ago, NathanKell said: I can't really devote time to _doing_ this per se, but if you have questions, poke me. Thank you and now I'll just be the first one to poke you with something I've ran into with 1.1. In GamePersistence there are 3 overloads of the SaveGame Method. I have been using GamePersistence.SaveGame(string saveFileName, string saveFolder, SaveMode saveMode) in my plugin, since that had some documentation in the old API doc by The_Duck/Anatid and it worked just fine with KSP 1.0.5 Since KSP 1.1 "quicksaves" created that way behave differently when loaded (using stock load dialog, so no mod involved in loading): Now (in 1.1) the player is put in the Space Center Scene after loading, instead of being put in control of the vessel that was the activeVessel when the quicksave was created. So the question is: how are the other 2 overloads of SaveGame SaveGame(Game game, string saveFileName, string saveFolder, SaveMode saveMode) SaveGame(GameBackup game, string saveFileName, string saveFolder, SaveMode saveMode) different and when to use which version (quicksave in flight VS a save when in the Space Center) ? Quote Link to comment Share on other sites More sharing options...
NathanKell Posted April 23, 2016 Share Posted April 23, 2016 SaveGame(string, string, SaveMode) merely calls SaveGame(HighLogic.CurrentGame.Updated(), string, string, SaveMode) (or creates CurrentGame if it doesn't exist) Because calling Updated() sets the start scene to space center. Quicksave instead calls Updated() on CurrentGame to get a Game, then resets that Game's startScene to FLIGHT, and _then_ calls SaveGame(Game, string, string, SaveMode) directly. You should do a similar thing. Quote Link to comment Share on other sites More sharing options...
Aerospike Posted April 24, 2016 Share Posted April 24, 2016 Thank you very much @NathanKell! I've just added your information to the API wiki and will now try to implement it as suggested @tomf With a link like href="#/classes/Part?scrollTo=SomeMethodM" we can directly jump to a method in some class. But what if there are multiple overloads for a method? Is there a way to directly link to those as well? If there is SomeMethod(string) followed by SomeMethod(string, int), then scrollTo=SomeMethodM links to the first one, but how to link to the second one? When I try to add the parentheses and parameter types, the "scrollTo" portion of the link isn't working. Quote Link to comment Share on other sites More sharing options...
tomf Posted April 24, 2016 Author Share Posted April 24, 2016 No, there isn't a way to pick the overload, I wanted to keep the links relatively simple and all the overloads are going to be bunched together anyway so unless someone has written an essay in the comments then all the overloads are going to be on the page anyway. In the the text of the link you can still specify which overload though. Quote Link to comment Share on other sites More sharing options...
Aerospike Posted April 24, 2016 Share Posted April 24, 2016 Ok, no problem. Just wanted to make sure I'm not missing anything. Quote Link to comment Share on other sites More sharing options...
mbalint Posted April 25, 2016 Share Posted April 25, 2016 Great! A place where I can share my notes! Only problem is.... my tablet's browser can't load the page Quote Link to comment Share on other sites More sharing options...
tomf Posted April 25, 2016 Author Share Posted April 25, 2016 Is there any kind of error message? What tablet OS is it and which browser are you using? The page use AngularJS which is certainly designed to work on mobile devices. I didn't actually test it on one though. Quote Link to comment Share on other sites More sharing options...
JPLRepo Posted May 3, 2016 Share Posted May 3, 2016 How does the reflection of the latest Modules work? I notice it's not up to date with 1.1.2. Quote Link to comment Share on other sites More sharing options...
tomf Posted May 4, 2016 Author Share Posted May 4, 2016 10 hours ago, JPLRepo said: How does the reflection of the latest Modules work? I notice it's not up to date with 1.1.2. I needed to run the reflecting process on the server. I have run the update now. Purely out of curiosity what did you notice has changed? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.