Set_light_ambient method?

Questions about how to create your own dungeons and replacement graphics and sounds.

Moderator: George Gilbert

Forum rules
Please read the Forum rules and policies before posting.
User avatar
Igor Poulpupov
Artisan
Posts: 167
Joined: Sun Dec 05, 2010 9:30 pm

Re: Set_light_ambient method?

Post by Igor Poulpupov »

I want to be able to decided exactly how a level is lighted and how to light it, independently from the previously casted spells.

Example of something working perfectly: the player casted several normal FUL and OH IR RA spells before (well, the normal behaviour). He enters that level. He finds himself in a very dark place, he can barely see what is around him, except in some places where there are lanterns on the walls (and obviously light objects in the editor). His lighting items turned useless (easy to do) and he can't cast any lighting spell (easy as well). The problem is: how to disable the previously casted light spells so the level always has the same darkness.

Fixing all the light level in the editor to, say, 60 doesn't work as I want: ok, it disables the previous light spells effect in that level, but even the light objects are not effective anymore.
User avatar
Saumun
High Lord
Posts: 2238
Joined: Fri Feb 20, 2009 3:03 am
Location: The Ether

Re: Set_light_ambient method?

Post by Saumun »

Ah... I see. You still want objects to affect the lighting. Sorry. misunderstood.

Even though it's of no use to you, i'll post this link anyway just to show the way i manipulated the light in Dark Reign 2.
The lighting is absolute and cannot be affected by spells/objects, and it's a little clunky because it uses teleports.... but it is quite nice how the light fades in and out as you move.

http://www.mediafire.com/download/t433u ... t_Test.zip
“Grynix Ernum Quey Ki Skebow Rednim U Os Dey Wefna Enocarn Aquantana” - Anon
User avatar
Igor Poulpupov
Artisan
Posts: 167
Joined: Sun Dec 05, 2010 9:30 pm

Re: Set_light_ambient method?

Post by Igor Poulpupov »

Nice trick. But I have some other things in the level that make a similar system impossible to use... I don't want to reveal what the whole riddle is about...

I forgot to say, I've found a solution that would probably work using the method described above (with all the beaaaauuuutiful colors). Instead of the act4 action, I would need relays activating 8 relays each activating 8 relays each activating several relays, so in the end 100 relays are activated. The relays only works with conditions based on the value of count1 (which is between 1 and 100). For example, if count1=36, the corresponding relay activates a corresponding action (so 100 actions are needed as well) that is a light_ambient action with strength 35 (count1-1).
Awful programming... It would probably work, but I don't know about how it would affect the dungeon timing (100+ relays activated at the same time every once in a while probably slows the game).
User avatar
Saumun
High Lord
Posts: 2238
Joined: Fri Feb 20, 2009 3:03 am
Location: The Ether

Re: Set_light_ambient method?

Post by Saumun »

It might be okay...
I did a complicated conditional relay/action setup in my last two dungeons affecting the rate at which potions wear off.
Despite being a completely different thing to what you are doing, it also activated a crazy number of relays every time a potion was consumed (165 i think... 5 relays for every character in the game (32) plus 5 more to activate everything).

There was no discernible slow down during play.
“Grynix Ernum Quey Ki Skebow Rednim U Os Dey Wefna Enocarn Aquantana” - Anon
User avatar
Igor Poulpupov
Artisan
Posts: 167
Joined: Sun Dec 05, 2010 9:30 pm

Re: Set_light_ambient method?

Post by Igor Poulpupov »

Allright, I tried finishing this solution to see how it feels. It's not DM, but it feels quite good and it provides a full control on the lighting. Yay.
Player point of view: casting FUL will set the lighting around the player at a level defined by the power rune: LO=very poor lighting, MON=very good lighting. So, unlike in DM, casting LO FUL after MON FUL would have a very negative effect... The light fades off continuously until a new spell is casted.
Dungeon creator point of view: fully controlable lighting everywhere, fully controlable fading speed. Many new open doors for riddles. Also, restricted power runes now affect the player's lighting capabilities.
Still to do: think about longer light and darkness/longer darkness spells (these would probably be easy to do... To be honest, I never use them). Simplify the coding (100+ relays+actions just for sending a single number to the action "strength" box...)
Source, test: here is a link to what I've done: http://www.mediafire.com/download/kdr7n ... t_light.7z . Only use FUL, no other lighting/darkening spells, they are not supported (I should have delete them). You can see the light level on some wall, and how fast it fades off. You'd like to see how the fading goes weirdly faster when the player keeps moving, I guess this happens with all the timed relay mechanisms in RTC.
Please tell me if you experience weird behaviours, as I'll very probably use this in my dungeon to come (maybe, some day).

PS: in my previous posts, I was wrong with the LIGHT_AMBIENT technique: it is not level dependent, it is carried through the dungeon by the player just as the normal LIGHT, they are just two independent lightings.
User avatar
Saumun
High Lord
Posts: 2238
Joined: Fri Feb 20, 2009 3:03 am
Location: The Ether

Re: Set_light_ambient method?

Post by Saumun »

Nice work Igor... Very nice!

So i'm guessing you'll fill the level with 'no magic' tiles and have lanterns light certain areas? With objects still able to emit light. Again.... Nice work!
“Grynix Ernum Quey Ki Skebow Rednim U Os Dey Wefna Enocarn Aquantana” - Anon
User avatar
Igor Poulpupov
Artisan
Posts: 167
Joined: Sun Dec 05, 2010 9:30 pm

Re: Set_light_ambient method?

Post by Igor Poulpupov »

This is a part of what the level will be, yes. For the rest, you'll see, in time. I think I'll try building some other riddles around this.

I just had a new idea. The main difference with the normal DM lighting system is that casting a spell sets the lighting instead of increasing it. But it should be very easy to turn what the spell I've done into a spell increasing the light level by doing this:
- the spell, instead of acting on the counter count1 that tracks the light level, acts on a new counter count3
- an addition technique, as built by Terkio here http://www.dungeon-master.com/forum/vie ... =6&t=29887 , adds the values in count1 and count3
- the result is sent to the already built system of relays. And that's it, everything else can be kept the same.

This would be even closer to DM lighting, but still fully controlable.

A dungeon designer could choose his favorite lighting spell system: setting or increasing. Or even better: use them both. That's what I'll do.
User avatar
terkio
Mon Master
Posts: 937
Joined: Tue Jul 10, 2012 8:24 pm

Re: Set_light_ambient method?

Post by terkio »

I like you refer to my adder.
A word of caution.
When I tried to embed my additon in a more complex mechanism ( the multiplication ) i had unexepted trouble, i was unable to overcome. I needed some end of addition signaling, that happened to be troublesome, giving weird illogical results.
"You can be on the right track and still get hit by a train!" Alfred E. Neuman
User avatar
Igor Poulpupov
Artisan
Posts: 167
Joined: Sun Dec 05, 2010 9:30 pm

Re: Set_light_ambient method?

Post by Igor Poulpupov »

@Terkio: I've been giving a try at your adder, it indeed works well for simple additions. For complicated systems, I guess you might get interferences if the values you're trying to add change during the addition (which, being based on looped relays, is not instantaneous). In this case you have to be very precise about the timing of all the relays... Except this, I can't see what problems you could get...

Well, I finally didn't have to use your adder for my controlable spell increasing the light: thanks to my set of relays that test my counter count1 value, a counter_increment action was sufficient.
So, here http://www.mediafire.com/download/ymsbi ... ight_v2.7z is a new version, probably what I'll use in my dungeon, that includes both spells: FUL sets the light, as in the previous version, and OH IR RA increases the light, similarly to the original FUL spell. I also corrected a small mistake (the condition in the last relay on the right column should have been an "equal_to" in the previous version), deleted the darkness spell and tried making the 'code' more readable. If just for using these spells as they are, the only thing you would want to change is the delay of the first relay at (9,2,0), which defines the fading speed. You can also add or delete lines of relays+actions, I arbitrarily set the maximum lighting at 120 (which appears to be the same as 100 but lasting longer), but you can do whatever you want on this.

I think I'll stop there: I won't add a darkness spell as it's way more complex than I thought. Since the darkness should fade as well, I'd need two parallel counters for lighting and darkening and so a c=a+b addition (not even an a=a+b), with several looped relays interacting and timing problems everywhere... just for a spell that won't be used. Same for longer light.
User avatar
terkio
Mon Master
Posts: 937
Joined: Tue Jul 10, 2012 8:24 pm

Re: Set_light_ambient method?

Post by terkio »

Who knows the timing, it's all guess work, there is no specification. I think I tried all possible assumptions, I gave up for good.
"You can be on the right track and still get hit by a train!" Alfred E. Neuman
Post Reply