Justin Kerbice Posted November 4, 2014 Share Posted November 4, 2014 Most excellent Justin. Keep in mnd that save/persistence support is currently stripped from KK and will need re-instating or replacing if you want to keep track of what's been found per save. If you can make this as re-usable as possible in the code (i.e. as close to another API as possible), it can handle other features in future.Not sure to fully understand what you mean, you need to be MORE SPECIFIC, same apply to some of your previous reply.I just copy what is there in KK plug-in, doing the same thing the same way.I'll just add some more bones to the KK skeleton , hope not to put them in a weird position . Link to comment Share on other sites More sharing options...
AlphaAsh Posted November 4, 2014 Share Posted November 4, 2014 There was code in KerbTown that allowed static additions to be saved per save game. That code is not in Kerbal Konstructs. If you want to support individual progress of finding locations for each game save you will need that code or similar back.The old code was not very good and any other feature that might be added that needs to use similar functions would benefit from more flexible and re-usable code. So, something like an API.Anyone else want to step up and translate? I can't make this any simpler. Link to comment Share on other sites More sharing options...
Justin Kerbice Posted November 4, 2014 Share Posted November 4, 2014 (edited) I can't ever translate the your initial reply into this, as you've said before, I'm not in your mind, I don't know what you know (one of the hardest thing to discover for many people it seems, especially the ones who starts their post by "so...") I guess using persistent KSP file can do the job, anyway it will be in a further step. 1st thing 1st !EDIT: I find the altitude increase/"snap to surface" issue:alt += (float)selectedObject.getSetting("RadiusOffset");it seems to happened when ENTER is not use (manuallySet= false)all var += value should be, maybe, var = value instead. Need further investigations.EDIT2: Set manuallySet to true when the button is use, without anything else is bad... get a NaN for RadialPosition then KSP is totally wasted ! Edited November 4, 2014 by Justin Kerbice Link to comment Share on other sites More sharing options...
medsouz Posted November 4, 2014 Author Share Posted November 4, 2014 alt += (float)selectedObject.getSetting("RadiusOffset");it seems to happened when ENTER is not use (manuallySet= false)all var += value should be, maybe, var = value instead. Need further investigations.There is nothing wrong with that, manuallySet means that they manually defined the value using the text box. When it is false it means that they added or subtracted from the current altitude value. Link to comment Share on other sites More sharing options...
AlphaAsh Posted November 4, 2014 Share Posted November 4, 2014 Gah. Too many cooks and all that. Justin, I've already got a fix for that 'bug' ready to commit, which I did mention in an earlier post - more specifically, that multiple clicks of snap to surface would increment the altitude. If I'm understanding you correctly medsouz, this is intended behaviour anyway. Link to comment Share on other sites More sharing options...
medsouz Posted November 4, 2014 Author Share Posted November 4, 2014 (edited) Gah. Too many cooks and all that. Justin, I've already got a fix for that 'bug' ready to commit, which I did mention in an earlier post - more specifically, that multiple clicks of snap to surface would increment the altitude. If I'm understanding you correctly medsouz, this is intended behaviour anyway.I'm not saying that snap to surface not being consistent isn't a bug, I'm saying what Justin wants to change wouldn't fix it.I think we all suck at explaining things.EDIT: I guess he was on the right track, at line 144 of EditorGUI.cs we need to add manuallySet = true. I don't have access to KSP right now so I can't test it but it should solve the issue. Edited November 4, 2014 by medsouz Link to comment Share on other sites More sharing options...
AlphaAsh Posted November 4, 2014 Share Posted November 4, 2014 I'm not saying that snap to surface not being consistent isn't a bug, I'm saying what Justin wants to change wouldn't fix it.I think we all suck at explaining things.EDIT: I guess he was on the right track, at line 144 of EditorGUI.cs we need to add manuallySet = true. I don't have access to KSP right now so I can't test it but it should solve the issue. Heh, indeed. I not thing explain me well suck. Truth be told my other half was working on it and I shouldn't claim credit for it. Her fix is the same as yours IIRC. I'll step back from that one and let you deal with it. Link to comment Share on other sites More sharing options...
Justin Kerbice Posted November 4, 2014 Share Posted November 4, 2014 EDIT: I guess he was on the right track, at line 144 of EditorGUI.cs we need to add manuallySet = true. I don't have access to KSP right now so I can't test it but it should solve the issue.You guys have missed my EDIT2: set it to true is not enough, it's even worth as-is (NaN is definitely not our friend !). Link to comment Share on other sites More sharing options...
AlphaAsh Posted November 4, 2014 Share Posted November 4, 2014 My brain splode. Don't make me get my wife involved. There will be blood-shed My advice, let her fix this one. She's just crashed with the flu atm. Link to comment Share on other sites More sharing options...
medsouz Posted November 4, 2014 Author Share Posted November 4, 2014 You guys have missed my EDIT2: set it to true is not enough, it's even worth as-is (NaN is definitely not our friend !).Oh I see. I could probably just set the altitude value right there instead of setting shouldUpdateSelection. I don't even remember writing this section of the code and I hate it. Link to comment Share on other sites More sharing options...
stanz25 Posted November 4, 2014 Share Posted November 4, 2014 Ok new problem! I installed the new update to Konstructs and KerbinSide. When I click on the icon nothing happens. Link to comment Share on other sites More sharing options...
Justin Kerbice Posted November 4, 2014 Share Posted November 4, 2014 Oh I see. I could probably just set the altitude value right there instead of setting shouldUpdateSelection. I don't even remember writing this section of the code and I hate it. Maybe looking also at how it was before may help, I guess it was a direct set like you think.Regarding logs: what do you think of using a common prefix for all ("KK:" maybe) as in SpaceCenterManager class, there is "Debug.Log(csc.SpaceCenterName);", no "header" or anything, may be not very useful.For the "explolaunch" unwanted feature, could it be possible to add a kind of "docking port" for the launch site then do as EPL do. Don't know how it will behave with launch clamp but I'm won't bet on it ! Link to comment Share on other sites More sharing options...
Justin Kerbice Posted November 4, 2014 Share Posted November 4, 2014 Ok new problem! I installed the new update to Konstructs and KerbinSide. When I click on the icon nothing happens.Regarding your previous question, the question mark is a common issue I guess, I got it too (0.25 in DirectX mode on window failed to load some non PNG/MBM textures for no reason , no issue on opengl mode).AFAIK Kerbin Side include its own version of KK, so maybe remove KK, reinstall the last release from Kerbal Stuff and see what's happen.Providing the logfile may help too, because with what you give, nothing can really be done to help you. Link to comment Share on other sites More sharing options...
AlphaAsh Posted November 4, 2014 Share Posted November 4, 2014 Ok new problem! I installed the new update to Konstructs and KerbinSide. When I click on the icon nothing happens.I scewed up KerbinSide's release this morning and missed a new model. This actually makes KK fall over as you describe. This isn't a KK bug and I'm rolling a fix for KerbinSide right now. Link to comment Share on other sites More sharing options...
medsouz Posted November 4, 2014 Author Share Posted November 4, 2014 I scewed up KerbinSide's release this morning and missed a new model. This actually makes KK fall over as you describe. This isn't a KK bug and I'm rolling a fix for KerbinSide right now.Maybe I should do a try/catch (assuming C# has those, I'm note of a Java person) around the object loading code so that if one fails it doesn't break everything and just skips over it. Link to comment Share on other sites More sharing options...
AlphaAsh Posted November 4, 2014 Share Posted November 4, 2014 Maybe I should do a try/catch (assuming C# has those, I'm note of a Java person) around the object loading code so that if one fails it doesn't break everything and just skips over it.C# can do that yup. That'd be a very neat bit of error handling chap. Link to comment Share on other sites More sharing options...
Justin Kerbice Posted November 5, 2014 Share Posted November 5, 2014 This is about site discovery feature, and everyone is welcome to give opinion, idea or anything (both assets creators and players).I think of two ways to achieve it: "auto" discovery by distance = when the player get close enough (per launch site defined or global for all launch sites), site become automatically "discovered", icon appears on map and it is available in the launch menu, "manual" discovery = here, player have to go on the site, and activate/enable it the same way InfiniteDice does for his video about refuelling (it would be great to have the code/plug-in), this is the way I prefer myself, as a sites may be inactive for a while, dusty, unusable as-is, generators has to be restarted, or power set back to work, or such operations.1st approach: bad because it needs to get trough the whole list of sites and calculate player <-> site distance often (in FixedUpdate method, every x seconds/minutes), if one is close enough, activate it. It could be seriously resource consuming when many sites exists (Kerbin Side for example).I have thought of a "smart" algorithm which can remove sites that can't be reach according to current trajectory but... not good when flying in circles for example, the "likely to reach list" may be modified often, using more resources than just deal with the whole list.The 2nd approach suits better how KSP works and spare CPU resources for physics. It could be also more "role play", as we can decide we need to go EVA and activate a switch ("power on" ) which in fact would be just go to the blue/red/whatever square/circle/... to do the job.By the way, a bunch of launch sites can also be defined as already available (no discovery needed) as they are supposed to be up and running like Kosmodrome for example and a few sites from Kerbin Sides scattered all around (maybe one big site per continent/zone).Now let's discus this before going further with the code. Link to comment Share on other sites More sharing options...
comham Posted November 5, 2014 Share Posted November 5, 2014 The second approach is more gamey, and I prefer it. More of a sense of something being done by the player instead of lazily driving by. Link to comment Share on other sites More sharing options...
LORDPrometheus Posted November 5, 2014 Share Posted November 5, 2014 You'd have to make them all unlocked for sandbox obviously but approach two is the proper idea I think.Also I wonder if its possible to make the sites load dynamically so when you have something like kerbin Side enabled you don't need to dedicate as many resources. I'm not very versed in coding but If you could make the models only load within 50k or something like that it'd probably be great for performance especially with large amounts of sites Link to comment Share on other sites More sharing options...
Justin Kerbice Posted November 5, 2014 Share Posted November 5, 2014 You'd have to make them all unlocked for sandbox obviously but approach two is the proper idea I think.Also I wonder if its possible to make the sites load dynamically so when you have something like kerbin Side enabled you don't need to dedicate as many resources. I'm not very versed in coding but If you could make the models only load within 50k or something like that it'd probably be great for performance especially with large amounts of sitesNo for sandbox, we don't need to suffer from the poor career mode to play our own missions. There will be a config item to change this.The second point is quite irrelevant here and is a complete another story, I let this for later as KK has its own issues. Currently we can't just offer launch from anywhere without some knowledge of it (sadly model & tex are all loaded as well as other data) but in term of performance, you'll loose in CPU what you'll spare on memory (the distance have to be calculated in a way or another, for now, as I wrote above, it means going trough the whole list of sites every x amount of time). Link to comment Share on other sites More sharing options...
AlphaAsh Posted November 5, 2014 Share Posted November 5, 2014 ... Also I wonder if its possible to make the sites load dynamically so when you have something like kerbin Side enabled you don't need to dedicate as many resources. I'm not very versed in coding but If you could make the models only load within 50k or something like that it'd probably be great for performance especially with large amounts of sitesKerbal Konstructs already does this. Link to comment Share on other sites More sharing options...
Justin Kerbice Posted November 5, 2014 Share Posted November 5, 2014 Kerbal Konstructs already does this.Are you sure ? KK load all objects inside defined visibility range (more than 10 kms, usually 100 kms by default in KT) in awake method, which is far from load objects while in flight only and only when active vessel is within visibility range, unless I'm completely wrong. medsouz ? Link to comment Share on other sites More sharing options...
AlphaAsh Posted November 5, 2014 Share Posted November 5, 2014 (edited) Are you sure ? KK load all objects inside defined visibility range (more than 10 kms, usually 100 kms by default in KT) in awake method, which is far from load objects while in flight only and only when active vessel is within visibility range, unless I'm completely wrong. medsouz ?Yes I'm sure. In the flight scene, it has to otherwise the old krakensbane issues would remain. Invoking updateCache every second is what continuously determines every second whether something has gone out of or come in to visibility range. Edited November 5, 2014 by AlphaAsh Link to comment Share on other sites More sharing options...
Justin Kerbice Posted November 5, 2014 Share Posted November 5, 2014 Yes I'm sure. In the flight scene, it has to otherwise the old krakensbane issues would remain. Invoking updateCache every second is what continuously determines every second whether something has gone out of or come in to visibility range.ok, just look more carefully at the code.every sec ?? not too much ? unless flying at incredibly high speed (more than 1 km/s) close to the surface, calling every 2 sec or less may save some resources for (need testing) no noticeable loss. Link to comment Share on other sites More sharing options...
AlphaAsh Posted November 5, 2014 Share Posted November 5, 2014 ok, just look more carefully at the code.every sec ?? not too much ? unless flying at incredibly high speed (more than 1 km/s) close to the surface, calling every 2 sec or less may save some resources for (need testing) no noticeable loss.No need. updateCache is already optimised by celestial bodies, groups, and group centers in order to minimise the work it does. Link to comment Share on other sites More sharing options...
Recommended Posts