[crossfire] Lighting changes.

Alex Schultz alex_sch at telus.net
Tue Mar 29 09:36:39 CST 2005


>
     
       The current lighting with max brightness of 4 is woefully outdated.  
     
     >
     
      It made sense back when the max map size was 11x11, and we only cared 
     
     >
     
      if a space was lit or not (and not how well lit).
     
     >
     
     
     >
     
       With 25x25 map sizes and graduated lighting, this doesn't work nearly 
     
     >
     
      so well.
     
     >
     
     
     >
     
       I'd personally like to see lighting reworked with many more levels.  
     
     >
     
      Perhaps 32 (0->31) as that fits nicely in 5 bits for client/server 
     
     >
     
      protocol purposes.
     
     
Yeah, I agree, (for one thing it would make the look of the circular 
lighting nicer).

>
     
     
     >
     
       Right now, darkness levels is calculated for each player.  This 
     
     >
     
      doesn't make a lot of sense.  Imagine scorn at night - the 
     
     >
     
      darkness/brightness for all the spaces are the same for all players, 
     
     >
     
      so there is no reason that how dark/bright the square is should be 
     
     >
     
      calculated for all the players.  So rather, just like there is a 
     
     >
     
      'light' value for each map space, a darkness field would be added, and 
     
     >
     
      the server woudl fill in those values universally.
     
     >
     
     
     Makes sense, and I think I know how to implement such. It wouldn't 
involve much more than moving some of the algorithms that are normally 
in los.c into map.c. I think I might be able to integrate this part of 
what you mention here into my lighting patch if you think that's a good 
idea.

>
     
      This also helps out the case of know if a creature is in a lighted 
     
     >
     
      space - simply can check the light level of the space - don't need to 
     
     >
     
      find light sources and calculate, etc.
     
     
Which would be good for the stuff in monster.c that you mentioned in you 
e-mail about my lighting patch

>
     
     
     >
     
       There are a couple oddities that would have to be handled:
     
     >
     
      1) players currently can see at least a few spaces on outdoor maps - 
     
     >
     
      this would need a little special handling.
     
     
I don't think that will be too hard to just adapt the existing los.c 
logic with very little changes to all of this in such a way that this 
part would be kept intact.

>
     
      2) Players that have see in dark effecively see everything as a little 
     
     >
     
      less dark - this could presumably be fairly easily handled
     
     
Yeah, that would definitely be a bit better than the existing see in 
dark code which is sort of ugly.

>
     
     
     >
     
       However, related to these changes would be changing how the client is 
     
     >
     
      notified of light changes.  Better effects can be done if the client 
     
     >
     
      knows where the light sources are - that'd actually use less bandwidth.
     
     
Very true, but that would require rather widespread changes to all of 
the lighting code, and we would still have to not sent the client data 
for that which that can't see at all which would depend on calculating 
lighting data on the server end. Also, we would still have to worry 
about monsters knowing about such lighting.

Very good ideas. I could try implementing the move from calculating 
lighting for each player to just for each map in my lighting patch if 
you think it's a good idea.

       --Alex Schultz (aka Rednaxela)

    
    


More information about the crossfire mailing list