ID:153835
 
I'll get straight to the point - what would be the best way of managing lighting - and in particular, dynamic lighting?

It's easy enough to determine whether a turf should be lit by looping through all turfs in view() of any object that casts light, but how do you show the lighting without it lagging too much? What about different amounts of light?

Then there's dynamic lighting. What happens when somebody blows out a candle, or walks through a darkened room carrying a lamp? (This can be treated as basically the same question, but with added emphasis on speed.)
I'm thinking some sort of overlay method might do the trick. The viewable game world is covered with a completely black overlay. When (for example) a character carrying a lamp enters an area, you just remove the nearby overlays, and farther out replace black with an overlay with 'holes' in it (showing some of what is underneath) - giving a shadowy, or less lighted view of things in the distance.

Now how that affects performance, I haven't a clue byond-wise. Could be pretty laggy on a slower computer.
Depending on what you want to accomplish, you might be able to get the effect you desire by simply using the built-in lighting effects in creative ways.

For example, a flashlight would just have a list of three or four "beam" objects, with progressively greater luminosity (wider beam). Every half-second or so, if the flashlight is turned on, the flashlight recalculates the positions of the objects that comprise its beam.

Technically, the effect would be more like, say, carrying a 36-foot-long pole with a candle mounted every 12 feet... but that could be good enough, depending on the application.
In response to digitalmouse
Try using independent screen objects for every player, it'll work out better, trust me, I'm going to try to release my library within a few months.
In response to Gughunter
Too bad no one's ever used that flashlight idea! Seems like it would be a great addition to a scary game of hunter/hunted! ;-)
In response to Spuzzum
If we had a game like that among us, I'd play it!

-AbyssDragon
In response to Ter13
Now if only we could get the client to process screen objects instead of using up server CPU time, we'd be in business! :-) (Screen objects are processed by the server, right?)

I eagerly await this demo of yours...
In response to digitalmouse
A slightly different method using the same principal:
Instead of shuffling overlays, just have several areas for variable light levels. Each area has an icon for the shade of darkness it represents, and the layer is set high to obscure everything bud the game HUD. When a lightsource moves or changes it places the local turfs into the appropriate light areas. My Outside area demo shows how to change a turf's area and use the area icons to darken things.

With the overlay system, and even the screen object method, view() will still report atoms within the "dark" places. With the area shuffling, just set the luminosity of your darkest area to 0 and view() will work properly. :)

If you want to remove semi-dark areas from view, it's slightly trickier, but not much. Just use my_view_list = view()-semidark_area.contents to remove everything in the semidark_area from the view.

Perhaps I should write a demo?
In response to Shadowdarke
You can go ahead and write it, but I want to see that bad boy on my .dme file, not on paper!
In response to Shadowdarke
Shadowdarke wrote:
A slightly different method using the same principal:
Perhaps I should write a demo?

Yes... and then you should submit it to BYONDscape. :)
In response to Gughunter
Gughunter wrote:
Shadowdarke wrote:
A slightly different method using the same principal:
Perhaps I should write a demo?

Yes... and then you should submit it to BYONDscape. :)

Sounds like a good idea!
You can preview the system in action here: http://www.byond.com/hub/Shadowdarke/ sd_DynamicAreaLighting_Demo
In response to Shadowdarke
It don't have a place for it in my current game, but that looks bleeping cool. I like that method. =)
In response to Shadowdarke
Sweet! If this is on BYONDscape, I'ma resuscribe!
In response to Shadowdarke
Whoa... nice!

In response to Sariat
This is being used in my newest project, with a few changes. Go Darke!
In response to Polatrite
How can you use it? I thought it was just a demo...?
In response to Sariat
Well, it's going to be used when it's released, silly.
In response to Shadowdarke
Nuts. I was making my own system like this (using areas, even) for Haven for quite a while. Oh well... like patents, credit goes to whoever lets the public see it first, and Haven will likely not see the light of day for a very long time. ;-)
In response to Spuzzum
Haven will likely not see the light of day for a very long time. ;-)

Considering the subject, there's a joke here somewhere. I just wish I could think of it :-)

-AbyssDragon
In response to Spuzzum
Spuzzum wrote:
Nuts. I was making my own system like this (using areas, even) for Haven for quite a while. Oh well... like patents, credit goes to whoever lets the public see it first, and Haven will likely not see the light of day for a very long time. ;-)

Haven't you realized yet that all my best ideas are stolen from your subconscious mind? ;)
Page: 1 2