Jump to content

Is it possible to change light levels?


Recommended Posts

...what the subject line says: I've been mucking around with this nonsense, and nothing seems to work. If I have a torch right on the other side of a door, and I open up that door, somehow the light does not flood into the darkness, and that is just crazy. I can have a light in the middle of a room, and if I set_terrain all around it with total blackness, the room is still lit. Is there any way around this?

Link to comment
Share on other sites

The game precalculates light levels, and does not; I think, update them when terrains and floors are changed.

 

Unless I'm forgetting something simple (which is always a possibility at this time of night), working around this requires dark magic. (If you choose to pursue this path, you may also want this formula; you can see how it's used in more sophisticated invocations like this one.)

Link to comment
Share on other sites

This is obviously nitpicking after having gotten the exact solution I wanted, but, it seems like light levels 4-6 all look the same.

 

Also, it looks like the Mac code can set the light of individual spaces, while the Windows code can only set the light of whole rows. Is there a way around that?

Link to comment
Share on other sites

I didn't look all that closely at this back when it was figured out, so I don't recall what the different light levels look like. It may also be the case that the values which can be set (0-6) don't correspond well to range of values the game normally uses. You'll probably just need to experiment and find the settings that come out the closest to what you wanted.

 

The difference between the two code examples isn't as big as it might appear; the loop in Lazarus' code is just an optimized form that executes a bit faster. The constant -8192 in the Mac code and -24688 in the Windows code serve the same purposes,

 

(And hey, that wasn't exactly a pun; that's my standard phrase for mentioning this technique. Which happened to have an amusing double meaning in this case. tongue )

 

EDIT: I just noticed that there is one other difference between the two examples: The Mac code is written for a 64 by 64 (large) town, while the Windows code seems to be intended for a 48 by 48 (medium) town, although I'm not sure it will actually work as it is. 64 by 64 is the underlying size for all towns, even if not all of it is used.

Link to comment
Share on other sites

Well it definitely works for a medium town, if you just change the range of the loop it should work for a large town as well.

 

Also I don't think I've ever seen the auto detection or item weight check code, pretty cool. If you ever want to combine your platform detection and mac light with my windows light, and post it as a universal light change, then be my guest.

 

Edit: As to getting light changes to show up. I think you need to start with a town that's completely dark (like you need torches) and then go up from there.

 

Edit2: No wait maybe I lied. I only have one working example of this and it's from Threnody, I looked at it again and apparently I had a fully lit underground town, and used z values of 2 (dark) and 5 (lit.) I remember being pleased with the results, so the difference should be noticeable. Remember you're not going to be able to get a town as bright as surface day, because you have to use underground towns. It's been a long time since I've played with this stuff so that's the best I can tell you.

Link to comment
Share on other sites

I understand the bits in your two edits. I guess what I was asking was if you know where the range for the loop should begin... I tried subtracting 1792 (ie 48^2 - 64^2) from the minimum and adding it to the maximum, but neither worked. Though, I'm using Mac, so someone else may want to try this.

 

Also, since you two seem to know these things: Is there any way to clear the automap? I found one for Mac here:

http://blades.ermarian.net/script/code-snippet/clear-automap-mac

But, it really would be nice to find one for Windows.

Link to comment
Share on other sites

Originally Posted By: Lazarus
Niemand, is that forum on SV about this stuff still up? It was hidden before so I don't think anyone can see it at the archive, since we can't log in anymore.

It is not. I saved the material, but it isn't in a conveniently usable form. I'm still trying to decide what exactly to do with it.
Link to comment
Share on other sites

Originally Posted By: Handyman
Well, Lazarus, your change causes the Mac version of BoA to flunk and badly, but you probably know that... if this goes to beta-testing, I'll have to have a PC user.

In case it wasn't already clear, what you're running into is the fact that the different versions of the game need different constants to achieve the same results. The reason that I linked to the 'platform-autodetection' snippet is that it can tell you when the game is running which version it is, which then lets you run the right version of the code for it.

Quote:
And, I don't really know what I could do to help with this PC automap clear; but it'd be really, really cool.

I'll see if I can take another stab at this tomorrow. While there are fancier tricks available (which we cannot talk about here), the simplest approach is to just try varying the numbers in the code, running it, and seeing what happens, if you're interested in trying it yourself.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...