generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Lighting from Top

Previous Thread :: Next Thread 
Crack498 is not online. Crack498
Joined: 16 Apr 2011
Total Posts: 69
25 Sep 2014 10:12 AM
I am making a 2d game.
I want te sun to make blocks that are on the surface to shine, and those that aren below a block gradually decreasing their light, making blocks pitch black if they are not close to the surface. But this has to be done ONLY using the lighting function.

Please if you don't understand what I'm trying to explain, ask me before refusing to help to this problem. Thanks
Report Abuse
Crack498 is not online. Crack498
Joined: 16 Apr 2011
Total Posts: 69
25 Sep 2014 10:12 AM
AKA Terraria/Starbound lighting
Report Abuse
Nyxis is not online. Nyxis
Joined: 15 Nov 2012
Total Posts: 3374
25 Sep 2014 10:17 AM
I have Terraria, but I haven't a clue what you're talking about. Then again.. I haven't played it in a long time.


a seal walked into a club
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
25 Sep 2014 10:18 AM
Use light sources infront of the blocks, and have it only reach a certain area around a lit part.
Report Abuse
Crack498 is not online. Crack498
Joined: 16 Apr 2011
Total Posts: 69
25 Sep 2014 10:21 AM
I mean this:
Blocks from top to bottom:

[]
[]
[]
[]
[]
[]
[]

Now their respective light:

[] - 1
[] - 0.8
[] - 0.6
[] - 0.4
[] - 0.2
[] - 0
[] - 0

That means that blocks that are exposed to the "Lighting sun" will be fully visible, but blocks that are hidden under other blocks will be partially visible depending on their position and if they are too hidden they will be pitch black.
Complicated to explain, easy to get. Search some images of "Terraria" and you will see how only terrain exposed to the sun is visible, while other being pitch black.
Report Abuse
Crack498 is not online. Crack498
Joined: 16 Apr 2011
Total Posts: 69
25 Sep 2014 10:22 AM
I've just said I need this to be done with the Roblox "Lighting" mechanic, not from in-game "Point lights" or "Spot lights"
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
25 Sep 2014 10:27 AM
Look I have Terraria and Starbound both. I know well what you mean, and I'm saying that's how I'd do it. Assuming 2(.5)D space, you still have your z value. Put a radial light infront of the line of blocks and set its distance to the correct value. I know that your next problem (The one you're actually asking about) is the sun and all I can say to that is to somehow block off areas infront and behind so that the sun doesn't illuminate the sides automatically. Alternatively, have the front facing away from the sun.
Report Abuse
Crack498 is not online. Crack498
Joined: 16 Apr 2011
Total Posts: 69
25 Sep 2014 10:34 AM
I need the light to be coming from the top, because if I built a house inside the radial light, it will look as "if the sun was inside my house", like there's already light inside the house when it should be dark because the roof blocks the light of the sun that is coming from the top.

I know, confusing.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
25 Sep 2014 10:37 AM
Write your own lighting script.
Inconvenient, but unless somebody else comes up with an idea that uses only the lighting then you're going to have a hard time.
Report Abuse
Crack498 is not online. Crack498
Joined: 16 Apr 2011
Total Posts: 69
25 Sep 2014 10:38 AM
Seems the best way to do it.
Thanks
Report Abuse
bob10110 is not online. bob10110
Joined: 09 Dec 2007
Total Posts: 679
25 Sep 2014 10:48 AM
Well, I don't have any code prepared, but I could shed some light (pun intended) on how this could be scripted...

First of all, there are two layers here to be aware of. The block layer that the player jumps around on, and a background layer. Both are important to getting the brightness/lighting to work correctly, unless you don't have caves in this game which you want to remain dark, in which case you only need the one block layer.

For each cell, you would need to check to see if it is "clear" on both the block and background layers, and if so, create a light source on that cell that propagates light to the surrounding blocks. The way I'm conceptualizing involves giving each block a "brightness value", which is incremented every time a check on some nearby cell gives it some light. The block's color can then be assigned a Color3Value based on this brightness value, capped at 100% brightness value.

Assuming the state of cells can change, there also needs to be a function to properly update the brightness of surrounding blocks when this happens. For ease of updating, it is preferable to keep the brightness value in terms of total nearby cells propagating light to it, and cap the Color3Value afterwards.

Hopefully someone picks this idea up and rolls with it. I'm a bit busy with other things at the moment.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image