<h1>Wilderness system<aclass="headerlink"href="#wilderness-system"title="Permalink to this headline">¶</a></h1>
<p>Contribution by titeuf87, 2017</p>
<p>This contrib provides a wilderness map without actually creating a large number
of rooms - as you move, you instead end up back in the same room but its description
changes. This means you can make huge areas with little database use as
long as the rooms are relatively similar (name/desc changing).</p>
<sectionid="installation">
<h2>Installation<aclass="headerlink"href="#installation"title="Permalink to this headline">¶</a></h2>
<p>This contrib does not provide any new commands. Instead the default <codeclass="docutils literal notranslate"><spanclass="pre">py</span></code> command
is used to call functions/classes in this contrib directly.</p>
</section>
<sectionid="usage">
<h2>Usage<aclass="headerlink"href="#usage"title="Permalink to this headline">¶</a></h2>
<p>A wilderness map needs to created first. There can be different maps, all
with their own name. If no name is provided, then a default one is used. Internally,
the wilderness is stored as a Script with the name you specify. If you don’t
specify the name, a script named “default” will be created and used.</p>
<divclass="highlight-none notranslate"><divclass="highlight"><pre><span></span>@py from evennia.contrib.grid import wilderness; wilderness.create_wilderness()
</pre></div>
</div>
<p>Once created, it is possible to move into that wilderness map:</p>
<divclass="highlight-none notranslate"><divclass="highlight"><pre><span></span>@py from evennia.contrib.grid import wilderness; wilderness.enter_wilderness(me)
</pre></div>
</div>
<p>All coordinates used by the wilderness map are in the format of <codeclass="docutils literal notranslate"><spanclass="pre">(x,</span><spanclass="pre">y)</span></code>
tuples. x goes from left to right and y goes from bottom to top. So <codeclass="docutils literal notranslate"><spanclass="pre">(0,</span><spanclass="pre">0)</span></code>
is the bottom left corner of the map.</p>
</section>
<sectionid="customisation">
<h2>Customisation<aclass="headerlink"href="#customisation"title="Permalink to this headline">¶</a></h2>
<p>The defaults, while useable, are meant to be customised. When creating a
new wilderness map it is possible to give a “map provider”: this is a
python object that is smart enough to create the map.</p>
<p>The default provider, <codeclass="docutils literal notranslate"><spanclass="pre">WildernessMapProvider</span></code>, just creates a grid area that
is unlimited in size.
This <codeclass="docutils literal notranslate"><spanclass="pre">WildernessMapProvider</span></code> can be subclassed to create more interesting
maps and also to customize the room/exit typeclass used.</p>
<p>There is also no command that allows players to enter the wilderness. This
still needs to be added: it can be a command or an exit, depending on your
needs.</p>
</section>
<sectionid="example">
<h2>Example<aclass="headerlink"href="#example"title="Permalink to this headline">¶</a></h2>
<p>To give an example of how to customize, we will create a very simple (and
small) wilderness map that is shaped like a pyramid. The map will be
provided as a string: a “.” symbol is a location we can walk on.</p>
<p>Let’s create a file <codeclass="docutils literal notranslate"><spanclass="pre">world/pyramid.py</span></code>:</p>
<p>Now we can use our new pyramid-shaped wilderness map. From inside Evennia we
create a new wilderness (with the name “default”) but using our new map provider:</p>
<divclass="highlight-none notranslate"><divclass="highlight"><pre><span></span>py from world import pyramid as p; p.wilderness.create_wilderness(mapprovider=p.PyramidMapProvider())
py from evennia.contrib import wilderness; wilderness.enter_wilderness(me, coordinates=(4, 1))
</pre></div>
</div>
</section>
<sectionid="implementation-details">
<h2>Implementation details<aclass="headerlink"href="#implementation-details"title="Permalink to this headline">¶</a></h2>
<p>When a character moves into the wilderness, they get their own room. If they
move, instead of moving the character, the room changes to match the new
coordinates. If a character meets another character in the wilderness, then
their room merges. When one of the character leaves again, they each get their
own separate rooms. Rooms are created as needed. Unneeded rooms are stored away
to avoid the overhead cost of creating new rooms again in the future.</p>
<hrclass="docutils"/>
<p><small>This document page is generated from <codeclass="docutils literal notranslate"><spanclass="pre">evennia/contrib/grid/wilderness/README.md</span></code>. Changes to this
file will be overwritten, so edit that file rather than this one.</small></p>