Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Bare minimum to turn on/off a light in the game
jorgeas80 Offline
Junior Member

Posts: 21
Threads: 7
Joined: Jan 2014
Reputation: 0
#1
Bare minimum to turn on/off a light in the game

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!
(This post was last modified: 02-10-2014, 02:29 PM by jorgeas80.)
02-10-2014, 02:26 PM
Website Find Reply
jorgeas80 Offline
Junior Member

Posts: 21
Threads: 7
Joined: Jan 2014
Reputation: 0
#2
RE: Bare minimum to turn on/off a light in the game

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?
(This post was last modified: 02-13-2014, 08:38 PM by jorgeas80.)
02-13-2014, 08:37 PM
Website Find Reply
Gunslingerjh Offline
Senior Member

Posts: 529
Threads: 48
Joined: Sep 2009
Reputation: 15
#3
RE: Bare minimum to turn on/off a light in the game

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

02-17-2014, 02:46 PM
Find Reply
jorgeas80 Offline
Junior Member

Posts: 21
Threads: 7
Joined: Jan 2014
Reputation: 0
#4
RE: Bare minimum to turn on/off a light in the game

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.
02-17-2014, 03:39 PM
Website Find Reply




Users browsing this thread: 1 Guest(s)