-
Posts
1,102 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
Everything posted by Jiraiyah
-
[1.12.x] DeepFreeze (v0.31.0) 12th Sep 2021
Jiraiyah replied to JPLRepo's topic in KSP1 Mod Releases
@JPLRepo Today I downloaded deep freeze from github, and I put everything inside the game data folder, so, lacking of a dependency is not an issue here, how ever, when I run the game, it complains about something went bad and about bad installation! Here is my player.log file, please help LINK thanks for your help -
is there any way to look into stock module c# codes?
Jiraiyah posted a topic in KSP1 Mod Development
Hi I was developing a little module plugin and it's inheriting from ModuleLight, it was my first time doing a module plugin so, I tried to look into the stock module code and learn from it, how ever, when I tried to used resharper, the code that was generated was not much readable, many sections inside any method is obfuscated and decompiled as something like calling internal methods! That rise a question in my mind, is there any way of properly decompiling a single module class like the module light for learning purposes? -
I mean it like, would wolf be able to handle the mining or not. I think we still need the good old drilling for gold. Honestly I prefer it that way. Wolf essentially removed the need for drilling in time for most of resources. Having one or two mechanics that would need drilling is not bad. One more question, do we need to baby sit the drilling / processing or will it work in the background (at least like what mks does, revisit and everything will be calculated properly like you had baby sit the craft)?
- 42 replies
-
- isru mining
- unobtainium
-
(and 3 more)
Tagged with:
-
Hi everyone. Stock KSP game has a ModuleLight. Let's have an example, think about a part that will sit on the surface of your vessle and behave like a mountable four direction light. Naturally you would have four spot lights in the modeling phase. You would like to turn all four of them on or off at the same time. Also, you would prefer to make all four lights blink at the same time. The stock ModuleLight, will only accept a single light geometry from your model. So, you would have to add four ModuleLights to your part file to handle all four spot lights. This will cause a huge headache for you. Using four ModuleLigths, means that now, in the part action window, you will have four buttons for turning lights on/off, and four buttons to make them blink. Unless you bind these actions to an action group, this won't work as intended. Also, now you would have four light color options. In some cases that is exactly what you need, then by all means, use the stock module. How ever, if you want to turn many light objects on/off and blink syncronously with a single button click, this little module is for you. How to use The syntax is similar to ModuleLight, how ever, when you have lightName in ModuleLight with a single name of the object, here you can have as many objects as you want, separate names with a comma and you can even use single space between comma and names to make things readable more. The final result will be something like this : MODULE { name = ModuleMultiLight lightName = light_obj_1, light_obj_2, light_obj_3, light_obj_4, light_obj_5, light_obj_6, light_obj_7, light_obj_8 lightRange = 10; useAnimationDim = True animationName = ANIM_NAME_TURN_ON lightBrightenSpeed = 2.5 lightDimSpeed = 2.5 disableColorPicker = False toggleInEditor = True toggleInFlight = True canBlink = True blinkMin = 0.2 blinkMax = 2.0 blinkRate = 0.5 isBlinking = False useResources = True resourceName = ElectricCharge resourceAmount = 0.002 } Notic, beside having many object names, now you have one additional parameter that you can set, the light's range value! The default number for this value is set to 60. This default value would work properly in case you have one or two ligths, but with more lights in close space, you may want to tweak and nerf this value down like this example. You can simply download the mod from SPACEDOCK The source is published on GITHUB Keep in mind, the license is MIT. If I was not able to keep this repo up to date in future for next versions of game, anyone who wants to maintain this, already have permission! Version History : 1.12.5.1: - Added the functionality for searching child objects for light, now, if you want, just put a single name (the parent) of the light object holders, the code will find all the children that are lights - Added the slider for light range into the part action window both in editor and in flight Known Bug : When you turn on the light on an active vessel and then leave it and go for other vessels, if you come back to the vessel, only the ring in colored and no lights are active, simply turn off the light (single light or on the whole vessel) and turn them back on, it should work. Unless someone can help me with this issue, no matter what I tried, nothing fixed this. If anyone can help with a pull request that would fix this issue, by all means please do it.
-
ok, one little thing, when I was talking about light intensity, I was thinking about intensity AND light range being tweakable from module code in part file, I just wrote the intensity, because I didn't know if light range was available or not and didn't have enough time to dig into the code. Any one has any idea about the whole code and possible solution for multiple children under a single parent?
-
I put together some code, didn't compile it, and didn't test if it's working or not, I just did it to give you guys a rough idea of what I'm looking for and a possible starting point : using System.Collections.Generic; using UnityEngine; public class ModuleMultiLight : ModuleLight { [KSPField] public float lightIntensity = 60; public override void OnStart(PartModule.StartState state) { base.OnStart(state); lights = new List<Light>(); string[] temp = lightName.Replace(" ", "").Split(','); foreach (var name in temp) this.lights.AddRange(part.FindModelComponents<Light>(name)); foreach (var light in lights) { light.intensity = lightIntensity; brightnessLevels.Add(lightIntensity); // Not sure if the reflection bellow will work or not! light.color = (Color) typeof(ModuleLight).GetField("lightColor").GetValue(this); } } } If this code works, I had covered the multiple names, how ever, I was a little confused on how to look for children case. If this was pure unity game development, I would know what to do, how ever, this is an API for KSP and I am not familiar with this API at all. If someone is familiar with this, please take a look at this piece of code and if possible, add the ability to look for children of objects and find lights to add to list, and, please confirm if the reflection code is correct or not! thanks
-
Hi I am sure you are aware that the stock ModuleLight accepts only a single object with light component on it. How ever, we see many mods with multiple light objects on a single part. In many cases, there is a need for many lights being turned on/off/blink simultaneously suing a single button in PAW. I am not familiar with plugin development for ksp at all, but, went on and looked into the code for module light..... On the Start method, We have : this.lights = new List<Light>((IEnumerable<Light>)this.part.FindModelComponents<Light>(this.lightName)); As you see here, the module obviously has a list for lights, this is nice how ever, it only looks into a single model name, and tries to capture as many light components it has! Changing this behavior shouldn't be that hard, you just need to observe a list of objects from part file separated with comma, loop through them, and look for the light components on each one of them and add it to list, how ever, if there was only one object named, not only you would capture the light on the object, but also should loop through it's children and see if there are any lights there and capture them as well. Up until this point, I could sit down and write the code in 5 minutes my self how ever... few lines bellow that... we have this : light.color = this.lightColor; This is happening inside a loop that is looping through the above generated list. I thought to myself, ok,... let's inherit the class for ModuleLight, Override the OnStart, call the base first, regenerate the list and duplicate the loop (there is no other section on the OnStart that works with this list other than this loop). Problem is.... this.lightColor on the ModuleLight, is a private field ! I am not that familiar with Reflection but I think we would need an instance of the object in memory to be able using reflection and get the private filed value?! SO, long story short, I hit a wall that passing it is beyond my knowledge of C#. How ever, I think, this module should not be that complicated to write. The end goal is clear, in part file, where we had : MODULE { name = ModuleLight lightName = OBJECT_NAME useAnimationDim = True animationName = ANIMATION_NAME lightBrightenSpeed = 2.5 lightDimSpeed = 2.5 disableColorPicker = False toggleInEditor = True toggleInFlight = True canBlink = True blinkMin = 0.2 blinkMax = 2.0 blinkRate = 0.5 isBlinking = False useResources = True resourceName = ElectricCharge resourceAmount = 0.003 } We should have something like this : MODULE { name = ModuleMultiLight lightName = OBJECT_NAME1,OBJECT_NAME2,OBJECT_NAME3,.... useAnimationDim = True animationName = ANIMATION_NAME lightBrightenSpeed = 2.5 lightDimSpeed = 2.5 disableColorPicker = False toggleInEditor = True toggleInFlight = True canBlink = True blinkMin = 0.2 blinkMax = 2.0 blinkRate = 0.5 isBlinking = False useResources = True resourceName = ElectricCharge resourceAmount = 0.003 } and if we have only one name, then we would look for the children of that object. If we had many names like the code above, then no need to look for children. After that, if we properly generated the mentioned list, we should be able to handle ALL those lights with one on/off or blink button in PAW?! One extra feature that would be nice is the ability to change the light intensity from part file module parameter. This should affect all the lights in the list at the same time and set all of them to a single value. So, please, I beg someone with enough knowledge on coding for KSP to do this little module plugin.
-
@zer0Kerbal Hi, had one question, how does your mod behave side by side with new MKS-WOLF system? is there any plans to make it work with wolf?
- 42 replies
-
- 1
-
-
- isru mining
- unobtainium
-
(and 3 more)
Tagged with:
-
@FruitGoose Hi Am i the only person who can't find apple in ckan?
-
Hi everyone, I was going to ask it few days ago but forgot about it until now, actually, it's few ksp versions that I have this question about ascending guide, when you click on show ascend guide on the interface, there should be a blue marker on the nav ball, but for few versions of ksp, it's missing, anyone knows why? is there any way to fix it?
-
Hi everyone, I was going to ask it few days ago but forgot about it until now, actually, it's few ksp versions that I have this question about ascending guide, when you click on show ascend guide on the interface, there should be a blue marker on the nav ball, but for few versions of ksp, it's missing, anyone knows why? is there any way to fix it? sorry guys, wrong thread... sorry sorry
- 157 replies
-
- ssto
- spaceplane
-
(and 1 more)
Tagged with:
-
Hi Is there any conflict between this mod and any other mod? trying to install it by CKAN but when I check mark this mod the apply button is still disabled, this normally happens when there is a conflict between the new mod and your mod list?
- 65 replies
-
- pandora
- polyphemus
-
(and 3 more)
Tagged with:
-
actually I think it would be better to keep the mod the way it is now, think about the design challenge this would give us, yes, the user should be able to change the signal on the fly, but, what if we assume the signals are fixed? if a player wants to play this way, he/she has to think about number of dishes and antenna he/she would need on the ship. Actually, if you ask me, there can be an option in the window that would disable the signal change during the flight !
-
Hi @zer0Kerbal was talking with another mod developer in private when an idea came out of the conversation about FTL and FTF mods you develop. Here is the idea : If we assume that kerbals know how to develop artificial intelligence, why would they really need a five star kerbal to train them? How about AI modules that can be trained by a kerbal once and then having this module side by side with FTL or FTF modules, other kerbals can learn from the AI without the need for another teacher to be on board? If we accept this idea, you can have two modules (parts and yes I intentionally ask for parts to make station designs a bit more interesting and a little challenge, and no, the parts should be big enough and can't be flat small objects), one module would be responsible for storage hardware and another for the cpu processor of the AI. And, for each skill, we need a separate AI module pair. Adding USI skills into the game and idea here, having a training station, would be interesting to develop because for each skill you have to plan two parts in the station. Also, for training the AI, you would need a five star kerbal in the CPU unit, time and lots of time for each round of training, and more than one round of training until the unit gets ready. If USI MKS is present, maintenance of the unit can use special parts (make it optional via options). At the end, we may need to train the AI at least one more round after some years because of malfunctioning or any other name you would use that causes the AI to mess things up or forget stuff. Finally, if we have AI units in the same ship/station with FTL or FTF modules, kerbals can learn the skill without a need for another teaching kerbal. If we lack the AI module for a skill, then we go back to the original mod design that forcefully asks for a teacher. You may ask why we may need something like this? The idea came out when me and another mod developer where talking about generation ships. You know, add civilian population mod to the game, some far far away star systems that would need hundred of years to reach the destination, add USI MKS and Life support, deep freeze and your FTL and FTF mods, all in one place for a game play !!! This way, we can have generation ships. You know, the ship that would leave home planet and it's star system for future generations... during the travel original crew will die but their children will be trained in space and when the final destination reached, you may have passed through four or five generations. In Sci Fi movies, training these children would be done by one of three choices : 1- Elders will train younger generation... what is sci fi about this?? nothing!!! as time passes some of the knowledge will be lost ! 2- Drone and Robots who look like normal population would sit and teach children. 3- Computer AI with holographic images would teach I think you got the picture,.... i'm a fan of the third option lol. So, what do you think about this idea?
-
Here we go : In this line of code, you are reading a key from dictionary without checking if the key exists or not, basically if the key is not there, you need to first add the key manually with proper values, if the key is there, change the values. This needs to be handled in case the key is not present. And I'm not sure if in my log file there will be more methods like this or not. In short, you should never "assume" that the key will be present. Always do the sanity checks while coding and handle possible exceptions if you can like this one.
-
@eberkain and @Stone Blue I will look into the links stone provided. But lets say for example that I'm gonna do a constellation for duna (or any other planet out side of home SOI), I would send a rocket with stupid amount of delta v and 24 sats. How ever, when we are talking about changing the inclination... this is where I'm getting lost. What should be the steps for inclination change for 6 orbits this way? remember the origin is at 0 inclination to make things easier for start. Also, I didn't get what is the point of resonant orbit calculator here? (not played with that much)
-
hello everyone. I was watching a video that was sending 4 sats at once, putting them in parking orbit of 776 KM and final Orbit or 1585KM, and he was launching 6 rockets, once an hour. Now, I understand how it came out and why the numbers, but.... Lets say that I want to put the same constellation around ANY other planet. I would eventually love to send all these 24 sats on a single rocket and toward that planet, and circularizing around it's orbit on 0 inclination. From this moment forward, we have a rocket with enough delta V for anything, sitting in 0 inclination, with all the 24 sats.... how should we produce the same constellation using inclination changes and how to calculate the parking and final orbit to have 4 sats in each orbit and 6 orbits as final result? This question,... made me scratch my head and look at monitor for hours without any result !
-
Here is ksp.log if you need any other log tell me to upload them too : https://www.dropbox.com/s/y9y0vtds2eg100a/KSP.log?dl=0 But I warn you, the log is huge and you may want to use something like Notepad ++ and search for keywords. And the mod list is in the spoiler (unistalled CNC already for time being)