<h1>Zones<aclass="headerlink"href="#zones"title="Permalink to this headline">¶</a></h1>
<p>Say you create a room named <em>Meadow</em> in your nice big forest MUD. That’s all nice and dandy, but what if you, in the other end of that forest want another <em>Meadow</em>? As a game creator, this can cause all sorts of confusion. For example, teleporting to <em>Meadow</em> will now give you a warning that there are two <em>Meadow</em> s and you have to select which one. It’s no problem to do that, you just choose for example to go to <codeclass="docutils literal notranslate"><spanclass="pre">2-meadow</span></code>, but unless you examine them you couldn’t be sure which of the two sat in the magical part of the forest and which didn’t.</p>
<p>Another issue is if you want to group rooms in geographic regions. Let’s say the “normal” part of the forest should have separate weather patterns from the magical part. Or maybe a magical disturbance echoes through all magical-forest rooms. It would then be convenient to be able to simply find all rooms that are “magical” so you could send messages to them.</p>
<divclass="section"id="zones-in-evennia">
<h2>Zones in Evennia<aclass="headerlink"href="#zones-in-evennia"title="Permalink to this headline">¶</a></h2>
<p><em>Zones</em> try to separate rooms by global location. In our example we would separate the forest into two parts - the magical and the non-magical part. Each have a <em>Meadow</em> and rooms belonging to each part should be easy to retrieve.</p>
<p>Many MUD codebases hardcode zones as part of the engine and database. Evennia does no such distinction due to the fact that rooms themselves are meant to be customized to any level anyway. Below is a suggestion for how to implement zones in Evennia.</p>
<p>All objects in Evennia can hold any number of <aclass="reference internal"href="Tags.html"><spanclass="doc">Tags</span></a>. Tags are short labels that you attach to objects. They make it very easy to retrieve groups of objects. An object can have any number of different tags. So let’s attach the relevant tag to our forest:</p>
<p>You could add this manually, or automatically during creation somehow (you’d need to modify your @dig command for this, most likely). You can also use the default <codeclass="docutils literal notranslate"><spanclass="pre">@tag</span></code> command during building:</p>
<h2>Using typeclasses and inheritance for zoning<aclass="headerlink"href="#using-typeclasses-and-inheritance-for-zoning"title="Permalink to this headline">¶</a></h2>
<p>The tagging or aliasing systems above don’t instill any sort of functional difference between a magical forest room and a normal one - they are just arbitrary ways to mark objects for quick retrieval later. Any functional differences must be expressed using <aclass="reference internal"href="Typeclasses.html"><spanclass="doc">Typeclasses</span></a>.</p>
<p>Of course, an alternative way to implement zones themselves is to have all rooms/objects in a zone inherit from a given typeclass parent - and then limit your searches to objects inheriting from that given parent. The effect would be similar but you’d need to expand the search functionality to properly search the inheritance tree.</p>