Jump to content

[WIP] [1.12.x] Kerbal Electric - Back to brighten up your explosions.


Fengist

Recommended Posts

VaZtSKd.png

 

Download from GitHub

NOTE: Default light settings in KSP only allow for 8 lights due to the added resource loads lights can cause.
To increase the number of lights available, go to Settings/Graphics/Pixel Light Count and adjust it according to your system's abilities.

____________________________________________________________________________________________

Compatible with @Li0n's Crew Light

License is: a modified Creative Commons Attribution-NonCommercial 4.0 International Public License and view-able in the GitHub plugin directory.

Source

Idiot Lights!
Read about them in this post

sUZGCGP.png


Slime Lights

5DkvagP.png

 

Non-Idiot Lights

 

GVS2miS.png

w1PsjCf.png

And this is a stock aircraft on the runway with several of the lights attached to give a size comparison.

cERU6mP.png

So this all came about because I wanted some lights for a truck.  After spending days trying to tie into ModuleLight I finally threw my hands up in disgust and wrote my own partmodule.

 

Features:

  • Works with multiple light sources on a single part using animations.
  • GameObjects (lenses) so designated in the config can have their material color changed to match the light color. This happens real-time in the hangar. As you change the light color, the lens color changes.  The color changer takes either _Color or _Emissive colors.
  • GameObject (lenses) off colors - The plan is eventually to animate the lens colors to match the light color animation so that they fade in and out.  I'm not there yet.  Until such time, the lenses turn off and on during blink and remain on otherwise.  The off color can be added in the .cfg file.
  • Blinking lights - Most of these lights can be set to blink.  On and Off times have a range of 0.1 sec to 10 sec.  These are set via sliders in the hangar.  Each light's blink time and blink state is set independently and is persistent
  • Preset colors - Some of the lights on other mods I've seen have this cool blue shade rather than the stock yellow.  With this plugin, you get 15 (at the moment) preset colors and the ability to add your own by adding to a dat file in the plugin directory.  Preset format is:  Color name,RGB.Red,RBG.Blue,RGB.Green   I.E.  Candle,255,147,41
  • Current color presets include:
  1. Candle
  2. 40W Tungsten
  3. 100W Tungsten
  4. Halogen
  5. Carbon Arc
  6. Warm Fluorescent
  7. Standard Fluorescent
  8. Cool White Fluorescent
  9. Full Spectrum Fluorescent
  10. Grow Light Fluorescent
  11. Black Light Fluorescent
  12. Mercury Vapor
  13. Sodium Vapor
  14. Metal Halide
  15. High Pressure Sodium

Want more colors?  Here's a website I found that has lots of them with their r,g,b values.  Just add your favorites to the presets.dat in the Plugin folder.

Future plans (hopes)

Animating lens colors via code to match light colors (done)
GUI menu to make that searchlight rotate and tilt.  (done)
Create a disco party truck (done)

ProTip: To quickly locate these parts, search for Kerbal Electric in the hangar parts list.

g9VKwEJ.gif

nFMO5wU.gif

Edited by Fengist
Link to comment
Share on other sites

Me likey!

Regarding the spotlight, it can fill in a niche left by Bahamuto's old turret spotlight (the one that follows the mod cursor, or a locked target, which would resolve the entire GUI thing--though there's the Launchpad Spotlight mod just recently out that has its own solution in the PAW, but it's definitely more meant for a static solution as it's meant to light up a craft on a launchpad).

Would you be open to additional parts suggestions, though? Always on the lookout for single-part solutions to lighting up very wide areas of a vessel or terrain (e.g., Alexustas; stackable inline lights which, when mounted on the base of a lander vessel, well, that idea.)

Edited by B-STRK
Link to comment
Share on other sites

3 hours ago, B-STRK said:

Me likey!

Regarding the spotlight, it can fill in a niche left by Bahamuto's old turret spotlight (the one that follows the mod cursor, or a locked target, which would resolve the entire GUI thing--though there's the Launchpad Spotlight mod just recently out that has its own solution in the PAW, but it's definitely more meant for a static solution as it's meant to light up a craft on a launchpad).

Would you be open to additional parts suggestions, though? Always on the lookout for single-part solutions to lighting up very wide areas of a vessel or terrain (e.g., Alexustas; stackable inline lights which, when mounted on the base of a lander vessel, well, that idea.)

Ideas... gimme ideas.

10 hours ago, Drew Kerman said:

None. Ship it (pun not intended :P

Soon™  Still doing some internal testing. Still tweaking the ballasts (pun intended).

Link to comment
Share on other sites

Those things look marvelous!

But as long as you're looking for ideas, will this work with Crew Light? I love how it makes lights behave... well, sensible-ish. As I understand it it might not work right out of the box because Crew Light might not recognise your partmodule as lights.

 

Link to comment
Share on other sites

*facepalm* There IS a group of lights I'd love to see for ages in KSP, and I nearly forgot them: actual navigation lights.
2099091.jpg
Which would be red (port, or "looking forward, left") and green (starboard, or "looking forward, right"), and mounted to the side of a vehicle, shine directly forwards and in a sector of about 110° to the side. That would be a little bit more than right towards the side, and wouldn't even need to be overly precise - it's just that with current mods getting navigation lights to not illuminate towards the back is such a hassle. There is one light nearly like that, but it has too narrow a beam and just looks weird.

Link to comment
Share on other sites

2 hours ago, Fengist said:

Ideas... gimme ideas.

Soon™  Still doing some internal testing. Still tweaking the ballasts (pun intended).

One which comes to mind is a curved bank of lights capable of covering an arc wider than the seemingly 90-120 degree cones of light KSP lighting solutions (stock and mod) seem to offer so far. I mean, maybe a 180-degree or 360-degree light bank might seem overkill (presently I use three or four of the B9 light banks mounted on something cylindrical to achieve that effect) but there are those instances when one just needs to light up the darkest of prison courtyards a Munbase in munar night.

And a portable area light post (something like Alexustas' Deployable Globe Light, which I admit I miss terribly)--is it possible to give it a probe core, solar, and battery in the same one part so it wouldn't need a KAS hookup for recharging, and won't risk despawning if used in an area where debris are despawned (Wish the vessel markers in KSP would have an "Other" category for stuff like this)? 

Link to comment
Share on other sites

2 hours ago, VenDei said:

But as long as you're looking for ideas, will this work with Crew Light? I love how it makes lights behave... well, sensible-ish. As I understand it it might not work right out of the box because Crew Light might not recognise your partmodule as lights.

I'll make the change in Crew Light when this mod is released, I'm looking forward to it too.

14 minutes ago, VenDei said:

*facepalm* There IS a group of lights I'd love to see for ages in KSP, and I nearly forgot them: actual navigation lights.

There is already a mod with this kind of lights : (and Crew Light has special automatization feature for it :wink: )

 

Link to comment
Share on other sites

1 minute ago, Li0n said:

There is already a mod with this kind of lights : (and Crew Light has special automatization feature for it :wink: )

Well, yeah, those definitely come in the right colours, but they always had the drawback of shining complete 180°. I tried tilting them to block them from shining towards the back, or block them with a structural element, which kind of works - but if someone looks for an idea for lights, I can try to get it in without the hassle, right? :wink:

And yes, I'm kind of irrationally sensitive here. There's no functional benefit in making those lights.

Link to comment
Share on other sites

20 hours ago, Li0n said:

I'll make the change in Crew Light when this mod is released, I'm looking forward to it too.

There is already a mod with this kind of lights : (and Crew Light has special automatization feature for it :wink: )

 

@Li0n Let me know what you need for this to work with your mod.  Basically, it's intended as a replacement for ModuleLight and many of ModuleLight's 'features' are already in there.  Specifically, which calls to ModuleLight are you making and I'll make sure that's in the code.  It already drops an action in the lights action group so that should work with your daylight on/off.  Not sure if this still the same but being able to turn these off when they get automatically turned on would be a good idea.  I watched Kottabos review and when I saw his lights turn off at night my first thought was, the battery went dead, not the mod shutting them off.  That search light will eat up some battery power if left on.

If you wish, prior to release I'll give you a test copy to play around with.

21 hours ago, VenDei said:

*facepalm* There IS a group of lights I'd love to see for ages in KSP, and I nearly forgot them: actual navigation lights.
2099091.jpg
Which would be red (port, or "looking forward, left") and green (starboard, or "looking forward, right"), and mounted to the side of a vehicle, shine directly forwards and in a sector of about 110° to the side. That would be a little bit more than right towards the side, and wouldn't even need to be overly precise - it's just that with current mods getting navigation lights to not illuminate towards the back is such a hassle. There is one light nearly like that, but it has too narrow a beam and just looks weird.

The marker light already looks similar to the black one, just not angled.  Changing the angle and direction of a light is not a problem.  Where the issues come up is part of the way Squad coded things.  Lights are only visible when they reflect off of a surface.  So even if I do set an angle to a navigation light on an aircraft, if it's on a wing or some such, you won't know what angle it's shining toward as, in flight, there's no surface to reflect off of.

Nextly, parts in KSP don't block light or cast shadows the way they should IRL.  Therefore, lights end up shining through parts and out the other side.  Yes, most annoying.

 

21 hours ago, B-STRK said:

One which comes to mind is a curved bank of lights capable of covering an arc wider than the seemingly 90-120 degree cones of light KSP lighting solutions (stock and mod) seem to offer so far. I mean, maybe a 180-degree or 360-degree light bank might seem overkill (presently I use three or four of the B9 light banks mounted on something cylindrical to achieve that effect) but there are those instances when one just needs to light up the darkest of prison courtyards a Munbase in munar night.

And a portable area light post (something like Alexustas' Deployable Globe Light, which I admit I miss terribly)--is it possible to give it a probe core, solar, and battery in the same one part so it wouldn't need a KAS hookup for recharging, and won't risk despawning if used in an area where debris are despawned (Wish the vessel markers in KSP would have an "Other" category for stuff like this)? 

The portable globe light, I can do something like that.  I refuse to make it look like a clown balloon though.

As for the bank of lights, show me an example of what you're thinking of.  I get no mental vision from your description.

it's possible to put probe cores, solar and batteries on parts, but that's kinda beyond the scope of this mod.

Edited by Fengist
Link to comment
Share on other sites

2 hours ago, Fengist said:

@Li0n Let me know what you need for this to work with your mod.  Basically, it's intended as a replacement for ModuleLight and many of ModuleLight's 'features' are already in there.  Specifically, which calls to ModuleLight are you making and I'll make sure that's in the code.  It already drops an action in the lights action group so that should work with your daylight on/off.

The only calls to ModuleLight are : "ModuleLight.LightsOn" and ModuleLight.LightsOff". Basically all I need is two public method, on and off. And the name of your PartModule.

2 hours ago, Fengist said:

Not sure if this still the same but being able to turn these off when they get automatically turned on would be a good idea.  I watched Kottabos review and when I saw his lights turn off at night my first thought was, the battery went dead, not the mod shutting them off.  That search light will eat up some battery power if left on.

If you wish, prior to release I'll give you a test copy to play around with.

You can turn the lights off when they switch on at sundown, they will get turned back on at the next night tho. You can have them fully manual too, as in stock, just make sure they are in the light action group.

Yep Kottabos did run out of battery (I discussed it with him after I saw his video), stock light do eat up the battery pretty fast too :wink:

I'll sure like a test copy when it is ready :)

Link to comment
Share on other sites

3 hours ago, Fengist said:

@Li0n Let me know what you need for this to work with your mod.  Basically, it's intended as a replacement for ModuleLight and many of ModuleLight's 'features' are already in there.  Specifically, which calls to ModuleLight are you making and I'll make sure that's in the code.  It already drops an action in the lights action group so that should work with your daylight on/off.  Not sure if this still the same but being able to turn these off when they get automatically turned on would be a good idea.  I watched Kottabos review and when I saw his lights turn off at night my first thought was, the battery went dead, not the mod shutting them off.  That search light will eat up some battery power if left on.

If you wish, prior to release I'll give you a test copy to play around with.

The marker light already looks similar to the black one, just not angled.  Changing the angle and direction of a light is not a problem.  Where the issues come up is part of the way Squad coded things.  Lights are only visible when they reflect off of a surface.  So even if I do set an angle to a navigation light on an aircraft, if it's on a wing or some such, you won't know what angle it's shining toward as, in flight, there's no surface to reflect off of.

Nextly, parts in KSP don't block light or cast shadows the way they should IRL.  Therefore, lights end up shining through parts and out the other side.  Yes, most annoying.

 

The portable globe light, I can do something like that.  I refuse to make it look like a clown balloon though.

As for the bank of lights, show me an example of what you're thinking of.  I get no mental vision from your description.

it's possible to put probe cores, solar and batteries on parts, but that's kinda beyond the scope of this mod.

Re: the bank of lights, something like this curved LED panel, only instead of being mood lighting-level its lighting elements can light up to 200m, and across the arc the panel covers. (On the other hand, a mood lighting-level panel would be nice for increasing the visibility of ships on the night side...). The effect, particularly in the light arc's coverage, would be similar to, for example, having these three A8 Spotlight Arrays from the B9 parts pack mod arranged and lighting just so: 2ImzVh6.png

except as one continuous part and one continuous light arc, not three. (Also, how does one shrink pictures in this new forum editor?) If it's possible, I hope it could be implemented? I'd understand if game engine limitations would make it unlikely, though. 

Though now that I've seen those curved LED panels while looking for a real-world example, maybe those lights as conformal hull panels would also be a good idea? (To reiterate: mood lighting for spacecraft! :) )

As for the entire probe core etc. thing, the hope was that those lamp posts would thus be independently controllable and not dependent on being part of another base or craft for power, recharging, and control. (And one part as well.)

Edited by B-STRK
"and one continuous light arc"
Link to comment
Share on other sites

12 hours ago, Li0n said:

The only calls to ModuleLight are : "ModuleLight.LightsOn" and ModuleLight.LightsOff". Basically all I need is two public method, on and off. And the name of your PartModule.

You can turn the lights off when they switch on at sundown, they will get turned back on at the next night tho. You can have them fully manual too, as in stock, just make sure they are in the light action group.

Yep Kottabos did run out of battery (I discussed it with him after I saw his video), stock light do eat up the battery pretty fast too :wink:

I'll sure like a test copy when it is ready :)

I think I can do that.  I'll send you a pm when I get something working.

 

11 hours ago, B-STRK said:

Re: the bank of lights, something like this curved LED panel, only instead of being mood lighting-level its lighting elements can light up to 200m, and across the arc the panel covers. (On the other hand, a mood lighting-level panel would be nice for increasing the visibility of ships on the night side...). The effect, particularly in the light arc's coverage, would be similar to, for example, having these three A8 Spotlight Arrays from the B9 parts pack mod arranged and lighting just so: 

except as one continuous part and one continuous light arc, not three. (Also, how does one shrink pictures in this new forum editor?) If it's possible, I hope it could be implemented? I'd understand if game engine limitations would make it unlikely, though. 

Though now that I've seen those curved LED panels while looking for a real-world example, maybe those lights as conformal hull panels would also be a good idea? (To reiterate: mood lighting for spacecraft! :) )

As for the entire probe core etc. thing, the hope was that those lamp posts would thus be independently controllable and not dependent on being part of another base or craft for power, recharging, and control. (And one part as well.)

Now I understand.  Ok, here's the good news and the bad news.

The good news.  A light like that would be easy to create.

The bad news. I'm not going to do it. Sorry

Here's why.  You're asking for a part that will conform to a specific hull size, 2.5m in your example.  Just off the top of my head, I can think of at least 6 different part sizes in KSP stock parts alone, maybe 7???   Now I have to ask myself, for the time and effort it would take to create 6 very specific lights, would they get used more or less often than a non-part specific light.  Would I be better off spending my time moddeling 6 lights that fit any part, or 6 lights with each fitting a specific part?  I think the former.  I may change my mind in the future tho.

1 hour ago, wasml said:

A suggestion - a slider for intensity that would also impact electric usage, and range.

And thanks for sharing these mods!

Ah balls... you found my secret.

In the world of KSP lighting, there's two ways a light can work.  On/Off... basically the light on the model is switched on and off.  In which case, the intensity can easily be modified.  Next... animated.  All of the stock lights and all of my lights use animations in order to create a bulb dimming effect. They fade in and they fade out.  In my case, it's the actual intensity that's changing.  I'm not sure if you've played with the lights I have in Maritime Pack but they work on the animation of the light intensity.  And because of that, they can be a lot brighter than a light with a fixed intensity.  Some people actually pull my lights out of the mod, ditch all the boat parts and keep the lights (Yea, I know a guy that does that).

Now I have briefly considered this as a possibility.  However, this isn't as easy as changing a value.  This would involve digging into the actual animation curves, getting the values, creating new curves and... essentially... reworking the entire animation.  And, to put this on a slider bar in the SPH/VAB, it would rework that animation every single time the bar was moved.

Finally, I often have more than one light on a part.  I may have a Unity Spotlight to cast the beam.  But I may also have a Unity Point light to cast a 'glow' around the light.  Each of those typically has very different intensities.  So it wouldn't be as simple as creating one curve and applying it to every light.

Long explanation but... no can do.  Or rather, I ain't gonna do.  Sorry.

Link to comment
Share on other sites

1 hour ago, Fengist said:

-snip-

Now I understand.  Ok, here's the good news and the bad news.

The good news.  A light like that would be easy to create.

The bad news. I'm not going to do it. Sorry

Here's why.  You're asking for a part that will conform to a specific hull size, 2.5m in your example.  Just off the top of my head, I can think of at least 6 different part sizes in KSP stock parts alone, maybe 7???   Now I have to ask myself, for the time and effort it would take to create 6 very specific lights, would they get used more or less often than a non-part specific light.  Would I be better off spending my time moddeling 6 lights that fit any part, or 6 lights with each fitting a specific part?  I think the former.  I may change my mind in the future tho.

-snip-

No problem there, I understand the workload would be a pain. :) Will be looking forward to that portable area light then! :)

Link to comment
Share on other sites

A quick update on the progress. @Li0n has a very rough and very early copy so he can attempt to integrate it into his mod.

Now, for pictures.

This shows something I was hoping I could do.  Some lights will have, by default, the blink ability turned off.  They may have another feature, pan and tilt.  Adjustable in the hangar will be pan and tilt speeds.  In the hangar or in flight, you can open a popup menu that will allow you to rotate and tilt the light.  You'll basically click the direction of rotation once to start it rotating and click again to stop it. This also means that, depending on how the light is set up, you can, for example, start it rotating and it'll keep rotating till you stop it.

8G90lu3.png

 

Edited by Fengist
Link to comment
Share on other sites

On 9/16/2017 at 1:23 AM, B-STRK said:

No problem there, I understand the workload would be a pain. :) Will be looking forward to that portable area light then! :)

Not exactly portable but... will collapsible work?

Mn9M6Gt.png

Un81DvS.png

 

Edited by Fengist
Link to comment
Share on other sites

Love the design, and the area lighting scheme! I guess when you said it's not portable, it could mean it's not something a Kerbal can carry in his inventory, but can carry on the Jetpack slot and still be lugged around?Or the mass would be too much even for the jetpack slot, and thus it's going to have to be tugged along on the ground (repetetive grab and drop) or carried in a container or a vehicle to get to its destination? Even if it's going to be bulky KIS-wise, though, the way I see it, that solution provides very good self-lighting for bases by mounting it at the high points in the editors (which makes the collapsability an essential feature for launch-from-Kerbin-in-fairing, and for additional altitude or standoff on deployment), in case KISing will be too much work on the ground. 

Speaking of which: are the post parts good for surface-attachable parts, or in order to plug in other parts (e.g., batt and power source) it's recommended to mount to a solid base part first?

Glad to see it! Thanks Fengist! (Now, at the risk of a mod beaning me on the head with a nightstick, ETA for launch? :P Kidding, I know it'll be out when it's all ready to go. :))

Edited by B-STRK
Link to comment
Share on other sites

18 minutes ago, B-STRK said:

Speaking of which: are the post parts good for surface-attachable parts, or in order to plug in other parts (e.g., batt and power source) it's recommended to mount to a solid base part first?

Glad to see it! Thanks Fengist! (Now, at the risk of a mod beaning me on the head with a nightstick, ETA for launch? :P Kidding, I know it'll be out when it's all ready to go. :))

Well, anything can be made portable if you use the KAS Module Grab.  I don't have any plans on adding that into the .cfg files when it comes out but, you're welcome to do so, and for that matter, Some of them would work pretty well as movable lights.

None of the lights will have a surface attach point nor will you be able to mount things on them.  You're free to change that in the .cfg files and, except for the animated ones, It shouldn't affect them. If you stick something to the animated ones, strange things could happen.

For now, the code is 98% finished.  It doesn't do everything I want but, the things I want could take a while to digest.  Right now, all of the .cfg files need to be gone through and updated to add in descriptions and such.  There's probably a couple more lights I want to create and after that, once LiOn gets back with me on whether I goofed my code up or not, it should be ready for an alpha. So, expect at least a few days, possibly a week.

Link to comment
Share on other sites

Just now, Fengist said:

Well, anything can be made portable if you use the KAS Module Grab.  I don't have any plans on adding that into the .cfg files when it comes out but, you're welcome to do so, and for that matter, Some of them would work pretty well as movable lights.

None of the lights will have a surface attach point nor will you be able to mount things on them.  You're free to change that in the .cfg files and, except for the animated ones, It shouldn't affect them. If you stick something to the animated ones, strange things could happen.

For now, the code is 98% finished.  It doesn't do everything I want but, the things I want could take a while to digest.  Right now, all of the .cfg files need to be gone through and updated to add in descriptions and such.  There's probably a couple more lights I want to create and after that, once LiOn gets back with me on whether I goofed my code up or not, it should be ready for an alpha. So, expect at least a few days, possibly a week.

Aight, will be looking forward to it!

Link to comment
Share on other sites

Uploaded the first beta to Curse.  Unfortunately, I have to get ready to do some RL work and Curse is still reviewing it.  As soon as they are done snooping into my .dll, it should be available for download via the link in the OP.  Please let me know if you find any bugs or have any suggestions.

*Edit

Still being approved.  Been 2 hours now.  Double checked the link and as soon as it doesn't throw an error it should be available for download.  For now tho, I'm off to work.

Edited by Fengist
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...