evennia/docs/1.0-dev/Howtos/Beginner-Tutorial/Part2/Planning-Some-Useful-Contribs.html
Evennia docbuilder action 3165f49b4c Updated HTML docs
2022-02-06 18:34:09 +00:00

370 lines
No EOL
25 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>Planning the use of some useful contribs &#8212; Evennia 1.0-dev documentation</title>
<link rel="stylesheet" href="../../../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/language_data.js"></script>
<link rel="shortcut icon" href="../../../_static/favicon.ico"/>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="Planning our tutorial game" href="Planning-The-Tutorial-Game.html" />
<link rel="prev" title="On Planning a Game" href="Game-Planning.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="Planning-The-Tutorial-Game.html" title="Planning our tutorial game"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="Game-Planning.html" title="On Planning a Game"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howtos</a> &#187;</li>
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> &#187;</li>
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part2-Intro.html" accesskey="U">Part 2: What we want</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Planning the use of some useful contribs</a></li>
</ul>
<div class="develop">develop branch</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section class="tex2jax_ignore mathjax_ignore" id="planning-the-use-of-some-useful-contribs">
<h1>Planning the use of some useful contribs<a class="headerlink" href="#planning-the-use-of-some-useful-contribs" title="Permalink to this headline"></a></h1>
<p>Evennia is deliberately bare-bones out of the box. The idea is that you should be as unrestricted as possible
in designing your game. This is why you can easily replace the few defaults we have and why we dont try to
prescribe any major game systems on you.</p>
<p>That said, Evennia <em>does</em> offer some more game-opinionated <em>optional</em> stuff. These are referred to as <em>Contribs</em>
and is an ever-growing treasure trove of code snippets, concepts and even full systems you can pick and choose
from to use, tweak or take inspiration from when you make your game.</p>
<p>The <a class="reference internal" href="../../../Contribs/Contribs-Overview.html"><span class="doc std std-doc">Contrib overview</span></a> page gives the full list of the current roster of contributions. On
this page we will review a few contribs we will make use of for our game. We will do the actual installation
of them when we start coding in the next part of this tutorial series. While we will introduce them here, you
are wise to read their doc-strings yourself for the details.</p>
<p>This is the things we know we need:</p>
<ul class="simple">
<li><p>A barter system</p></li>
<li><p>Character generation</p></li>
<li><p>Some concept of wearing armor</p></li>
<li><p>The ability to roll dice</p></li>
<li><p>Rooms with awareness of day, night and season</p></li>
<li><p>Roleplaying with short-descs, poses and emotes</p></li>
<li><p>Quests</p></li>
<li><p>Combat (with players and against monsters)</p></li>
</ul>
<section id="barter-contrib">
<h2>Barter contrib<a class="headerlink" href="#barter-contrib" title="Permalink to this headline"></a></h2>
<p><a class="reference internal" href="../../../api/evennia.contrib.game_systems.barter.html"><span class="doc std std-doc">source</span></a></p>
<p>Reviewing this contrib suggests that it allows for safe trading between two parties. The basic principle
is that the parties puts up the stuff they want to sell and the system will guarantee that these systems are
exactly what is being offered. Both sides can modify their offers (bartering) until both mark themselves happy
with the deal. Only then the deal is sealed and the objects are exchanged automatically. Interestingly, this
works just fine for money too - just put coin objects on one side of the transaction.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Sue &gt; trade Tom: Hi, I have a necklace to sell; wanna trade for a healing potion?
Tom &gt; trade Sue: Hm, I could use a necklace ...
&lt;both accepted trade. Start trade&gt;
Sue &gt; offer necklace: This necklace is really worth it.
Tom &gt; evaluate necklace:
&lt;Tom sees necklace stats&gt;
Tom &gt; offer ration: I don&#39;t have a healing potion, but I&#39;ll trade you an iron ration!
Sue &gt; Hey, this is a nice necklace, I need more than a ration for it...
Tom &gt; offer ration, 10gold: Ok, a ration and 10 gold as well.
Sue &gt; accept: Ok, that sounds fair!
Tom &gt; accept: Good! Nice doing business with you.
&lt;goods change hands automatically. Trade ends&gt;
</pre></div>
</div>
<p>Arguably, in a small game you are just fine to just talk to people and use <code class="docutils literal notranslate"><span class="pre">give</span></code> to do the exchange. The
barter system guarantees trading safety if you dont trust your counterpart to try to give you the wrong thing or
to run away with your money.</p>
<p>We will use the barter contrib as an optional feature for player-player bartering. More importantly we can
add it for NPC shopkeepers and expand it with a little AI, which allows them to potentially trade in other
things than boring gold coin.</p>
</section>
<section id="clothing-contrib">
<h2>Clothing contrib<a class="headerlink" href="#clothing-contrib" title="Permalink to this headline"></a></h2>
<p><a class="reference internal" href="../../../api/evennia.contrib.game_systems.clothing.html"><span class="doc std std-doc">source</span></a></p>
<p>This contrib provides a full system primarily aimed at wearing clothes, but it could also work for armor. You wear
an object in a particular location and this will then be reflected in your characters description. You can
also add roleplaying flavor:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>&gt; wear helmet slightly askew on her head
look self
Username is wearing a helmet slightly askew on her head.
</pre></div>
</div>
<p>By default there are no body locations in this contrib, we will need to expand on it a little to make it useful
for things like armor. Its a good contrib to build from though, so thats what well do.</p>
</section>
<section id="dice-contrib">
<h2>Dice contrib<a class="headerlink" href="#dice-contrib" title="Permalink to this headline"></a></h2>
<p><a class="reference internal" href="../../../api/evennia.contrib.rpg.dice.html"><span class="doc std std-doc">source</span></a></p>
<p>The dice contrib presents a general dice roller to use in game.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>&gt; roll 2d6
Roll(s): 2 and 5. Total result is 7.
&gt; roll 1d100 + 2
Roll(s): 43. Total result is 47
&gt; roll 1d20 &gt; 12
Roll(s): 7. Total result is 7. This is a failure (by 5)
&gt; roll/hidden 1d20 &gt; 12
Roll(s): 18. Total result is 17. This is a success (by 6). (not echoed)
</pre></div>
</div>
<p>The contrib also has a python function for producing these results in-code. However, while
we will emulate rolls for our rule system, well do this as simply as possible with Pythons <code class="docutils literal notranslate"><span class="pre">random</span></code>
module.</p>
<p>So while this contrib is fun to have around for GMs or for players who want to get a random result
or play a game, we will not need it for the core of our game.</p>
</section>
<section id="extended-room-contrib">
<h2>Extended room contrib<a class="headerlink" href="#extended-room-contrib" title="Permalink to this headline"></a></h2>
<p><a class="reference internal" href="../../../api/evennia.contrib.grid.extended_room.html"><span class="doc std std-doc">source</span></a></p>
<p>This is a custom Room typeclass that changes its description based on time of day and season.</p>
<p>For example, at night, in wintertime you could show the room as being dark and frost-covered while in daylight
at summer it could describe a flowering meadow. The description can also contain special markers, so
<code class="docutils literal notranslate"><span class="pre">&lt;morning&gt;</span> <span class="pre">...</span> <span class="pre">&lt;/morning&gt;</span></code> would include text only visible at morning.</p>
<p>The extended room also supports <em>details</em>, which are things to “look at” in the room without there having
to be a separate database object created for it. For example, a player in a church may do <code class="docutils literal notranslate"><span class="pre">look</span> <span class="pre">window</span></code> and
get a description of the windows without there needing to be an actual <code class="docutils literal notranslate"><span class="pre">window</span></code> object in the room.</p>
<p>Adding all those extra descriptions can be a lot of work, so they are optional; if not given the room works
like a normal room.</p>
<p>The contrib is simple to add and provides a lot of optional flexibility, so well add it to our
game, why not!</p>
</section>
<section id="rp-system-contrib">
<h2>RP-System contrib<a class="headerlink" href="#rp-system-contrib" title="Permalink to this headline"></a></h2>
<p><a class="reference internal" href="../../../api/evennia.contrib.rpg.rpsystem.html"><span class="doc std std-doc">source</span></a></p>
<p>This contrib adds a full roleplaying subsystem to your game. It gives every character a “short-description”
(sdesc) that is what people will see when first meeting them. Lets say Tom has an sdesc “A tall man” and
Sue has the sdesc “A muscular, blonde woman”</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Tom &gt; look
Tom: &lt;room desc&gt; ... You see: A muscular, blonde woman
Tom &gt; emote /me smiles to /muscular.
Tom: Tom smiles to A muscular, blonde woman.
Sue: A tall man smiles to Sue.
Tom &gt; emote Leaning forward, /me says, &quot;Well hello, what&#39;s yer name?&quot;
Tom: Leaning forward, Tom says, &quot;Well hello...&quot;
Sue: Leaning forward, A tall man says, &quot;Well hello, what&#39;s yer name?&quot;
Sue &gt; emote /me grins. &quot;I&#39;m Angelica&quot;, she says.
Sue: Sue grins. &quot;I&#39;m Angelica&quot;, she says.
Tom: A muscular, blonde woman grins. &quot;I&#39;m Angelica&quot;, she says.
Tom &gt; recog muscular Angelica
Tom &gt; emote /me nods to /angelica: &quot;I have a message for you ...&quot;
Tom: Tom nods to Angelica: &quot;I have a message for you ...&quot;
Sue: A tall man nods to Sue: &quot;I have a message for you ...&quot;
</pre></div>
</div>
<p>Above, Sue introduces herself as “Angelica” and Tom uses this info to <code class="docutils literal notranslate"><span class="pre">recoc</span></code> her as “Angelica” hereafter. He
could have <code class="docutils literal notranslate"><span class="pre">recoc</span></code>-ed her with whatever name he liked - its only for his own benefit. There is no separate
<code class="docutils literal notranslate"><span class="pre">say</span></code>, the spoken words are embedded in the emotes in quotes <code class="docutils literal notranslate"><span class="pre">&quot;...&quot;</span></code>.</p>
<p>The RPSystem module also includes options for <code class="docutils literal notranslate"><span class="pre">poses</span></code>, which help to establish your position in the room
when others look at you.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Tom &gt; pose stands by the bar, looking bored.
Sue &gt; look
Sue: &lt;room desc&gt; ... A tall man stands by the bar, looking bored.
</pre></div>
</div>
<p>You can also wear a mask to hide your identity; your sdesc will then be changed to the sdesc of the mask,
like <code class="docutils literal notranslate"><span class="pre">a</span> <span class="pre">person</span> <span class="pre">with</span> <span class="pre">a</span> <span class="pre">mask</span></code>.</p>
<p>The RPSystem gives a lot of roleplaying power out of the box, so we will add it. There is also a separate
<a class="reference internal" href="../../../api/evennia.contrib.rpg.rpsystem.html"><span class="doc std std-doc">rplanguage</span></a> module that integrates with the spoken words in your emotes and garbles them if you dont understand
the language spoken. In order to restrict the scope we will not include languages for the tutorial game.</p>
</section>
<section id="talking-npc-contrib">
<h2>Talking NPC contrib<a class="headerlink" href="#talking-npc-contrib" title="Permalink to this headline"></a></h2>
<p><a class="reference internal" href="../../../api/evennia.contrib.tutorials.talking_npc.html"><span class="doc std std-doc">source</span></a></p>
<p>This exemplifies an NPC with a menu-driven dialogue tree. We will not use this contrib explicitly, but its
good as inspiration for how well do quest-givers later.</p>
</section>
<section id="traits-contrib">
<h2>Traits contrib<a class="headerlink" href="#traits-contrib" title="Permalink to this headline"></a></h2>
<p><a class="reference internal" href="../../../api/evennia.contrib.rpg.traits.html"><span class="doc std std-doc">source</span></a></p>
<p>An issue with dealing with roleplaying attributes like strength, dexterity, or skills like hunting, sword etc
is how to keep track of the values in the moment. Your strength may temporarily be buffed by a strength-potion.
Your swordmanship may be worse because you are encumbered. And when you drink your health potion you must make
sure that those +20 health does not bring your health higher than its maximum. All this adds complexity.</p>
<p>The <em>Traits</em> contrib consists of several types of objects to help track and manage values like this. When
installed, the traits are accessed on a new handler <code class="docutils literal notranslate"><span class="pre">.traits</span></code>, for example</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>&gt; py self.traits.hp.value
100
&gt; py self.traits.hp -= 20 # getting hurt
&gt; py self.traits.hp.value
80
&gt; py self.traits.hp.reset() # drink a potion
&gt; py self.traits.hp.value
100
</pre></div>
</div>
<p>A Trait is persistent (it uses an Attribute under the hood) and tracks changes, min/max and other things
automatically. They can also be added together in various mathematical operations.</p>
<p>The contrib introduces three main Trait-classes</p>
<ul class="simple">
<li><p><em>Static</em> traits for single values like str, dex, things that at most gets a modifier.</p></li>
<li><p><em>Counters</em> is a value that never moves outside a given range, even with modifiers. For example a skill
that can at most get a maximum amount of buff. Counters can also easily be <em>timed</em> so that they decrease
or increase with a certain rate per second. This could be good for a time-limited curse for example.</p></li>
<li><p><em>Gauge</em> is like a fuel-gauge; it starts at a max value and then empties gradually. This is perfect for
things like health, stamina and the like. Gauges can also change with a rate, which works well for the
effects of slow poisons and healing both.</p></li>
</ul>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">&gt;</span> <span class="n">py</span> <span class="bp">self</span><span class="o">.</span><span class="n">traits</span><span class="o">.</span><span class="n">hp</span><span class="o">.</span><span class="n">value</span>
<span class="mi">100</span>
<span class="o">&gt;</span> <span class="n">py</span> <span class="bp">self</span><span class="o">.</span><span class="n">traits</span><span class="o">.</span><span class="n">hp</span><span class="o">.</span><span class="n">rate</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span> <span class="c1"># poisoned!</span>
<span class="o">&gt;</span> <span class="n">py</span> <span class="bp">self</span><span class="o">.</span><span class="n">traits</span><span class="o">.</span><span class="n">hp</span><span class="o">.</span><span class="n">ratetarget</span> <span class="o">=</span> <span class="mi">50</span> <span class="c1"># stop at 50 hp</span>
<span class="c1"># Wait 30s</span>
<span class="o">&gt;</span> <span class="n">py</span> <span class="bp">self</span><span class="o">.</span><span class="n">traits</span><span class="o">.</span><span class="n">hp</span><span class="o">.</span><span class="n">value</span>
<span class="mi">70</span>
<span class="c1"># Wait another 30s</span>
<span class="o">&gt;</span> <span class="n">py</span> <span class="bp">self</span><span class="o">.</span><span class="n">traits</span><span class="o">.</span><span class="n">hp</span><span class="o">.</span><span class="n">value</span>
<span class="mi">50</span> <span class="c1"># stopped at 50</span>
<span class="o">&gt;</span> <span class="n">py</span> <span class="bp">self</span><span class="o">.</span><span class="n">traits</span><span class="o">.</span><span class="n">hp</span><span class="o">.</span><span class="n">rate</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># no more poison</span>
<span class="o">&gt;</span> <span class="n">py</span> <span class="bp">self</span><span class="o">.</span><span class="n">traits</span><span class="o">.</span><span class="n">hp</span><span class="o">.</span><span class="n">rate</span> <span class="o">=</span> <span class="mi">5</span> <span class="c1"># healing magic!</span>
<span class="c1"># wait 5s</span>
<span class="o">&gt;</span> <span class="n">pyself</span><span class="o">.</span><span class="n">traits</span><span class="o">.</span><span class="n">hp</span><span class="o">.</span><span class="n">value</span>
<span class="mi">75</span>
</pre></div>
</div>
<p>Traits will be very practical to use for our character sheets.</p>
</section>
<section id="turnbattle-contrib">
<h2>Turnbattle contrib<a class="headerlink" href="#turnbattle-contrib" title="Permalink to this headline"></a></h2>
<p><a class="reference internal" href="../../../api/evennia.contrib.game_systems.turnbattle.html"><span class="doc std std-doc">source</span></a></p>
<p>This contrib consists of several implementations of a turn-based combat system, divivided into complexity:</p>
<ul class="simple">
<li><p>basic - initiative and turn order, attacks against defense values, damage.</p></li>
<li><p>equip - considers weapons and armor, wielding and weapon accuracy.</p></li>
<li><p>items - adds usable items with conditions and status effects</p></li>
<li><p>magic - adds spellcasting system using MP.</p></li>
<li><p>range - adds abstract positioning and 1D movement to differentiate between melee and ranged attacks.</p></li>
</ul>
<p>The turnbattle system is comprehensive, but its meant as a base to start from rather than offer
a complete system. Its also not built with <em>Traits</em> in mind, so we will need to adjust it for that.</p>
</section>
<section id="conclusions">
<h2>Conclusions<a class="headerlink" href="#conclusions" title="Permalink to this headline"></a></h2>
<p>With some contribs selected, we have pieces to build from and dont have to write everything from scratch.
We will need Quests and will likely need to do a bunch of work on Combat to adapt the combat contrib
to our needs.</p>
<p>We will now move into actually starting to implement our tutorial game
in the next part of this tutorial series. When doing this for yourself, remember to refer
back to your planning and adjust it as you learn what works and what does not.</p>
</section>
</section>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../../index.html">
<img class="logo" src="../../../_static/evennia_logo.png" alt="Logo"/>
</a></p>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
<p><h3><a href="../../../index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Planning the use of some useful contribs</a><ul>
<li><a class="reference internal" href="#barter-contrib">Barter contrib</a></li>
<li><a class="reference internal" href="#clothing-contrib">Clothing contrib</a></li>
<li><a class="reference internal" href="#dice-contrib">Dice contrib</a></li>
<li><a class="reference internal" href="#extended-room-contrib">Extended room contrib</a></li>
<li><a class="reference internal" href="#rp-system-contrib">RP-System contrib</a></li>
<li><a class="reference internal" href="#talking-npc-contrib">Talking NPC contrib</a></li>
<li><a class="reference internal" href="#traits-contrib">Traits contrib</a></li>
<li><a class="reference internal" href="#turnbattle-contrib">Turnbattle contrib</a></li>
<li><a class="reference internal" href="#conclusions">Conclusions</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="Game-Planning.html"
title="previous chapter">On Planning a Game</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="Planning-The-Tutorial-Game.html"
title="next chapter">Planning our tutorial game</a></p>
<div role="note" aria-label="source link">
<!--h3>This Page</h3-->
<ul class="this-page-menu">
<li><a href="../../../_sources/Howtos/Beginner-Tutorial/Part2/Planning-Some-Useful-Contribs.md.txt"
rel="nofollow">Show Page Source</a></li>
</ul>
</div><h3>Links</h3>
<ul>
<li><a href="https://www.evennia.com">Home page</a> </li>
<li><a href="https://github.com/evennia/evennia">Evennia Github</a> </li>
<li><a href="http://games.evennia.com">Game Index</a> </li>
<li>
<a href="https://discord.gg/AJJpcRUhtF">Discord</a> -
<a href="https://github.com/evennia/evennia/discussions">Discussions</a> -
<a href="https://evennia.blogspot.com/">Blog</a>
</li>
</ul>
<h3>Versions</h3>
<ul>
<li><a href="Planning-Some-Useful-Contribs.html">1.0-dev (develop branch)</a></li>
<li><a href="../../../../0.9.5/index.html">0.9.5 (v0.9.5 branch)</a></li>
</ul>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="Planning-The-Tutorial-Game.html" title="Planning our tutorial game"
>next</a> |</li>
<li class="right" >
<a href="Game-Planning.html" title="On Planning a Game"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">Evennia 1.0-dev</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../Howtos-Overview.html" >Tutorials and Howtos</a> &#187;</li>
<li class="nav-item nav-item-2"><a href="../Beginner-Tutorial-Intro.html" >Beginner Tutorial</a> &#187;</li>
<li class="nav-item nav-item-3"><a href="Beginner-Tutorial-Part2-Intro.html" >Part 2: What we want</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Planning the use of some useful contribs</a></li>
</ul>
<div class="develop">develop branch</div>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2020, The Evennia developer community.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
</div>
</body>
</html>