Cave lighting

Content and general development discussion, including maps, quests, and server code from the development team.
User avatar
Jaxad0127
TMW Adviser
TMW Adviser
Posts: 4209
Joined: Thu Nov 01, 2007 6:35 pm
Location: Internet

Cave lighting

Post by Jaxad0127 » Tue Jul 01, 2008 3:14 pm

This is a continuation of the discussion from EJlol's candle.
Angeliex wrote:Player without candle is on map 1. Player with candle is on map 2.

(snip)

When entering the cave players without candles get send "You hear nothing but darkness..." to cover the map 1 - map 2 chat relation. And players with candles get sent to map 1, they light their candle then go to map 2.
Using multiple maps isn't a good idea. The reasons have been discussed a lot recently (look at the seasons topic in the suggestions forum).

Another idea is that players can benefit from other's candles, as well as there own. Multiple people/parties traveling together could use a single candle. When they meet another player/group that has one, the effect of the two candles combines and the field of view is larger (up to the outdoor limit, with some possible adjustment). This can be combined with fixed torches that are part of the map (and that themselves give off light like candles and player torches).
Image
User avatar
5t3v3
Novice
Novice
Posts: 451
Joined: Wed Oct 31, 2007 4:08 pm
Location: Belgium
Contact:

Re: Cave lighting

Post by 5t3v3 » Tue Jul 01, 2008 7:11 pm

I like the idea, I already mentioned in the past that the same should be done for miner's helmet
Also, it be nice that certain places like the snake-filled-mountains-caves or the mines second level which have torches, still do have the darkness over-layer with the exception of near the vicinity of the torches. As I recall it the reply I've gotten in the past, is that the over layer follows the character and thus can't be used for this purpose. Perhaps tmwserv could code two different overlayers, one that follows the player, and one that is dependent on sections of the map?
In game characters: "5t3v3" and "L "
User avatar
Shaggy
Novice
Novice
Posts: 132
Joined: Tue Apr 22, 2008 1:56 pm
Location: Liverpool, England

Re: Cave lighting

Post by Shaggy » Tue Jul 01, 2008 7:16 pm

We'd need an overlay for every char with a lamp, if that's the way to implement it.
Enjoyed The Mana World? Then check out Aethyra (http://www.aethyra.com).
User avatar
Jaxad0127
TMW Adviser
TMW Adviser
Posts: 4209
Joined: Thu Nov 01, 2007 6:35 pm
Location: Internet

Re: Cave lighting

Post by Jaxad0127 » Tue Jul 01, 2008 7:21 pm

Using that overlay multiple times isn't a good idea, as it's center is transparent and everything else is opaque. It also doesn't cover the entire map, so you would encounter a hard edge when you got close enough. Another idea is per-tile shading.
Image
User avatar
Shaggy
Novice
Novice
Posts: 132
Joined: Tue Apr 22, 2008 1:56 pm
Location: Liverpool, England

Re: Cave lighting

Post by Shaggy » Tue Jul 01, 2008 7:59 pm

Seems a lot better idea.
Enjoyed The Mana World? Then check out Aethyra (http://www.aethyra.com).
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: Thu Aug 25, 2005 5:08 pm
Location: Germany

Re: Cave lighting

Post by Crush » Tue Jul 01, 2008 9:08 pm

per tile shading would look bad because you would exactly see where one tile ends and where another tile starts.

The only solution for dynamic lightning would be to create the overlay image procedurally.
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
User avatar
5t3v3
Novice
Novice
Posts: 451
Joined: Wed Oct 31, 2007 4:08 pm
Location: Belgium
Contact:

Re: Cave lighting

Post by 5t3v3 » Wed Jul 02, 2008 4:22 pm

Shaggy wrote:We'd need an overlay for every char with a lamp, if that's the way to implement it.
Not really you 'd have the classical overlayer system for sandstorms and so on. And for cave lightning you just have one overlayer that isn't client based, but fixed to the map. The overlayer constantly checks the positions of all characters (and NPC or torches, although he needn't do that constantly) and make transparent/opaque accordingly. We could even have the position of lamp snakes count. After all these things are kept track of either way since they are displayed on the mini map, right?
In game characters: "5t3v3" and "L "
zick
Novice
Novice
Posts: 194
Joined: Wed Feb 21, 2007 4:30 am
Location: City Of Champions Again

Re: Cave lighting

Post by zick » Sun Jul 06, 2008 2:42 pm

What if every "object" placed on the map (torches, lamp posts, etc.) as well as enemies (like the lampsnake) as well equipment (like miners hat or a lightsaber :D ) has an ambiance mask image (basically a black shape) included in the spriteset that nullifies fogs of war or darkness overlays allowing you to see whats being hidden (hidden is too strong of a word, obscured is better) by that layer. Yes more work for sprite designers but an effective solution.
User avatar
Jaxad0127
TMW Adviser
TMW Adviser
Posts: 4209
Joined: Thu Nov 01, 2007 6:35 pm
Location: Internet

Re: Cave lighting

Post by Jaxad0127 » Sun Jul 06, 2008 6:21 pm

That wouldn't be anymore work for the sprite designers and would just be a client-side effect. I'm also going for a server side effect, where the server only sends you monster positions from lit areas. But it would work for most of the client visualizations.
Image
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: Thu Aug 25, 2005 5:08 pm
Location: Germany

Re: Cave lighting

Post by Crush » Sun Jul 06, 2008 6:56 pm

The lightning effects could also cause the player to know more than before because he sees the light emitted by some creatures and most players before the being gets into the normal view distance.

But the problem is rather the low-level technical implementation.

A lot of people don't realize that the current cave spotlight overlay doesn't make anything brighter but only the stuff outside of the spotlight darker. Doing the opposite can not be accomplished by normal alpha blitting.

We rather have to take a screen-filling image and selectively reduce the opacity. This means implement a new blitting mode which multiplies the opacity (on a scale between 0.0 and 1.0) of the destination image with the opacity of the source image. This is harder than it sounds because we can't rely on external libraries for low level abstraction and thus run in all kinds of portability problems.

But when we could make it work it could also be used for a lot of other things. Like making the over layer transparent around your character so that you can see it behind obstacles.
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
User avatar
Jaxad0127
TMW Adviser
TMW Adviser
Posts: 4209
Joined: Thu Nov 01, 2007 6:35 pm
Location: Internet

Re: Cave lighting

Post by Jaxad0127 » Mon Jul 07, 2008 1:32 am

One possibility is a reverse "opacity" map. Light creates black areas on a white lighting map. Application is just a simple subtraction and negative correction operation applied to the visible area: darker areas on the map remain more opaque (or visible) and lighter areas become more transparent (or darker).

With correct server-side codding, it would give too much away to those using it (only light in the players sight radius is visible).
Image
User avatar
Jaxad0127
TMW Adviser
TMW Adviser
Posts: 4209
Joined: Thu Nov 01, 2007 6:35 pm
Location: Internet

Re: Cave lighting

Post by Jaxad0127 » Mon Jul 07, 2008 6:31 am

I don't know why I thought that a reverse opacity map was needed. A regular opacity map (with dark being transparent and light being opaque and lights creating circles of white) could be used in the same way. This map could be used without any special coding. Just draw the area behind the game world (solid black), and draw the world with the lighting map as an opacity map.
Image
Lecter
Peon
Peon
Posts: 59
Joined: Tue Jun 24, 2008 11:58 pm

Re: Cave lighting

Post by Lecter » Mon Jul 07, 2008 6:48 am

Could use Wesnoth's fog of war, sight stuff, but in wesnoth sight is based to maximum movement, we could add a sight property, or the client would see whole map yet not show it to the player, or we could do like u said with an opacity map/efect over the map, in both case we'll have to check for maphacks.
Sight property would also be good for monsters
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: Thu Aug 25, 2005 5:08 pm
Location: Germany

Re: Cave lighting

Post by Crush » Mon Jul 07, 2008 2:34 pm

jaxad: The technical problems I mentioned wouldn't be solved by that. The problem is that SDL does not support any opacity maps.

Lecter: Any kind of client-sided hack protection can be hacked itself, no matter how you implement it. Relying on the client to conceal information from the player is careless. I thought about using lightning in a way that the lowest possible light is still enough to see the map features so that people who disable it haven't got any advantages.
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
User avatar
Jaxad0127
TMW Adviser
TMW Adviser
Posts: 4209
Joined: Thu Nov 01, 2007 6:35 pm
Location: Internet

Re: Cave lighting

Post by Jaxad0127 » Mon Jul 07, 2008 3:26 pm

The only advantage a hacked client would provide is no "fog of war" (which you would get by disabling this in the first place, so no hacking needed). The server would only send information about stuff that should be visible to the player, given the player's sight range and local lighting conditions.
Image
Post Reply