Cave lighting

Content and general development discussion, including quest scripts and server code. TMW Classic is a project comprising the Legacy tmwAthena server & the designated improved engine server based on evolHercules.


Forum rules

This forum houses many years of development, tracing back to some of the earliest posts that exist on the board.

Its current use is for the continued development of the server and game it has always served: TMW Classic.

User avatar
Jaxad0127
Manasource
Manasource
Posts: 4209
Joined: 01 Nov 2007, 17:35
Location: Internet

Cave lighting

Post by Jaxad0127 »

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
Warrior
Warrior
Posts: 451
Joined: 31 Oct 2007, 15:08
Location: Belgium
Contact:

Re: Cave lighting

Post by 5t3v3 »

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: 22 Apr 2008, 12:56
Location: Liverpool, England

Re: Cave lighting

Post by Shaggy »

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
Manasource
Manasource
Posts: 4209
Joined: 01 Nov 2007, 17:35
Location: Internet

Re: Cave lighting

Post by Jaxad0127 »

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: 22 Apr 2008, 12:56
Location: Liverpool, England

Re: Cave lighting

Post by Shaggy »

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: 25 Aug 2005, 16:08
Location: Germany

Re: Cave lighting

Post by Crush »

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
Warrior
Warrior
Posts: 451
Joined: 31 Oct 2007, 15:08
Location: Belgium
Contact:

Re: Cave lighting

Post by 5t3v3 »

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: 21 Feb 2007, 03:30
Location: City Of Champions Again

Re: Cave lighting

Post by zick »

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
Manasource
Manasource
Posts: 4209
Joined: 01 Nov 2007, 17:35
Location: Internet

Re: Cave lighting

Post by Jaxad0127 »

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: 25 Aug 2005, 16:08
Location: Germany

Re: Cave lighting

Post by Crush »

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
Manasource
Manasource
Posts: 4209
Joined: 01 Nov 2007, 17:35
Location: Internet

Re: Cave lighting

Post by Jaxad0127 »

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
Manasource
Manasource
Posts: 4209
Joined: 01 Nov 2007, 17:35
Location: Internet

Re: Cave lighting

Post by Jaxad0127 »

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
Novice
Novice
Posts: 59
Joined: 24 Jun 2008, 22:58

Re: Cave lighting

Post by Lecter »

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: 25 Aug 2005, 16:08
Location: Germany

Re: Cave lighting

Post by Crush »

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
Manasource
Manasource
Posts: 4209
Joined: 01 Nov 2007, 17:35
Location: Internet

Re: Cave lighting

Post by Jaxad0127 »

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