Re: Inform lighting tricks?


6 Jun 1995 19:52:23 +0100

In article <RICHARD.95Jun6173101@c351.wg.icl.co.uk> you write:
>In article <60.5657.4154.0N1E56B6@canrem.com> tim.middleton@canrem.com (Tim Middleton) writes:
>
> What is and good way in Inform to create a light source that illuminates
> several rooms at once? (ie. One switch controls lights for many rooms).
>
> I guess I could do some more elaborite programming of this lamp to literally
> grant "light" attribute to each room when it's turned on and take it away if
> it's turned off. This gets tricky because I want to have several lights and
> they overlap certain areas they illuminate. So if just one of the lamps is
> on then certain same areas will be lighted.
>
>i don't know if there is an easier way than this, given your requirement
>for several overlapping lamps. here's a sketch (in a hellish mixture of c
>and inform, i'm afraid):
>

This works well for static light-sources, like fluorescent light-strips.

How about carrying a lamp around with you that will illuminate adjoining
locations? (i.e. if you leave the lamp and go to a neighbouring location
you'll find it's lit).

A simple solution is to have a demon that goes through each compass
direction in turn, lighting or unlighting rooms.

Of course, you'd have to watch out for doors and such.

It's only realistic for the lamp to have this behaviour if, in fact, the
neighbouring location is 'close' to the location with the lamp. Some
locations might be very big, and you wouldn't want the light to spread
out from these.

There are several ways around this. You could have a property for each
location, an X-byte distance array, giving the distance from the current
location to the location in direction X. Maybe simply, a distance of 0
means that the location is close (the default), and 1 means it's fairly
far away. Maybe you could calculate actual distances in metres, or
something.

It's a lot of bother to code, I know, but it would look pretty good. You
could also use the distance array to do things like looking into nearby
locations (is it near enough to see?), seeing how far objects will go if
you throw them, doing a more realistic time system by updating the clock
according to how far the player has travelled,....

Luke