Language: 
To browser these website, it's necessary to store cookies on your computer.
The cookies contain no personal information, they are required for program control.
  the storage of cookies while browsing this website, on Login and Register.

Author Topic:  Map darkness setting  (Read 2903 times)

0 Members and 0 Guests are viewing this topic.

smacky

« on: 15, July 2009, 16:55:50 »
Quote from: Mapserv r1295
Looks like darkness 0 still needs to be specifically set on maps. The server doesn't default to darkness 0 if a value isn't given, while the editor assumes no value is darkness 0 and removes the line.

I think the default value for the editor should be -1 which means no setting, and leave darkness 0 intact. The server should treat no setting as -1, therefore setting the map to have no darkness. I think the server already does this behaviour, which would mean only the editor needs a change here.

Kind of.

In fact -1 means MAX_DARKNESS, which is currently 7. This is the default the server uses.

So when a map is loaded it is given darkness -1 to begin with. This is then overwritten by the darkness setting in the header, if any, for that map's true darkness.

The confusion comes because Gridarta defaults to darkness 0 (it used to be -1, IDK why it was changed). This is a problem because the server sees darkness 0 as a distinct value, meaning true dark. Gridarta however sees 0 as meaning no value so it does not write the header at all.

Hence darkness 0 maps are loaded by the server as darkness -1 (which means 7), and it is not possible to output a true dark map from Gridarta!

This could be fixed by having the server default to 0 and Gridarta going back to defaulting to -1.

Lippy

« Reply #1 on: 15, July 2009, 17:50:41 »
Ah, I was about to make a topic on this. Anyway you have cleared up on the specifics of the issue, as I was still using assumptions based on a little server/editor testing.

I was hoping Gridarta would see -1 as meaning no value (so that no header is written when the darkness is -1), and also default to -1. That way, no server change is needed.

Either way, both methods should fix it, which is the important thing. I'm a little surprised the discrepancy still exists, given the signs in those maps have been around for a while. I guess it was just one of those 'bugs' that was lost in time. :)
Current Project: Dynamic Widget Client (M1)

smacky

« Reply #2 on: 15, July 2009, 18:40:17 »
Hm, no -1 is important to be -1 as this way mappers can say 'let the server sort it out' and not need to know about the current value of MAX_DARKNESS. So if the server changes, the map will cope.

Also, for Gridarta to handle darkness -1 as no value and darkness 0 as an actual value would be a special case for Gridarta. This would upset Ragnor. ;)

The problem with my solution (which I think is actually a problem caused by the original Gridarta change  defaulting to 0 rather than -1) is it means that all maps with no specific darkness setting (all non-outdoors ones anyway; I think the gloomy patch will luckily prevent outdoors ones from breaking, but I'd need to check) would need to be loaded into the new Gridarta and resaved (or someone write a batch script to add darkness -1 to mapfiles without a darkness and outdoor 1 setting).

Otherwise these maps would turn from full daylight to total dark.

OTOH this is likely to be few maps (as most non-outdoors maps have a >0 darkness).

Lippy

« Reply #3 on: 15, July 2009, 19:06:52 »
Quote from: smacky
Hm, no -1 is important to be -1 as this way mappers can say 'let the server sort it out' and not need to know about the current value of MAX_DARKNESS. So if the server changes, the map will cope.
Yeah, that's what I wanted to achieve. Anyway, if it's not good for Gridarta, then I guess that wipes out my solution. In which case, your solution is imo the next best thing. It's a bit of a pain having to go over all the maps in order to fix this, especially after the recent background_music change. :P

Looks like we have no choice though. Guess it's time to buckle up once again for another breaking change. >:D
Current Project: Dynamic Widget Client (M1)

smacky

« Reply #4 on: 15, July 2009, 19:32:09 »
Yeah. I've put up a Gridarta bug report. Hopefully the number of maps needing a fix is minimal.

smacky

« Reply #5 on: 17, July 2009, 14:45:03 »
The problem with my solution (which I think is actually a problem caused by the original Gridarta change  defaulting to 0 rather than -1) is it means that all maps with no specific darkness setting (all non-outdoors ones anyway; I think the gloomy patch will luckily prevent outdoors ones from breaking, but I'd need to check) would need to be loaded into the new Gridarta and resaved (or someone write a batch script to add darkness -1 to mapfiles without a darkness and outdoor 1 setting).

As it stands, the Gloomy patch will not cope with this -- outdoors maps with no specific darkness (which is nearly all of them) would be plunged into inky blackness.

There are two solutions.

The first is much easier but IMO not the better one. That is I put into the server code a little exception for MAP_OUTDOORS(m) == 1 && MAP_DARKNESS(m) == 0, which essentially means that to the server outdoors 1 darkness 0 maps would be the same as outdoors 1 darkness 7. This actually isn't restrictive at all AFAICS because a variable lighting map with the cap at no light is pretty pointless anyway.

The second is to load/resave or batch process the mapfiles as above.

Either way it's very solvable once Gridarta is fixed.

Lippy

« Reply #6 on: 17, July 2009, 23:53:15 »
Yeah, I agree with you there. I also prefer the second solution since it doesn't involve workarounds. While I see no immediate problems with the first, it's always better to fix it properly imo in case we ever decide to revisit the darkness code in future for whatever reason.

The first solution could very well serve as something temporary until we finish going through all the maps, although on the other hand it may provide an excuse for us to forget about it, and mappers may think it is still OK to have outdoor maps with darkness 0 since it will still 'work' like it does now, and then wonder why it doesn't when we decide to remove the code at a later date. So this may end up going against us rather than help us.

It's probably better to do it all in one go. It's a bit of a pain, but it means less work/pain in the long run I suppose. The background music patch didn't really cause the world to end. :)
Current Project: Dynamic Widget Client (M1)

Lippy

« Reply #7 on: 19, July 2009, 15:31:24 »
Sorry about the double post, I just had to bump this thread somehow.

Anyway, when it's time to go over the maps and 'fix' them once the editor and server are patched, I think there may need to be a slight change of plan. Instead of just changing outdoor maps which currently have no darkness setting to include darkness -1, I think we may need to do the same to all indoor maps as well. The reason for this is that any indoor map that is intended to be pure dark should have darkness 0 already set. Also, there are indoor maps with no darkness set, such as the testmaps. This is the main reason why I posted, as if we just 'fixed' the outdoor maps, the testmaps would become pitch black, and I bet there will be some maps (mainly unofficial ones) that will also suffer from this as well.

I don't think that we should have any unwanted side-effects from this. With this slight change of plan, we simply go over the maps and check to see if they have no darkness set, and if so, add darkness -1 to them. It's actually simpler than the original plan, as we no longer need to check for the outdoor 1 line. And after that, we can optionally remove darkness 0 from any map that has it set, as it is then a redundant line.
Current Project: Dynamic Widget Client (M1)

Lippy

« Reply #8 on: 19, July 2009, 22:40:24 »
OK, triple post now. :)

I've just tested a script to fix the darkness on the beta 6 maps, and uploaded the changes to the SVN. It looks like it worked, so once the server and editor are patched, the rest of the maps are good to go. Hopefully, those map changes were what you were looking for.
Current Project: Dynamic Widget Client (M1)

smacky

« Reply #9 on: 20, July 2009, 13:35:43 »
Looks good. :)

Re darkness 0: This shouldn't be a problem as Gridarta has not been able to produce darkness 0 maps for a very long time, if ever, so the only darkness 0 maps in existence are ones where the mapper has edited the file in a text editor. So if a map is darkness 0 it must be intentional.

But anyway, this means as soon as Gridarta is fixed, we can just take the same action as with background_music (update the server, update the SVN map, release a new Mapmaker, post a note to Maps on how to update local maps).

Tags:
 

Related Topics

  Subject / Started by Replies Last post
6 Replies
1337 Views
Last post 09, May 2006, 02:46:58
by jlh
3 Replies
870 Views
Last post 26, October 2006, 05:41:00
by longir
2 Replies
1180 Views
Last post 28, October 2006, 18:21:10
by grommit
10 Replies
3197 Views
Last post 24, August 2010, 01:24:13
by smacky
3 Replies
960 Views
Last post 17, April 2015, 17:17:15
by smacky