Jump to content
The Dark Mod Forums

hiding/unhidding entities


Darkman

Recommended Posts

hi guys!

 

i hope that anybody can help me out... so here's the base problem:

 

situation: think of a map with one indoor and one outdoor area; the outdoor area contains some big trees. both areas are connected by some kind of hallway, tunnel or whatever. the task i demand help for is about hiding all the trees in the outer area as long as the player is located inside the inner area.

 

 

this aim refers to having some trees rendered even if the player sneaks through the indoor by default - although they are located in a complete different visportaled and so culled place. for the moment, just believe me that this is not caused by internal leaks but lies in the engine's responsibility. so i'm aiming for hiding the trees as soon as the player reaches the indoor area (forget the LOD-system, as this solution would require some distance) and unhiding them as he gets close to the other place.

 

by default, this can be done by simply triggering the tree-entities (sets "hide" to "1"); another triggering-effect unhides them. so, there should be 2 triggers in the hallway: one sitting close to the indoor-entrance and hiding the trees and one sitting close to the outdoor-entrance and unhiding them.

 

and here lies the problem: i'm only capable of creating triggers/multitriggers that, as soon as the player runs into them, trigger the trees. but that only changes the hiding-state, whatever it is at that moment - so if you run into the same trigger twice, that state isn't really changed after all. that's why i need one trigger only to be capable of saying "hide" and another trigger only being able to say "unhide".

 

of course i'm also open for any other ideas, like a script maybe of whatever... but i hope that i was at least able to carve out the problem itself... rolleyes.gif

 

 

 

oh and one further question: am i right that hidden objects do nearly have zero performance-impact (no polygons/shadows/cm performed as long as they are hidden) ?!

Edited by Darkman
Link to comment
Share on other sites

put a visportal at the end of the opening to the outside world, then another visportal further on down the hallway, if looking towards opening to outside, only trees seen through opening drawn, face the other way and trees not drawn.

Link to comment
Share on other sites

Check the wiki article for location settings. You can achieve exactly what you need with the script call thingies: when the player enters the location you want, a script is called, which just triggers the hideable entities. You can have the same script called when the player leaves the area.

 

I think I wrote an example dealing with a thunder switch in the end of the location setting article.

 

Good luck!

 

Edit: yeah I think hidden thingies do not drain performance.

Clipper

-The mapper's best friend.

Link to comment
Share on other sites

@stumpy: looks like you missunderstood me.

 

VP's do not help here, as the error lies in the engine still rendering trees which are fully located in a leaf where the player is not in - even if all matching VP's are closed and that leaf is culled for that reason (well, except it's trees)... as i experienced, this can mainly happen where large func_statics are sitting behind but close to a leaf-border which separates the player's leaf from the one with such func_statics. so at the very end i look for a possibility to somehow force the engine not to render func_statics (under the mentioned circumstances)...

 

 

@sotha: perfect! that's exactly that i was looking for!

 

as a result of your link to the wiki-files, i was really able to create a testmap where trees (sitting in the courtyard) were hidded while the player was inside a building - including model, shadows and collision model. Once he left the building and so entered the courtyard, the trees were unhidden. smile.gif

 

that will later give me to chance to optimise my map through connecting func_statics to fewer but bigger ones and still force the engine not to render these, as long as not necessary.

 

 

@both: thanks a lot! you two became my heros now laugh.gif

Edited by Darkman
Link to comment
Share on other sites

It's possible that the bounding box of the model is sticking into an area that is still open. That is the ONLY reason I can think of that the model would not be culled if the geometry is properly sealed and portalled.

If so possibly rotating the model so the bounding box doesn't cross areas might help.

 

f_s's will do it if they extend into an open area or is only a little part of them is visible the entire f_s will show. Up to author to divide them up as needed

Dark is the sway that mows like a harvest

Link to comment
Share on other sites

It's possible that the bounding box of the model is sticking into an area that is still open. That is the ONLY reason I can think of that the model would not be culled if the geometry is properly sealed and portalled.

If so possibly rotating the model so the bounding box doesn't cross areas might help.

 

f_s's will do it if they extend into an open area or is only a little part of them is visible the entire f_s will show. Up to author to divide them up as needed

 

well, the engine would render such a func_static under those circumstances, that's surely correct.

 

 

however, fs's may also be rendered by the reason i mentioned above. i figured out, that the chance for such "render-errors" raises especially in relation to the thickness of leaf-brushes and the entities' tallness and position:

 

- the error mainly occurs when a small distance between leafs/leafborders (in my case: one box at grid size 8 = 8 units) meets with tall objects (in my case: largest version of a pine with leaves) which additionally are located close behind to such a small leaf-border (in my case: ~a gap of about max. 5 meters).

- the chance raises even higher, when such a leafborder is drawn by diagonal brushes, rather than by straight ones.

 

but do not regard this as an exact rule...

Link to comment
Share on other sites

@Darkman: Btw, instead of "triggering" the entities to hide/unhide them, you should use the $entity->hide() and show() script events in the script function that you are calling from the location triggers. That way their presence does not depend on their current state (or things can get out of sync for whatever reasons).

 

// Makes this entity invisible.
scriptEvent     void    hide();

// Makes this entity visible if it has a model.
scriptEvent     void    show();

"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

@Darkman: Btw, instead of "triggering" the entities to hide/unhide them, you should use the $entity->hide() and show() script events in the script function that you are calling from the location triggers. That way their presence does not depend on their current state (or things can get out of sync for whatever reasons).

 

// Makes this entity invisible.
scriptEvent 	void    hide();

// Makes this entity visible if it has a model.
scriptEvent 	void    show();

 

 

yeah, that's even better as possible errors will be merged when leaving/entering a zone again. sounds reasonable... thanks! smile.gif

 

i have allready rewritten my testscript/testmap, works like intended

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

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 5 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...