Jump to content
The Dark Mod Forums

Oscar's little big problems.


Oszkár Winkler

Recommended Posts

Hi there taffers!

 

I start this topic because I recently began to work on a mission and don't want to stuck every time I don't know how to do things. I would like to ask you a big favor. If I'm stuck with something, I tell you here and we together find the solutions to the difficulties. Here is the first one:

 

I need a trigger or some kind of area effect which is able to sense the presense of different kind of entities like the player. When for example the player or a zombie is within this area, a light turns on, when he leaves it turns off. Just like in Thief 1 - The Lost City. The light fades on and off when Garrett arrives or leaves.

Winkler Studio: youtube.com/user/woszkar

Link to comment
Share on other sites

Hi there taffers!

 

I start this topic because I recently began to work on a mission and don't want to stuck every time I don't know how to do things. I would like to ask you a big favor. If I'm stuck with something, I tell you here and we together find the solutions to the difficulties.

 

Cool.

 

I need a trigger or some kind of area effect which is able to sense the presense of different kind of entities like the player. When for example the player or a zombie is within this area, a light turns on, when he leaves it turns off. Just like in Thief 1 - The Lost City. The light fades on and off when Garrett arrives or leaves.

 

Draw a brush to the area. Make it into an entity: trigger_multiple.

Check the spawnargs, I'm sure there is an option like anytouch or something to make it trigger if anyone goes inside that volume. Then have the entity to trigger a light. For a fading effect, you might need to use scripting or trigger_timer to trigger a light with a level-spawnarg.

Clipper

-The mapper's best friend.

Link to comment
Share on other sites

Cool.

 

 

 

Draw a brush to the area. Make it into an entity: trigger_multiple.

Check the spawnargs, I'm sure there is an option like anytouch or something to make it trigger if anyone goes inside that volume. Then have the entity to trigger a light. For a fading effect, you might need to use scripting or trigger_timer to trigger a light with a level-spawnarg.

 

Yes, scripting is necessary indeed. I already have a trigger_multiple, it covers the area, however when the player is inside the trigger, it continously turns the light on and off. How should I script this event? When inside, light is on, when leave the area, light is off.

Winkler Studio: youtube.com/user/woszkar

Link to comment
Share on other sites

I recommend a double invisible optional objective setup, one is a NOT. Extract and open up Heart and examine the brush where the the heart is destroyed in the sewer and the objectives related thereto. Using this method it can detect if you are in or out. It might call a script I forget. Let me know if you need any clarification when you examine it.

Link to comment
Share on other sites

I recommend a double invisible optional objective setup, one is a NOT. Extract and open up Heart and examine the brush where the the heart is destroyed in the sewer and the objectives related thereto. Using this method it can detect if you are in or out. It might call a script I forget. Let me know if you need any clarification when you examine it.

 

Hm... thanks but there will be many light sources like this on the map. Maybe it's wrong to handle it through the objectives system, isn't it? If someone got the time and build a very small map with this, I would really appreciate.

Winkler Studio: youtube.com/user/woszkar

Link to comment
Share on other sites

Hm... thanks but there will be many light sources like this on the map. Maybe it's wrong to handle it through the objectives system, isn't it?

 

I think that is not the way.

 

If someone got the time and build a very small map with this, I would really appreciate.

 

I won't build this, it is up to the mapper himself to labour to solve his map specific problems. I will gladly supply ideas to help solving the problem, however.

 

Here is one solution possibility:

8258130.png

Basically you have multiple trigger_multis. Some target an entity that only switches the light off. (a func_static with S&R effect light off) Some target an entity that turns the light on. You could call script entities that fade the light. I do not know how to script a fading light.

 

You arrange the trigger_multis like this and in principle they should switch the light on when the player goes near. When the player goes away, the light turns off.

Clipper

-The mapper's best friend.

Link to comment
Share on other sites

I have this working in multiple places in my WIP.

 

Here's a slimmed-down version of the script:

 



boolean area1LightsOn;
boolean area1Lock; // while switching lights, lock out other attempts to switch lights
float lightWaitTime = 1;

void area1_Lights_On()
{
if (area1LightsOn)
{
	return;	// do nothing if the lights are already on
}

while (area1Lock)
{
	sys.wait(lightWaitTime);
}

area1Lock = true;
area1LightsOn= true;

light_moving_ext lightObj = $light_torchflame_unlit_1;
lightObj.frob_ignite();

area1Lock = false;
}

void area1_Lights_Off()
{
if (!area1LightsOn)
{
	return;	// do nothing if the lights are already off
}

while (area1Lock)
{
	sys.wait(lightWaitTime);
}

area1Lock = true;
area1LightsOn = false;

light_moving_ext lightObj = $light_torchflame_unlit_1;
lightObj.frob_extinguish();

area1Lock = false;
}

void main()
{
// Lights and locks are initially off

area1LightsOn = false;
area1Lock = false;
} 

 

The blue trigger_multiples in Sotha's drawing would call "area1_Lights_On" and the red trigger_multiples would call "area1_Lights_Off". You'll have one pair of "lights_on"/"lights_off" for each such area in your map. So you might have:

 

"area1_Lights_On()" / "area1_Lights_Off()"

"area2_Lights_On()" / "area2_Lights_Off()"

etc.

 

Each area pair would control its own lights.

 

Hopefully that helps.

 

Good luck.

Link to comment
Share on other sites

The theory is absolutely clear to me. Two trigger multiples, one turns the light up, the other off. But that's not that simple. Even if I use Stim/Response function, something goes wrong. I already managed to do it but after one period the system shuts down. Help! :(

 

grayman: This script seems way too complicated to me but thanks for sharing. :)

Winkler Studio: youtube.com/user/woszkar

Link to comment
Share on other sites

What does this mean? How it fails?

 

This version does not work but should. Obviously I do something wrong. Could you take a look at it please?

 

http://dl.dropbox.com/u/6743066/light_test.zip

Winkler Studio: youtube.com/user/woszkar

Link to comment
Share on other sites

Has anyone ever been able to use S&R "turn light on" effect correctly?

 

Looks like the light gets turned off with the "turn off effect"

But the "turn on" never relights the light.

 

Is this a bug in the S&R system? I think I set everything correctly in this map:

http://www.mediafire.com/?dah3y9eapluw8f2

 

but the light turn on behavior does not work.

 

Any coder interested looking at this?

Clipper

-The mapper's best friend.

Link to comment
Share on other sites

..and here is oscar's problem solved. I had to use extinguishable light because of the possible bug. You might be able to shield it with from water arrows with some nodrawsolid.

http://www.mediafire...u156e1y17pirfwu

 

You can easily see how it is done.

trigger_multi targets a func_static object that has a SR response for triggering.

Then it results in the effect turn extinguishable light on.

 

Good thing with a torch light is the automatic fade it comes with.

 

You had set your version up incorrectly, the SR things do NOT go into the triggers themselves.

Clipper

-The mapper's best friend.

Link to comment
Share on other sites

..and here is oscar's problem solved. I had to use extinguishable light because of the possible bug. You might be able to shield it with from water arrows with some nodrawsolid.

http://www.mediafire...u156e1y17pirfwu

 

You can easily see how it is done.

trigger_multi targets a func_static object that has a SR response for triggering.

Then it results in the effect turn extinguishable light on.

 

Good thing with a torch light is the automatic fade it comes with.

 

You had set your version up incorrectly, the SR things do NOT go into the triggers themselves.

 

Thank you very much Sotha!

Winkler Studio: youtube.com/user/woszkar

Link to comment
Share on other sites

@SH

 

That's interesting! I was wondering how you managed to create such a large outdoor area in Winter Harvest.

"No proposition Euclid wrote,

No formulae the text-books know,

Will turn the bullet from your coat,

Or ward the tulwar's downward blow

Strike hard who cares—shoot straight who can—

The odds are on the cheaper man."

 

From 'Arithmetic on the Frontier' by Rudyard Kipling

Link to comment
Share on other sites

  • 1 month later...

Think I understand the visportal technologie, but to make sure, here are two pictures of a mapping situation to make it clear.

 

Am I right the key thing is to "close" every room with a visportal, so each room is a unique "world". If the player can see it's visportal, the room is rendered by the game engine. If not, it isn't. However it's not always required to "close" every region. So here is my question:

 

If I use "Picture A" version of visportalizing, then Room 1-2-3-4-5 are rendered in the same time, because the player can see the only visportal, which separates the rooms. If I use "Picture B", then only Room 5 and 4 is visible. Right?

post-3254-131313305727_thumb.jpg

post-3254-131313306416_thumb.jpg

Winkler Studio: youtube.com/user/woszkar

Link to comment
Share on other sites

Think I understand the visportal technologie, but to make sure, here are two pictures of a mapping situation to make it clear.

 

Am I right the key thing is to "close" every room with a visportal, so each room is a unique "world". If the player can see it's visportal, the room is rendered by the game engine. If not, it isn't. However it's not always required to "close" every region. So here is my question:

 

If I use "Picture A" version of visportalizing, then Room 1-2-3-4-5 are rendered in the same time, because the player can see the only visportal, which separates the rooms. If I use "Picture B", then only Room 5 and 4 is visible. Right?

 

I'm not sure, it depends what you mean by "world" and "seeing." It is not about seeing the visportal, but more like seeing through the visportal.

 

It is difficult to explain, but you can really easily see for yourself, how the visportalling works. Just map those examples and go ingame and use r_showportals 1 and r_showtris 4 (or 3, can remember now?) to see how the world is drawn.

 

Basically visportals limit the drawing. If you see a visportal, it is green. If you have a corridor with a visportal, nothing beyond that visportal gets drawn, except the things you see right through the visportal. (In other words, you see through the corridor, but the worldspawn brushes around the corridor block the view.) If there are two portals, the other portal remains closed (red) as long as it is not in the view of the first one. Simple.

 

In practice you want to put a visportal in each of your doorways & similar choke points. Since VP's dictate sound propagation (voices go through VP's) as well, you want to put VP's to corridor corners etc too. These help performance too if the corners obscure views.

Clipper

-The mapper's best friend.

Link to comment
Share on other sites

I'm not sure, it depends what you mean by "world" and "seeing." It is not about seeing the visportal, but more like seeing through the visportal.

 

It is difficult to explain, but you can really easily see for yourself, how the visportalling works. Just map those examples and go ingame and use r_showportals 1 and r_showtris 4 (or 3, can remember now?) to see how the world is drawn.

 

Basically visportals limit the drawing. If you see a visportal, it is green. If you have a corridor with a visportal, nothing beyond that visportal gets drawn, except the things you see right through the visportal. (In other words, you see through the corridor, but the worldspawn brushes around the corridor block the view.) If there are two portals, the other portal remains closed (red) as long as it is not in the view of the first one. Simple.

 

Thank you! Is it a problem if too many visportals can be seen in the same time?

Winkler Studio: youtube.com/user/woszkar

Link to comment
Share on other sites

Thank you! Is it a problem if too many visportals can be seen in the same time?

 

Most likely. I am not sure, but I think someone mentioned that too many VP's cause performance degradation. However, I am unsure how many are 'too much.'

 

Picture B is the correct way to do it and there is no excessive VP's in that case. Picture A is incorrect as there are no VP's in the smaller rooms. Sound propagation would be wrong and standing in any area in Room 4 would result in everything in the other smaller rooms to be drawn. In picture B case there is never a situation that everything in the small rooms is drawn at once.

 

However, in map design, it is a good idea to avoid long straight corridors with non-obstructed views. Doors help. Or L-shaped junctions.

 

I think if you follow this rule of a thumb:

In practice you want to put a visportal in each of your doorways & similar choke points. [...] you want to put VP's to corridor corners etc too.

 

You will never end up in a situation with too many VP's and your performance will probably be fine (depending on your overall map design, of course).

 

If you make a mansion like knighton's and make every single window open and accessable, then I think you are starting to approach a situation with too many VP's.

Clipper

-The mapper's best friend.

Link to comment
Share on other sites

If you make a mansion like knighton's and make every single window open and accessable, then I think you are starting to approach a situation with too many VP's.

 

While technically true, such designs (houses/mansions that can be seen from multiple sides at once) tend to have "poor" (e.g. not that good) performance because of the many details visible, and in this case having 50 vs 20 visportals doesn't make much difference.

 

The performance will of course go up if you remove visportals, but not asmuch as if you'd remove the window/door and replaced it by a wall (or painted on window).

 

So I would not worry about having too many visportals. If performance is poor, then you will find that optimizing worldspawn vs. func_static, or removing excessive details etc will help more than anything else.

 

One mroe trick that can be played with the "big mansion with lots of windows to look through" (if you don't want them all to be painted on) is to use auto-closing visportals.

 

http://wiki.thedarkmod.com/index.php?title=Visportals#Visportal_switches:_func_portals

 

This means that you can replace the open visporal with a static screenshot of the room behind it. This works best if the opening is small (window, vs. doble-sided glass door), the glass is warp+yellow (opposed to clear glass) and the room beyond it is dimply lit. The distance can also vary, you need probably to experiment with it to see when it looks ok.

 

With this technique you can close f.i. small tower windows high up, or something like that, so that not the entire tower inside is rendered when the player is on the street below, but still make it possible that the player can look out the window and see the sky f.i.

 

 

Sotha is right about the L-shaped corrirods, choke points like doors etc, tho. Definitely put a visportal in these all the time.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

can many lights still degrade system performance even if their corresponding leafs are closed? I can only assume that this would mean that lights will still cast shadows even in closed areas to avoid leaking light into areas where they should not throughout the entire map. or something like that.

 

I might try to implement something like these lightswitch triggers in my map if its a pretty big deal.

Link to comment
Share on other sites

This theory of mine is probably stupid but if we fix a visportal in front of the player entity which follows the player's movement, then the engine should always render only things in the player's angle of view. Or not?

Winkler Studio: youtube.com/user/woszkar

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.


  • Recent Status Updates

    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
×
×
  • Create New...