Frictional Games Forum (read-only)
Bare minimum to turn on/off a light in the game - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Open Source Collaboration (https://www.frictionalgames.com/forum/forum-27.html)
+--- Forum: Overture (https://www.frictionalgames.com/forum/forum-29.html)
+--- Thread: Bare minimum to turn on/off a light in the game (/thread-24588.html)



Bare minimum to turn on/off a light in the game - jorgeas80 - 02-10-2014

Hello,

I have a LEDs lamp that can be turned on using a C library. I mean: I can send my lamp messages like "use this RGB color during this amount of time". It accepts effects like flickering or fade too.

So, I have this lamp in my desk, and I want to "connect" the game with it. For example:
  • When the user turns on his lantern (or glowstick), my LEDs lamp turns on too, with the same color
  • When the user enters a place that contains a light, my LEDs lamp turns on too. I can control the fade (if I move closer to the light in the game, I can send more intensity to my LEDs lamp)

I've successfully compiled the code. And I can link with my C library. Now, I just want to work with the light part of the engine. Looks like there are 2 main classes I should work with:
  • GameLamp
  • PlayerHands

I guess I should modify the method FadeTo of iLight class, to send the proper RGB code and time to my lamp, using my own library's functions. So, any time a light is turned on in the game, is also turned on in my desk. Apart from that, am I missing something important, in order to achieve my goals?

I'm also adding a new menu entry to enable/disable my stuff, but this is a different story, involving MainMenu.cpp, mostly.

Any tip is appreciated. Many thanks in advance!


RE: Bare minimum to turn on/off a light in the game - jorgeas80 - 02-13-2014

Update: found Light class and children (Light2D, Light3D, Light3DSpot, Light3DPoint) in HPL1Engine code. Looks more promising.

Anyway, I'd like to know how many kinds of light exist in the game, to know if I should turn on my lamp with all of them, and how to turn it on. Examples:
  • A gun shot: quick white light
  • User turns on lantern: permanent white light (until the user turns it off)
  • User turns on glowstick: same logic, but with green light
  • User get close to a light (a torch, a lampost...): permanent light with an intensity (about the color, it depends on the kind of light. Example: a fire is red, a lamppost is white)
  • User get closer to that light: increase intensity on my lamp's light

Is there any place where I can find a list of all the lights in the game? And about the idea of include my code inside the Light class and/or its children: is it right?


RE: Bare minimum to turn on/off a light in the game - Gunslingerjh - 02-17-2014

Sounds interesting! Unfortunately programming is really not my thing.. I think someone from FG should check this out!


RE: Bare minimum to turn on/off a light in the game - jorgeas80 - 02-17-2014

Thanks! I'm learning a lot, and using my github fork to keep track of everything.

I'm now working to modify the HPL1Engine by adding calls to my library in certain points. It would be great if someone from FG could give me a hand, by just telling me where should I put my stuff. But I totally understand they're not paid for that.

Anyway, everything is open source. And I'll publish the mod when finished.