Jump to content
The Dark Mod Forums

Recommended Posts

Posted

Creating a new thread for this as it was being discussed in an old beta-testing thread starting here: https://forums.thedarkmod.com/index.php?/topic/21822-beta-testing-high-expectations/&do=findComment&comment=490751

I suppose the main questions are:

  • when should this spawnarg be used, if at all?
  • why was it introduced in the first place?
  • Can we get it documented properly on the Wiki so misuse isn't propagated?

@stgatilov @Dragofer

 

  • Like 1
  • Thanks 1

TDM Community Github: https://github.com/thedarkmodcommunity

My fan missions: The Hare in the Snare, Part 1

The Lieutenant Series: In Plain Sight  High Expectations Foreign Affairs

  • 11 months later...
Posted (edited)

Seems no one's answered this yet. There's a section about it on the wiki page:

https://wiki.thedarkmod.com/index.php?title=Performance:_Essential_Must-Knows#AreaLock_(New_in_2.08)

Essentially it makes a model only render in the visleaf (visportal area) its origin or bounding box center is located in. This is an useful tool to improve performance, by ensuring a model or a light doesn't render through a wall when you don't want it to.

I was trying to use it on building modules to improve FPS which is how I found this thread. Sadly there are some limitations that don't allow customizing it as needed currently. I made a thread explaining the problem here:

 

Edited by MirceaKitsune
Posted

Yeah I'm aware of the use cases - I mainly used it for particles and preventing models from showing up through walls.  The point of the thread was to reveal why it was even created, as the thread I linked contains advice from @stgatilov to NOT use it at all: https://forums.thedarkmod.com/index.php?/topic/21822-beta-testing-high-expectations/page/10/#findComment-490707

If that's the advice, an explanation is needed and the Wiki updated.

 

  • Like 2

TDM Community Github: https://github.com/thedarkmodcommunity

My fan missions: The Hare in the Snare, Part 1

The Lieutenant Series: In Plain Sight  High Expectations Foreign Affairs

Posted

areaLock should definitely not be used on anything that moves, unless it's something like a func_bobbing or func_rotating that never exits its visleaf: On things like AI it would cause them to get cut off whenever they cross through a visportal, since the model will only show in the vis area its center is located in at that moment.

From what I'm seeing you only need to use it if you have a model / light / particle poking through a wall and know you don't need it to show on the other side of that wall. It's why I want it for building modules: As my thread explains they often poke through structural walls and you have exterior panels rendering from an enclosed room or vice-versa, however using the current implementation causes exterior panels to also not render outside if they cross a visportal between two buildings, hence my suggestion to allow area-locking based on location info too.

Posted

areaLock can be used for the sake of performance optimization, if you dare.

It was introduced because the engine detects which areas an entity/light belongs to conservatively. The good news is: the engine never fails in this regard. The bad news is: sometimes it puts an object to an area it does not intersect, resulting in more draws.

Of course, you should only apply this to static objects which cannot move.
Also I'd say better don't apply it to lights.
In my opinion the optimization is optional and can be disabled in the future, so you should not use it to change visual behavior. But people do, unfortunately 🤬

The main problem with cvar is that it is sometimes rather hard for a human to be sure an object does not poke into other areas. So occasionally we get bugs which are caused by the usage of this optimization. The bugs look suspiciously similar to culling bugs in the engine, which means I have to inspect them myself 😭 (since I changed culling code a lot).

Another theoretical issue is that the optimization heavily depends on how dmap produces area/portal graph. As you know, dmap is not very reliable thing 😁 There were already many changes to how dmap operates, some of them changed how mission is broken into areas. Such changes can break areaLock-optimized missions.

It was added by @Dragofer for outdoors optimization of his mission. And I am the one who opposes its popularization in the masses.


P.S. I had some ideas about how to improve areas detection in the engine, but most of them eventually stopped. Because I wanted them to work implicitly in 100% of the cases, but it did not work out.

For example, for a solid and connected object it is possible to check that bounding box does not cover visportals. If it does not, then it must be fully within one area and we can do areaLock automatically. That's because if it belongs to two areas, then you can trace a path along its surface which crosses area boundary outside visportals --- basically, the object intersects a wall.

The problem is how to detect which objects are solid and connected.
This optimization could be applied to moveables, but certainly not to particles: particles can punch through walls by design.

  • Like 3
Posted

Shouldn't mappers be able to solve 99% of such problems with either LOD (hide_distance) or func_portals (either with triggers, or portal_dist + func_statics, if they want to cover a closed portal with something)?

Posted
1 hour ago, peter_spy said:

Shouldn't mappers be able to solve 99% of such problems with either LOD (hide_distance) or func_portals (either with triggers, or portal_dist + func_statics, if they want to cover a closed portal with something)?

No.

Imagine you have an object near a wall. But the bounding box of the object punches through the wall, so it gets rendered even on the other side of the wall. This is typical case when areaLock is used, as far as I know.

And it gets worse if the wall is not axis-aligned, or not even planar.

  • Like 1
Posted

AreaLock seems like an useful feature so I hope it never gets disabled. Rather that mappers have complete information on how it works and what it does as to not misuse it.

The rule of course is you don't set it on anything that moves. Unless it's movement along a fixed path so the object doesn't touch any visportals, that movement should be safe if the entity is guaranteed to remain in the same vis area. You should only not enable it if the entity touches a visportal, as it will then become invisible and get cut off from the side its center isn't in.

Posted
3 hours ago, stgatilov said:

No.

Imagine you have an object near a wall. But the bounding box of the object punches through the wall, so it gets rendered even on the other side of the wall. This is typical case when areaLock is used, as far as I know.

And it gets worse if the wall is not axis-aligned, or not even planar.

Hmmm, to me it sounds like improper use of assets, or not thinking about playable space with assets in mind, modular or otherwise. Never had these problems because I was always able to make assets with proper origin point placement, and with certain grid in mind. Thanks for the explanation though.

Posted
5 hours ago, stgatilov said:

And it gets worse if the wall is not axis-aligned, or not even planar.

I observed the majority of issues with objects near diagonal walls, even when they were perfectly grid-aligned with the walls, or even some units apart from the wall. The engine seems to be very conservative by treating the entire bounding box of such diagonal walls as the boundary, rather than the actual wall itself. So objects quickly start to leak to the other side's visleaf when they begin to approach such walls.

You can see a very stark instance of this issue in the ship in Perilous Refuge, where almost the entire ship's contents leak to the exterior visleaf due to the many curved sealing walls. areaLock is crucial there.

  • Like 1

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

    • datiswous

      I moved from Manjaro Linux (rolling release) to Linux Mint (LTS). One of the reasons was that I found the updates a bit too often and long. But now on Mint I get updates every day, although they're usually small updates.
      · 3 replies
    • JackFarmer

      "Hidden Hands: Vitalic Fever" - new update available including subtitles & compressed briefing video (thanks to @datiswous) and several fixes.
      · 0 replies
    • Wolfmond

      🇬🇧

      2025-04-20
      I'd like to track my level design progress a bit more often now, so I'm using the feed in my profile here.
      I've been working intensively on Springheel's YouTube course over the past few days. I'm currently up to lesson 8. There is so much information that needs to be processed and practiced. 
      I have started to create my own house. As I don't have the imagination to create a good floor plan, I grabbed a floor plan generator from Watabou and experimented with it. I chose a floor plan that I will modify slightly, but at least I now have an initial idea. 
      I used two guards as a measuring tape: The rooms are two guards high. It turned out that I can simply double the number of boxes in DarkRadiant in grid size 8 that are drawn in the floor plan. 
      I practiced the simplest things on the floor plan first. Drawing walls, cutting walls, inserting doors, cutting out frames, creating VisPortals, furnishing rooms.
      I have had my first success in creating a book. Creating a book was easier than I thought. I have a few ideas with books. The level I'm creating will be more or less a chill level, just for me, where I'll try out a few things. I don't have an idea for my own mission yet. I want to start small first.
      For the cellar, I wanted to have a second entrance, which should be on the outside. I'm fascinated by these basement doors from the USA, I think they're called Bilco basement doors. They are very unusual in Germany, but this type of access is sometimes used for deliveries to restaurants etc., where barrels can be rolled or lifted into the cellar. 
      I used two Hatch Doors, but they got completely disoriented after turning. I have since got them reasonably tamed. It's not perfect, but it's acceptable. 
      In the cellar today I experimented with a trap door that leads to a shaft system. The rooms aren't practically finished yet, but I want to continue working on the floor plan for now. I'll be starting on the upper floor very soon.

      __________________________________________________________________________________
      🇩🇪

      2025-04-20

      Ich möchte nun mal öfters ein bisschen meinen Werdegang beim Leveldesign tracken, dazu nutze ich hier den Feed in meinem Profil.
      Ich habe mich in den vergangenen Tagen intensiv mit dem Youtube-Kurs von Springheel beschäftigt. Aktuell bin ich bis zu Lektion 8 gekommen. Das sind so viele Informationen, die erstmal verarbeitet werden wollen und trainiert werden wollen. 

      Ich habe mich daran gemacht, ein eigenes Haus zu erstellen. Da mir die Fantasie fehlt, einen guten Raumplan zu erstellen, habe ich mir einen Grundrissgenerator von Watabou geschnappt und damit experimentiert. Ich habe mich für einen Grundriss entschieden, den ich noch leicht abwandeln werde, aber zumindest habe ich nun eine erste Idee. 

      Als Maßband habe ich zwei Wächter genommen: Die Räume sind zwei Wächter hoch. Es hat sich herausgestellt, dass ich in DarkRadiant in Gittergröße 8 einfach die doppelte Anzahl an Kästchen übernehmen kann, die im Grundriss eingezeichnet sind. 

      Ich habe bei dem Grundriss erstmal die einfachsten Sachen geübt. Wände ziehen, Wände zerschneiden, Türen einsetzen, Zargen herausschneiden, VisPortals erstellen, Räume einrichten.

      Ich habe erste Erfolge mit einem Buch gehabt. Das Erstellen eines Buchs ging leichter als gedacht. Ich habe ein paar Ideen mit Bücher. Das Level, das ich gerade erstelle, wird mehr oder weniger ein Chill-Level, einfach nur für mich, bei dem ich ein paar Sachen ausprobieren werde. Ich habe noch keine Idee für eine eigene Mission. Ich möchte erst einmal klein anfangen.

      Beim Keller wollte ich gerne einen zweiten Zugang haben, der sich außen befinden soll. Mich faszinieren diese Kellertüren aus den USA, Bilco basement doors heißen die, glaube ich. Diese sind in Deutschland sehr unüblich, diese Art von Zugängen gibt es aber manchmal zur Anlieferung bei Restaurants etc., wo Fässer dann in den Keller gerollt oder gehoben werden können. 
      Ich habe zwei Hatch Doors verwendet, die allerdings nach dem Drehen vollkommen aus dem Ruder liefen. Inzwischen habe ich sie einigermaßen gebändigt bekommen. Es ist nicht perfekt, aber annehmbar. 
      Im Keller habe ich heute mit einer Falltür experimentiert, die zu einem Schachtsystem führt. Die Räume sind noch quasi nicht eingerichtet, aber ich möchte erstmal am Grundriss weiterarbeiten. In Kürze fange ich das Obergeschoss an.



      · 2 replies
    • JackFarmer

      On a lighter note, thanks to my cat-like reflexes, my superior puzzle skills and my perfect memory, I was able to beat the remastered version of "Tomb Raider: The Last Revelation" in a new superhuman record time of 23 h : 35 m, worship me!
      · 5 replies
    • Goblin of Akenash

      My mapping discord if anyone is interested, its more of a general modding thing rather than just for TDM 
      https://discord.gg/T4Jt4DdmUb

       
      · 0 replies
×
×
  • Create New...