mirror of
https://github.com/evennia/evennia.git
synced 2026-03-30 20:47:17 +02:00
233 lines
No EOL
24 KiB
HTML
233 lines
No EOL
24 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<title>Evennia for MUSH Users — Evennia 1.0-dev documentation</title>
|
||
<link rel="stylesheet" href="_static/alabaster.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="index" title="Index" href="genindex.html" />
|
||
<link rel="search" title="Search" href="search.html" />
|
||
|
||
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
|
||
|
||
|
||
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
|
||
|
||
</head><body>
|
||
|
||
|
||
<div class="document">
|
||
<div class="documentwrapper">
|
||
<div class="bodywrapper">
|
||
|
||
|
||
<div class="body" role="main">
|
||
|
||
<div class="section" id="evennia-for-mush-users">
|
||
<h1>Evennia for MUSH Users<a class="headerlink" href="#evennia-for-mush-users" title="Permalink to this headline">¶</a></h1>
|
||
<p><em>This page is adopted from an article originally posted for the MUSH community <a class="reference external" href="http://musoapbox.net/topic/1150/evennia-for-mushers">here on musoapbox.net</a>.</em></p>
|
||
<p><a class="reference external" href="https://en.wikipedia.org/wiki/MUSH">MUSH</a>es are text multiplayer games traditionally used for heavily roleplay-focused game styles. They are often (but not always) utilizing game masters and human oversight over code automation. MUSHes are traditionally built on the TinyMUSH-family of game servers, like PennMUSH, TinyMUSH, TinyMUX and RhostMUSH. Also their siblings <a class="reference external" href="https://en.wikipedia.org/wiki/TinyMUCK">MUCK</a> and <a class="reference external" href="https://en.wikipedia.org/wiki/MOO">MOO</a> are often mentioned together with MUSH since they all inherit from the same <a class="reference external" href="https://en.wikipedia.org/wiki/MUD_trees#TinyMUD_family_tree">TinyMUD</a> base. A major feature is the ability to modify and program the game world from inside the game by using a custom scripting language. We will refer to this online scripting as <em>softcode</em> here.</p>
|
||
<p>Evennia works quite differently from a MUSH both in its overall design and under the hood. The same things are achievable, just in a different way. Here are some fundamental differences to keep in mind if you are coming from the MUSH world.</p>
|
||
<div class="section" id="developers-vs-players">
|
||
<h2>Developers vs Players<a class="headerlink" href="#developers-vs-players" title="Permalink to this headline">¶</a></h2>
|
||
<p>In MUSH, users tend to code and expand all aspects of the game from inside it using softcode. A MUSH can thus be said to be managed solely by <em>Players</em> with different levels of access. Evennia on the other hand, differentiates between the role of the <em>Player</em> and the <em>Developer</em>.</p>
|
||
<ul class="simple">
|
||
<li><p>An Evennia <em>Developer</em> works in Python from <em>outside</em> the game, in what MUSH would consider “hardcode”. Developers implement larger-scale code changes and can fundamentally change how the game works. They then load their changes into the running Evennia server. Such changes will usually not drop any connected players.</p></li>
|
||
<li><p>An Evennia <em>Player</em> operates from <em>inside</em> the game. Some staff-level players are likely to double as developers. Depending on access level, players can modify and expand the game’s world by digging new rooms, creating new objects, alias commands, customize their experience and so on. Trusted staff may get access to Python via the <code class="docutils literal notranslate"><span class="pre">@py</span></code> command, but this would be a security risk for normal Players to use. So the <em>Player</em> usually operates by making use of the tools prepared for them by the <em>Developer</em> - tools that can be as rigid or flexible as the developer desires.</p></li>
|
||
</ul>
|
||
</div>
|
||
<div class="section" id="collaborating-on-a-game-python-vs-softcode">
|
||
<h2>Collaborating on a game - Python vs Softcode<a class="headerlink" href="#collaborating-on-a-game-python-vs-softcode" title="Permalink to this headline">¶</a></h2>
|
||
<p>For a <em>Player</em>, collaborating on a game need not be too different between MUSH and Evennia. The building and description of the game world can still happen mostly in-game using build commands, using text tags and <a class="reference external" href="/TextTags.html#inline-functions">inline functions</a> to prettify and customize the experience. Evennia offers external ways to build a world but those are optional. There is also nothing <em>in principle</em> stopping a Developer from offering a softcode-like language to Players if that is deemed necessary.</p>
|
||
<p>For <em>Developers</em> of the game, the difference is larger: Code is mainly written outside the game in Python modules rather than in-game on the command line. Python is a very popular and well-supported language with tons of documentation and help to be found. The Python standard library is also a great help for not having to reinvent the wheel. But that said, while Python is considered one of the easier languages to learn and use it is undoubtedly very different from MUSH softcode.</p>
|
||
<p>While softcode allows collaboration in-game, Evennia’s external coding instead opens up the possibility for collaboration using professional version control tools and bug tracking using websites like github (or bitbucket for a free private repo). Source code can be written in proper text editors and IDEs with refactoring, syntax highlighting and all other conveniences. In short, collaborative development of an Evennia game is done in the same way most professional collaborative development is done in the world, meaning all the best tools can be used.</p>
|
||
</div>
|
||
<div class="section" id="parent-vs-typeclass-and-spawn">
|
||
<h2><code class="docutils literal notranslate"><span class="pre">@parent</span></code> vs <code class="docutils literal notranslate"><span class="pre">@typeclass</span></code> and <code class="docutils literal notranslate"><span class="pre">@spawn</span></code><a class="headerlink" href="#parent-vs-typeclass-and-spawn" title="Permalink to this headline">¶</a></h2>
|
||
<p>Inheritance works differently in Python than in softcode. Evennia has no concept of a “master object” that other objects inherit from. There is in fact no reason at all to introduce “virtual objects” in the game world - code and data are kept separate from one another.</p>
|
||
<p>In Python (which is an <a class="reference external" href="https://en.wikipedia.org/wiki/Object-oriented_programming">object oriented</a> language) one instead creates <em>classes</em> - these are like blueprints from which you spawn any number of <em>object instances</em>. Evennia also adds the extra feature that every instance is persistent in the database (this means no SQL is ever needed). To take one example, a unique character in Evennia is an instances of the class <code class="docutils literal notranslate"><span class="pre">Character</span></code>.</p>
|
||
<p>One parallel to MUSH’s <code class="docutils literal notranslate"><span class="pre">@parent</span></code> command may be Evennia’s <code class="docutils literal notranslate"><span class="pre">@typeclass</span></code> command, which changes which class an already existing object is an instance of. This way you can literally turn a <code class="docutils literal notranslate"><span class="pre">Character</span></code> into a <code class="docutils literal notranslate"><span class="pre">Flowerpot</span></code> on the spot.</p>
|
||
<p>if you are new to object oriented design it’s important to note that all object instances of a class does <em>not</em> have to be identical. If they did, all Characters would be named the same. Evennia allows to customize individual objects in many different ways. One way is through <em>Attributes</em>, which are database-bound properties that can be linked to any object. For example, you could have an <code class="docutils literal notranslate"><span class="pre">Orc</span></code> class that defines all the stuff an Orc should be able to do (probably in turn inheriting from some <code class="docutils literal notranslate"><span class="pre">Monster</span></code> class shared by all monsters). Setting different Attributes on different instances (different strength, equipment, looks etc) would make each Orc unique despite all sharing the same class.</p>
|
||
<p>The <code class="docutils literal notranslate"><span class="pre">@spawn</span></code> command allows one to conveniently choose between different “sets” of Attributes to put on each new Orc (like the “warrior” set or “shaman” set) . Such sets can even inherit one another which is again somewhat remniscent at least of the <em>effect</em> of <code class="docutils literal notranslate"><span class="pre">@parent</span></code> and the object-based inheritance of MUSH.</p>
|
||
<p>There are other differences for sure, but that should give some feel for things. Enough with the theory. Let’s get down to more practical matters next. To install, see the <a class="reference internal" href="Getting-Started.html"><span class="doc">Getting Started instructions</span></a>.</p>
|
||
</div>
|
||
<div class="section" id="a-first-step-making-things-more-familiar">
|
||
<h2>A first step making things more familiar<a class="headerlink" href="#a-first-step-making-things-more-familiar" title="Permalink to this headline">¶</a></h2>
|
||
<p>We will here give two examples of customizing Evennia to be more familiar to a MUSH <em>Player</em>.</p>
|
||
<div class="section" id="activating-a-multi-descer">
|
||
<h3>Activating a multi-descer<a class="headerlink" href="#activating-a-multi-descer" title="Permalink to this headline">¶</a></h3>
|
||
<p>By default Evennia’s <code class="docutils literal notranslate"><span class="pre">desc</span></code> command updates your description and that’s it. There is a more feature-rich optional “multi-descer” in <code class="docutils literal notranslate"><span class="pre">evennia/contrib/multidesc.py</span></code> though. This alternative allows for managing and combining a multitude of keyed descriptions.</p>
|
||
<p>To activate the multi-descer, <code class="docutils literal notranslate"><span class="pre">cd</span></code> to your game folder and into the <code class="docutils literal notranslate"><span class="pre">commands</span></code> sub-folder. There you’ll find the file <code class="docutils literal notranslate"><span class="pre">default_cmdsets.py</span></code>. In Python lingo all <code class="docutils literal notranslate"><span class="pre">*.py</span></code> files are called <em>modules</em>. Open the module in a text editor. We won’t go into Evennia in-game <em>Commands</em> and <em>Command sets</em> further here, but suffice to say Evennia allows you to change which commands (or versions of commands) are available to the player from moment to moment depending on circumstance.</p>
|
||
<p>Add two new lines to the module as seen below:</p>
|
||
<div class="highlight-python notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
|
||
2
|
||
3
|
||
4
|
||
5
|
||
6
|
||
7
|
||
8
|
||
9
|
||
10
|
||
11
|
||
12
|
||
13
|
||
14
|
||
15
|
||
16
|
||
17
|
||
18
|
||
19
|
||
20
|
||
21
|
||
22
|
||
23</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="c1"># the file mygame/commands/default_cmdsets.py</span>
|
||
<span class="c1"># [...] </span>
|
||
|
||
<span class="kn">from</span> <span class="nn">evennia.contrib</span> <span class="kn">import</span> <span class="n">multidescer</span> <span class="c1"># <- added now</span>
|
||
|
||
<span class="k">class</span> <span class="nc">CharacterCmdSet</span><span class="p">(</span><span class="n">default_cmds</span><span class="o">.</span><span class="n">CharacterCmdSet</span><span class="p">):</span>
|
||
<span class="sd">"""</span>
|
||
<span class="sd"> The CharacterCmdSet contains general in-game commands like look,</span>
|
||
<span class="sd"> get etc available on in-game Character objects. It is merged with</span>
|
||
<span class="sd"> the AccountCmdSet when an Account puppets a Character.</span>
|
||
<span class="sd"> """</span>
|
||
<span class="n">key</span> <span class="o">=</span> <span class="s2">"DefaultCharacter"</span>
|
||
|
||
<span class="k">def</span> <span class="nf">at_cmdset_creation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||
<span class="sd">"""</span>
|
||
<span class="sd"> Populates the cmdset</span>
|
||
<span class="sd"> """</span>
|
||
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">at_cmdset_creation</span><span class="p">()</span>
|
||
<span class="c1">#</span>
|
||
<span class="c1"># any commands you add below will overload the default ones.</span>
|
||
<span class="c1">#</span>
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">multidescer</span><span class="o">.</span><span class="n">CmdMultiDesc</span><span class="p">())</span> <span class="c1"># <- added now </span>
|
||
<span class="c1"># [...]</span>
|
||
</pre></div>
|
||
</td></tr></table></div>
|
||
<p>Note that Python cares about indentation, so make sure to indent with the same number of spaces as shown above!</p>
|
||
<p>So what happens above? We <a class="reference external" href="http://www.linuxtopia.org/online_books/programming_books/python_programming/python_ch28s03.html">import the module</a> <code class="docutils literal notranslate"><span class="pre">evennia/contrib/multidescer.py</span></code> at the top. Once imported we can access stuff inside that module using full stop (<code class="docutils literal notranslate"><span class="pre">.</span></code>). The multidescer is defined as a class <code class="docutils literal notranslate"><span class="pre">CmdMultiDesc</span></code> (we could find this out by opening said module in a text editor). At the bottom we create a new instance of this class and add it to the <code class="docutils literal notranslate"><span class="pre">CharacterCmdSet</span></code> class. For the sake of this tutorial we only need to know that <code class="docutils literal notranslate"><span class="pre">CharacterCmdSet</span></code> contains all commands that should be be available to the <code class="docutils literal notranslate"><span class="pre">Character</span></code> by default.</p>
|
||
<p>This whole thing will be triggered when the command set is first created, which happens on server start. So we need to reload Evennia with <code class="docutils literal notranslate"><span class="pre">@reload</span></code> - no one will be disconnected by doing this. If all went well you should now be able to use <code class="docutils literal notranslate"><span class="pre">desc</span></code> (or <code class="docutils literal notranslate"><span class="pre">+desc</span></code>) and find that you have more possibilities:</p>
|
||
<div class="highlight-text notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
|
||
2
|
||
3
|
||
4
|
||
5
|
||
6</pre></div></td><td class="code"><div class="highlight"><pre><span></span>> help +desc # get help on the command
|
||
> +desc eyes = His eyes are blue.
|
||
> +desc basic = A big guy.
|
||
> +desc/set basic + + eyes # we add an extra space between
|
||
> look me
|
||
A big guy. His eyes are blue.
|
||
</pre></div>
|
||
</td></tr></table></div>
|
||
<p>If there are errors, a <em>traceback</em> will show in the server log - several lines of text showing where the error occurred. Find where the error is by locating the line number related to the <code class="docutils literal notranslate"><span class="pre">default_cmdsets.py</span></code> file (it’s the only one you’ve changed so far). Most likely you mis-spelled something or missed the indentation. Fix it and either <code class="docutils literal notranslate"><span class="pre">@reload</span></code> again or run <code class="docutils literal notranslate"><span class="pre">evennia</span> <span class="pre">start</span></code> as needed.</p>
|
||
</div>
|
||
<div class="section" id="customizing-the-multidescer-syntax">
|
||
<h3>Customizing the multidescer syntax<a class="headerlink" href="#customizing-the-multidescer-syntax" title="Permalink to this headline">¶</a></h3>
|
||
<p>As seen above the multidescer uses syntax like this (where <code class="docutils literal notranslate"><span class="pre">|/</span></code> are Evennia’s tags for line breaks) :</p>
|
||
<div class="highlight-text notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>> +desc/set basic + |/|/ + cape + footwear + |/|/ + attitude
|
||
</pre></div>
|
||
</td></tr></table></div>
|
||
<p>This use of <code class="docutils literal notranslate"><span class="pre">+</span> </code> was prescribed by the <em>Developer</em> that coded this <code class="docutils literal notranslate"><span class="pre">+desc</span></code> command. What if the <em>Player</em> doesn’t like this syntax though? Do players need to pester the dev to change it? Not necessarily. While Evennia does not allow the player to build their own multi-descer on the command line, it does allow for <em>re-mapping</em> the command syntax to one they prefer. This is done using the <code class="docutils literal notranslate"><span class="pre">nick</span></code> command.</p>
|
||
<p>Here’s a nick that changes how to input the command above:</p>
|
||
<div class="highlight-text notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>> nick setdesc $1 $2 $3 $4 = +desc/set $1 + |/|/ + $2 + $3 + |/|/ + $4
|
||
</pre></div>
|
||
</td></tr></table></div>
|
||
<p>The string on the left will be matched against your input and if matching, it will be replaced with the string on the right. The <code class="docutils literal notranslate"><span class="pre">$</span></code>-type tags will store space-separated arguments and put them into the replacement. The nick allows <a class="reference external" href="http://www.linfo.org/wildcard.html">shell-like wildcards</a>, so you can use <code class="docutils literal notranslate"><span class="pre">*</span></code>, <code class="docutils literal notranslate"><span class="pre">?</span></code>, <code class="docutils literal notranslate"><span class="pre">[...]</span></code>, <code class="docutils literal notranslate"><span class="pre">[!...]</span></code> etc to match parts of the input.</p>
|
||
<p>The same description as before can now be set as</p>
|
||
<div class="highlight-text notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1</pre></div></td><td class="code"><div class="highlight"><pre><span></span>> setdesc basic cape footwear attitude
|
||
</pre></div>
|
||
</td></tr></table></div>
|
||
<p>With the <code class="docutils literal notranslate"><span class="pre">nick</span></code> functionality players can mitigate a lot of syntax dislikes even without the developer changing the underlying Python code.</p>
|
||
</div>
|
||
</div>
|
||
<div class="section" id="next-steps">
|
||
<h2>Next steps<a class="headerlink" href="#next-steps" title="Permalink to this headline">¶</a></h2>
|
||
<p>If you are a <em>Developer</em> and are interested in making a more MUSH-like Evennia game, a good start is to look into the Evennia <a class="reference internal" href="Tutorial-for-basic-MUSH-like-game.html"><span class="doc">Tutorial for a first MUSH-like game</span></a>. That steps through building a simple little game from scratch and helps to acquaint you with the various corners of Evennia. There is also the <a class="reference internal" href="Evennia-for-roleplaying-sessions.html"><span class="doc">Tutorial for running roleplaying sessions</span></a> that can be of interest.</p>
|
||
<p>An important aspect of making things more familiar for <em>Players</em> is adding new and tweaking existing commands. How this is done is covered by the <a class="reference internal" href="Adding-Command-Tutorial.html"><span class="doc">Tutorial on adding new commands</span></a>. You may also find it useful to shop through the <code class="docutils literal notranslate"><span class="pre">evennia/contrib/</span></code> folder. The <a class="reference internal" href="Tutorial-World-Introduction.html"><span class="doc">Tutorial world</span></a> is a small single-player quest you can try (it’s not very MUSH-like but it does show many Evennia concepts in action). Beyond that there are <a class="reference internal" href="Tutorials.html"><span class="doc">many more tutorials</span></a> to try out. If you feel you want a more visual overview you can also look at <a class="reference external" href="https://evennia.blogspot.se/2016/05/evennia-in-pictures.html">Evennia in pictures</a>.</p>
|
||
<p>… And of course, if you need further help you can always drop into the <a class="reference external" href="http://webchat.freenode.net/?channels=evennia&uio=MT1mYWxzZSY5PXRydWUmMTE9MTk1JjEyPXRydWUbb">Evennia chatroom</a> or post a question in our <a class="reference external" href="https://groups.google.com/forum/#%21forum/evennia">forum/mailing list</a>!</p>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||
<div class="sphinxsidebarwrapper">
|
||
<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="#">Evennia for MUSH Users</a><ul>
|
||
<li><a class="reference internal" href="#developers-vs-players">Developers vs Players</a></li>
|
||
<li><a class="reference internal" href="#collaborating-on-a-game-python-vs-softcode">Collaborating on a game - Python vs Softcode</a></li>
|
||
<li><a class="reference internal" href="#parent-vs-typeclass-and-spawn"><code class="docutils literal notranslate"><span class="pre">@parent</span></code> vs <code class="docutils literal notranslate"><span class="pre">@typeclass</span></code> and <code class="docutils literal notranslate"><span class="pre">@spawn</span></code></a></li>
|
||
<li><a class="reference internal" href="#a-first-step-making-things-more-familiar">A first step making things more familiar</a><ul>
|
||
<li><a class="reference internal" href="#activating-a-multi-descer">Activating a multi-descer</a></li>
|
||
<li><a class="reference internal" href="#customizing-the-multidescer-syntax">Customizing the multidescer syntax</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#next-steps">Next steps</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<div class="relations">
|
||
<h3>Related Topics</h3>
|
||
<ul>
|
||
<li><a href="index.html">Documentation overview</a><ul>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
<div role="note" aria-label="source link">
|
||
<!--h3>This Page</h3-->
|
||
<ul class="this-page-menu">
|
||
<li><a href="_sources/Evennia-for-MUSH-Users.md.txt"
|
||
rel="nofollow">Show Page Source</a></li>
|
||
</ul>
|
||
</div>
|
||
<h3>Versions</h3>
|
||
<ul>
|
||
<li><a href="Evennia-for-MUSH-Users.html">1.0-dev (develop branch)</a></li>
|
||
<li><a href="../../versions/0.9.1/index.html">0.9.1 (master branch)</a></li>
|
||
</ul>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="clearer"></div>
|
||
</div>
|
||
<div class="footer">
|
||
©2020, The Evennia developer community.
|
||
|
||
|
|
||
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.4.4</a>
|
||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||
|
||
|
|
||
<a href="_sources/Evennia-for-MUSH-Users.md.txt"
|
||
rel="nofollow">Page source</a>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
</body>
|
||
</html> |