Cephei Posted March 4, 2012 Share Posted March 4, 2012 If you have a question regarding the programming part, or anything really, i\'m sure there is someone out there that can help you. You don\'t have to make a new thread for a simple question, just post it here Quote Link to comment Share on other sites More sharing options...
Splendid Posted March 4, 2012 Share Posted March 4, 2012 Great thread, I will use this frequently if you guys don\'t mindusing public override bool RequestFuel, however an error is returned:'not all code paths return a value'No idea what it means. Quote Link to comment Share on other sites More sharing options...
mukut1994 Posted March 4, 2012 Share Posted March 4, 2012 Great thread, I will use this frequently if you guys don\'t mindusing public override bool RequestFuel, however an error is returned:'not all code paths return a value'No idea what it means. i dont think anyone else (except devs and mods) know eitherthis thread will have 150% more people posting once the docs are up. before then no one will even really bother writing anything...so i guess we\'ll just have to wait for now patiently for the big bang of new parts appearing out of nowhere ;Phey anyone wanna team up with me?? i can write c++ (and c# doesnt look that different) but i have no clue about 3d designing and all thatwould like to make some parts though and if you dont know programming.... Quote Link to comment Share on other sites More sharing options...
Splendid Posted March 4, 2012 Share Posted March 4, 2012 i dont think anyone else (except devs and mods) know eitherthis thread will have 150% more people posting once the docs are up. before then no one will even really bother writing anything...so i guess we\'ll just have to wait for now patiently for the big bang of new parts appearing out of nowhere ;Phey anyone wanna team up with me?? i can write c++ (and c# doesnt look that different) but i have no clue about 3d designing and all thatwould like to make some parts though and if you dont know programming.... Haha, that\'s OK.I guess we\'ll wait for Cephei, he might know. Quote Link to comment Share on other sites More sharing options...
Cephei Posted March 4, 2012 Author Share Posted March 4, 2012 Great thread, I will use this frequently if you guys don\'t mindusing public override bool RequestFuel, however an error is returned:'not all code paths return a value'No idea what it means. not all code paths return a value refers to the method requiring a bool return ( meaning either true or false ). the game later checks this value to determine if the fuel request was successful and if not shuts down the engine that requested it for example. you have to make sure that all possible execution paths ( the paths that the code can take inside the method ) end with returning either true or falsebefore then no one will even really bother writing anything...*cough* http://kerbalspaceprogram.com/forum/index.php?topic=7847.0 Quote Link to comment Share on other sites More sharing options...
mukut1994 Posted March 4, 2012 Share Posted March 4, 2012 *cough* http://kerbalspaceprogram.com/forum/index.php?topic=7847.0ok....i posted it over there and im gonna say it again...how the kerbal did they find all the methods and calls??? S:| Quote Link to comment Share on other sites More sharing options...
swebonny Posted March 4, 2012 Share Posted March 4, 2012 I got one question. How does making the source code public prevent malware .dlls? I could likewise just exclude the bad parts of the code. I suggest changing the guidelines to include your whole plugin project, just to be one the safe side. Quote Link to comment Share on other sites More sharing options...
Cephei Posted March 4, 2012 Author Share Posted March 4, 2012 I got one question. How does making the source code public prevent malware .dlls? I could likewise just exclude the bad parts of the code. I suggest changing the guidelines to include your whole plugin project, just to be one the safe side.it doesn\'t, it\'s for people who want to compile the plugin themselves, if it doesn\'t work then you can assume that there is something wrong Quote Link to comment Share on other sites More sharing options...
Iskierka Posted March 4, 2012 Share Posted March 4, 2012 The argument of including the whole project also doesn\'t work, by the fact they could simply show you a project with offending code removed ... Quote Link to comment Share on other sites More sharing options...
ForumHelper Posted March 4, 2012 Share Posted March 4, 2012 Where can I get OnActivate() and other functions\' documentation? Is it even available at the moment? Also, is SharpDevelop or MonoDevelop worth getting if I want to start making my parts? Quote Link to comment Share on other sites More sharing options...
swebonny Posted March 4, 2012 Share Posted March 4, 2012 The argument of including the whole project also doesn\'t work, by the fact they could simply show you a project with offending code removed ... My brain is a few steps behind everything that\'s happening. Quote Link to comment Share on other sites More sharing options...
ForumHelper Posted March 4, 2012 Share Posted March 4, 2012 The argument of including the whole project also doesn\'t work, by the fact they could simply show you a project with offending code removed ...Best option would be to provide code only, without compiled dll file. Everyone interested would have to do it alone. Quote Link to comment Share on other sites More sharing options...
Hojo_Norem Posted March 4, 2012 Share Posted March 4, 2012 Best option would be to provide code only, without compiled dll file. Everyone interested would have to do it alone.Bit of a long shot here but what chance would there be of including a compiler into KSP itself? Distribute plugins as sourcecode and have KSP compile them the first time they are run?Then again I dare say that implementing that would be more effort than sandboxing the the plugin system so filesystem access for the plugins would be limited to a directory inside the KSP directory structure and limit plugin\'s ability to access external API calls. (Not all of them tho. I want API access to the Windows Joystick routines to bypass Unity\'s not-fit-for-purpose excuse for joystick handling) Anyhoow, while I\'m typing I might as well ask a few questions of my own:1: How is input in KSP handled? I\'m guessing that the user input and the input fed to the rocket are separate things and that KSP does some kind of stuff in-between. I suppose a way to describe what I am asking is does KSP have some sort of virtual joystick (ie the one inside the command pod) that is controlled based on user input? Can I write code that can alter the input handling behaviour?2: How is code actually executed in game? Not counting initialisation and clean-up code how does the \'meat\' run? Is there a function in the plugin that can be called once per physics frame or similar? Is the plugin code run paralel to the game (multithreaded) or sequentially? (eg, a badly coded plugin in a endless loop freezing the game)3: Documentation? I have been watching the forums like a hawk for ages now and in the absence of any documentiaiton of the game\'s APIs how comes we already have people writing plugins with new parts with new fuel types and GUIs and autopilots. Unless I am going blind, or senile, or both! Anyhoow, once I have given myself a crash course on C# I plan on making my contribution to KSP, a command pod with a (near) fully functional 6502 based computer built into it. Code your software in 6502 asm, for C use CC65 or load in a EhBASIC image to code like its the 80s 8) Quote Link to comment Share on other sites More sharing options...
N3X15 Posted March 4, 2012 Share Posted March 4, 2012 The argument of including the whole project also doesn\'t work, by the fact they could simply show you a project with offending code removed ...There are still ways to inspect such assemblies. Quote Link to comment Share on other sites More sharing options...
Emilio Posted March 4, 2012 Share Posted March 4, 2012 Just a little question : What are the conditionss to use (i mean : When this happens-->do this) ?I seen OnPartActivate, OnPartAwake, OnFlightStart, OnDecouple, what are the others ? Quote Link to comment Share on other sites More sharing options...
N3X15 Posted March 4, 2012 Share Posted March 4, 2012 Just a little question : What are the conditionss to use (i mean : When this happens-->do this) ?I seen OnPartActivate, OnPartAwake, OnFlightStart, OnDecouple, what are the others ?If you\'re using Visual C#/Studio, just type override and press space, and it\'ll give you a list of stuff you can override. Besides that, you have to wait for Squad\'s code documentation. Quote Link to comment Share on other sites More sharing options...
swebonny Posted March 4, 2012 Share Posted March 4, 2012 3: Documentation? I have been watching the forums like a hawk for ages now and in the absence of any documentiaiton of the game\'s APIs how comes we already have people writing plugins with new parts with new fuel types and GUIs and autopilots. Unless I am going blind, or senile, or both! I\'ve heard all from 'wait' to 'a few days' and 'weeks'. I\'m hoping for a few days :V Quote Link to comment Share on other sites More sharing options...
N3X15 Posted March 4, 2012 Share Posted March 4, 2012 I\'ve heard all from 'wait' to 'a few days' and 'weeks'. I\'m hoping for a few days :VThe compile docs are up. The code docs will be up soon. I don\'t have a specific date, however, I know they\'re working on it. Plus, many members have been figuring it out on their own. Quote Link to comment Share on other sites More sharing options...
Emilio Posted March 4, 2012 Share Posted March 4, 2012 'override'? Going to learn C#, because i never seen override on C/C++... is OnPartExplode a correct value ? Also, i cannot use visual studio because i\'m on a Mac, so what can I do ? I have unity (free version, not pro) so i have MonoDevelop but i never used it. Is it some kind of compiler ? Also, if i want to do a new propulsion system (tank+engine+refiller), i have all of them in the same DLL ? I will read Cephei\'s plugin, to see if i can understand a few things. Quote Link to comment Share on other sites More sharing options...
skyline131313 Posted March 4, 2012 Share Posted March 4, 2012 Override is just a way to ensure the virtual function you are trying to override exists. C/C++ doesn\'t have this declaration as it\'s more to for 'safety' reasons than anything else (there\'s been some modifications in C++11, only thing that comes to top of my head is 'final' to ensure a virutal function doesn\'t get overridden after that class). Although C# still needs the override key word otherwise you might get a warning or error? Quote Link to comment Share on other sites More sharing options...
Nomad Posted March 4, 2012 Share Posted March 4, 2012 Seeing as how i have Unity installed on my laptop, do you guys recommend i use mono to code such plugins? Quote Link to comment Share on other sites More sharing options...
ForumHelper Posted March 4, 2012 Share Posted March 4, 2012 Do you even need Unity to code plugins? Quote Link to comment Share on other sites More sharing options...
Cephei Posted March 4, 2012 Author Share Posted March 4, 2012 Do you even need Unity to code plugins?nowhat you do need though is a fair knowledge about c# and programming in general, this is no entry level task and not something that i\'d recommend a beginner to start with Quote Link to comment Share on other sites More sharing options...
ForumHelper Posted March 4, 2012 Share Posted March 4, 2012 I think I\'ll give it a try, I\'ve been learning C++ for some time now. Shouldn\'t be so hard to adapt to a new syntax. I hope... Quote Link to comment Share on other sites More sharing options...
toastar Posted March 5, 2012 Share Posted March 5, 2012 Just a little question : What are the conditionss to use (i mean : When this happens-->do this) ?I seen OnPartActivate, OnPartAwake, OnFlightStart, OnDecouple, what are the others ?Here\'s my list so far onPartActivate()onPartAttach()onPartAwake()onPartDeactivate()onPartDelete()onPartDetach()onPartExplode)onPartFixedUpdate()onPartLiftOff()onPartLoad()onPartSplashdown()onPartStart()onPartTouchdown()onPartUpdate()onUnpack()onPack()onPartDestroyonJointDisable()onJointReset()onFlightStartAtLaunchPad()onFlightStart()onGamePause()onGameResume()onEditorUpdate()onDisconnect()onDecouple(float)onCtrlUpd(FlightCtrlState)onCopy()onActiveUpdate()onActiveFixedUpdate()I really suggest just opening up Assembly-Csharp in the object browser and looking for yourself, this is just from the 'Part' class, and there are other goodies there too.The Vessel Class looks like we could have fun with too.(i.e. Autopilot stuff)This looks like it could be extremely powerful. Not Just creating custom parts, You could make major changes to the game if you wanted. 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.