mirror of
https://github.com/evennia/evennia.git
synced 2026-03-18 22:06:30 +01:00
283 lines
No EOL
21 KiB
HTML
283 lines
No EOL
21 KiB
HTML
|
||
<!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>Character connection styles — Evennia 2.x 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="Guest Logins" href="Guests.html" />
|
||
<link rel="prev" title="Text Encodings" href="Text-Encodings.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="Guests.html" title="Guest Logins"
|
||
accesskey="N">next</a> |</li>
|
||
<li class="right" >
|
||
<a href="Text-Encodings.html" title="Text Encodings"
|
||
accesskey="P">previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 2.x</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="Concepts-Overview.html" accesskey="U">Core Concepts</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">Character connection styles</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="document">
|
||
|
||
<div class="documentwrapper">
|
||
<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>
|
||
<h3><a href="../index.html">Table of Contents</a></h3>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">Character connection styles</a><ul>
|
||
<li><a class="reference internal" href="#changing-the-login-screen">Changing the login screen</a></li>
|
||
<li><a class="reference internal" href="#customizing-the-login-command">Customizing the login command</a></li>
|
||
<li><a class="reference internal" href="#multisession-mode-and-multi-playing">Multisession mode and multi-playing</a></li>
|
||
<li><a class="reference internal" href="#character-creation-and-auto-puppeting">Character creation and auto-puppeting</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
<h4>Previous topic</h4>
|
||
<p class="topless"><a href="Text-Encodings.html"
|
||
title="previous chapter">Text Encodings</a></p>
|
||
<h4>Next topic</h4>
|
||
<p class="topless"><a href="Guests.html"
|
||
title="next chapter">Guest Logins</a></p>
|
||
<div role="note" aria-label="source link">
|
||
<!--h3>This Page</h3-->
|
||
<ul class="this-page-menu">
|
||
<li><a href="../_sources/Concepts/Connection-Styles.md.txt"
|
||
rel="nofollow">Show Page Source</a></li>
|
||
</ul>
|
||
</div><h3>Links</h3>
|
||
<ul>
|
||
<li><a href="https://www.evennia.com/docs/latest/index.html">Documentation Top</a> </li>
|
||
<li><a href="https://www.evennia.com">Evennia Home</a> </li>
|
||
<li><a href="https://github.com/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>Doc Versions</h3>
|
||
<ul>
|
||
|
||
<li><a href="Connection-Styles.html">2.x (main branch)</a></li>
|
||
<ul>
|
||
<li><a href="../1.3.0/index.html">1.3.0 (v1.3.0 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="bodywrapper">
|
||
<div class="body" role="main">
|
||
|
||
<section class="tex2jax_ignore mathjax_ignore" id="character-connection-styles">
|
||
<h1>Character connection styles<a class="headerlink" href="#character-connection-styles" title="Permalink to this headline">¶</a></h1>
|
||
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>><span class="w"> </span>login<span class="w"> </span>Foobar<span class="w"> </span>password123
|
||
</pre></div>
|
||
</div>
|
||
<p>Evennia supports multiple ways for players to connect to the game. This allows Evennia to mimic the behavior of various other servers, or open things up for a custom solution.</p>
|
||
<section id="changing-the-login-screen">
|
||
<h2>Changing the login screen<a class="headerlink" href="#changing-the-login-screen" title="Permalink to this headline">¶</a></h2>
|
||
<p>This is done by modifying <code class="docutils literal notranslate"><span class="pre">mygame/server/conf/connection_screens.py</span></code> and reloading. If you don’t like the default login, there are two contribs to check out as inspiration.</p>
|
||
<ul class="simple">
|
||
<li><p><a class="reference internal" href="../Contribs/Contrib-Email-Login.html"><span class="doc std std-doc">Email login</span></a> - require email during install, use email for login.</p></li>
|
||
<li><p><a class="reference internal" href="../Contribs/Contrib-Menu-Login.html"><span class="doc std std-doc">Menu login</span></a> - login using several prompts, asking to enter username and password in sequence.</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="customizing-the-login-command">
|
||
<h2>Customizing the login command<a class="headerlink" href="#customizing-the-login-command" title="Permalink to this headline">¶</a></h2>
|
||
<p>When a player connects to the game, it runs the <code class="docutils literal notranslate"><span class="pre">CMD_LOGINSTART</span></code> <a class="reference internal" href="../Components/Commands.html#system-commands"><span class="std std-doc">system command</span></a>. By default, this is the <a class="reference internal" href="../api/evennia.commands.default.unloggedin.html#evennia.commands.default.unloggedin.CmdUnconnectedLook" title="evennia.commands.default.unloggedin.CmdUnconnectedLook"><span class="xref myst py py-class">CmdUnconnectedLook</span></a>. This shows the welcome screen. The other commands in the <a class="reference internal" href="../api/evennia.commands.default.cmdset_unloggedin.html#evennia.commands.default.cmdset_unloggedin.UnloggedinCmdSet" title="evennia.commands.default.cmdset_unloggedin.UnloggedinCmdSet"><span class="xref myst py py-class">UnloggedinCmdSet</span></a> are what defines the login experience. So if you want to customise it, you just need to replace/remove those commands.</p>
|
||
<aside class="sidebar">
|
||
<p>If you instead had your command inherit from <code class="docutils literal notranslate"><span class="pre">default_cmds.UnConnectedLook</span></code>, you didn’t even have to speciy the key (since your class would inherit it)!</p>
|
||
</aside>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/commands/mylogin_commands.py</span>
|
||
|
||
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">syscmdkeys</span><span class="p">,</span> <span class="n">default_cmds</span><span class="p">,</span> <span class="n">Command</span>
|
||
|
||
|
||
<span class="k">class</span> <span class="nc">MyUnloggedinLook</span><span class="p">(</span><span class="n">Command</span><span class="p">):</span>
|
||
|
||
<span class="c1"># this will now be the first command called when connecting</span>
|
||
<span class="n">key</span> <span class="o">=</span> <span class="n">syscmdkeys</span><span class="o">.</span><span class="n">CMD_LOGINSTART</span>
|
||
|
||
<span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||
<span class="c1"># ... </span>
|
||
</pre></div>
|
||
</div>
|
||
<p>Next, add this to the right place in the <code class="docutils literal notranslate"><span class="pre">UnloggedinCmdSet</span></code>:</p>
|
||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in mygame/commands/default_cmdsets.py</span>
|
||
|
||
<span class="kn">from</span> <span class="nn">commands.mylogin_commands</span> <span class="kn">import</span> <span class="n">MyUnloggedinLook</span>
|
||
<span class="c1"># ... </span>
|
||
|
||
<span class="k">class</span> <span class="nc">UnloggedinCmdSet</span><span class="p">(</span><span class="n">default_cmds</span><span class="o">.</span><span class="n">UnloggedinCmdSet</span><span class="p">):</span>
|
||
<span class="c1"># ... </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="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">at_cmdset_creation</span>
|
||
<span class="bp">self</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">MyUnloggedinLook</span><span class="p">())</span>
|
||
</pre></div>
|
||
</div>
|
||
<p><code class="docutils literal notranslate"><span class="pre">reload</span></code> and your alternate command will be used. Examine the default commands and you’ll be able to change everything about the login.</p>
|
||
</section>
|
||
<section id="multisession-mode-and-multi-playing">
|
||
<h2>Multisession mode and multi-playing<a class="headerlink" href="#multisession-mode-and-multi-playing" title="Permalink to this headline">¶</a></h2>
|
||
<p>The number of sessions possible to connect to a given account at the same time and how it works is given by the <code class="docutils literal notranslate"><span class="pre">MULTISESSION_MODE</span></code> setting:</p>
|
||
<ul>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">MULTISESSION_MODE=0</span></code>: One session per account. When connecting with a new session the old one is disconnected. This is the default mode and emulates many classic mud code bases.</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>┌──────┐ │ ┌───────┐ ┌───────┐ ┌─────────┐
|
||
│Client├─┼──►│Session├───►│Account├──►│Character│
|
||
└──────┘ │ └───────┘ └───────┘ └─────────┘
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">MULTISESSION_MODE=1</span></code>: Many sessions per account, input/output from/to each session is treated the same. For the player this means they can connect to the game from multiple clients and see the same output in all of them. The result of a command given in one client (that is, through one Session) will be returned to <em>all</em> connected Sessions/clients with no distinction.</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> │
|
||
┌──────┐ │ ┌───────┐
|
||
│Client├─┼──►│Session├──┐
|
||
└──────┘ │ └───────┘ └──►┌───────┐ ┌─────────┐
|
||
│ │Account├──►│Character│
|
||
┌──────┐ │ ┌───────┐ ┌──►└───────┘ └─────────┘
|
||
│Client├─┼──►│Session├──┘
|
||
└──────┘ │ └───────┘
|
||
│
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">MULTISESSION_MODE=2</span></code>: Many sessions per account, one character per session. In this mode, puppeting an Object/Character will link the puppet back only to the particular Session doing the puppeting. That is, input from that Session will make use of the CmdSet of that Object/Character and outgoing messages (such as the result of a <code class="docutils literal notranslate"><span class="pre">look</span></code>) will be passed back only to that puppeting Session. If another Session tries to puppet the same Character, the old Session will automatically un-puppet it. From the player’s perspective, this will mean that they can open separate game clients and play a different Character in each using one game account.</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> │ ┌───────┐
|
||
┌──────┐ │ ┌───────┐ │Account│ ┌─────────┐
|
||
│Client├─┼──►│Session├──┐ │ │ ┌►│Character│
|
||
└──────┘ │ └───────┘ └──┼───────┼──┘ └─────────┘
|
||
│ │ │
|
||
┌──────┐ │ ┌───────┐ ┌──┼───────┼──┐ ┌─────────┐
|
||
│Client├─┼──►│Session├──┘ │ │ └►│Character│
|
||
└──────┘ │ └───────┘ │ │ └─────────┘
|
||
│ └───────┘
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p><code class="docutils literal notranslate"><span class="pre">MULTISESSION_MODE=3</span></code>: Many sessions per account <em>and</em> character. This is the full multi-puppeting mode, where multiple sessions may not only connect to the player account but multiple sessions may also puppet a single character at the same time. From the user’s perspective it means one can open multiple client windows, some for controlling different Characters and some that share a Character’s input/output like in mode 1. This mode otherwise works the same as mode 2.</p>
|
||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> │ ┌───────┐
|
||
┌──────┐ │ ┌───────┐ │Account│ ┌─────────┐
|
||
│Client├─┼──►│Session├──┐ │ │ ┌►│Character│
|
||
└──────┘ │ └───────┘ └──┼───────┼──┘ └─────────┘
|
||
│ │ │
|
||
┌──────┐ │ ┌───────┐ ┌──┼───────┼──┐
|
||
│Client├─┼──►│Session├──┘ │ │ └►┌─────────┐
|
||
└──────┘ │ └───────┘ │ │ │Character│
|
||
│ │ │ ┌►└─────────┘
|
||
┌──────┐ │ ┌───────┐ ┌──┼───────┼──┘ ▼
|
||
│Client├─┼──►│Session├──┘ │ │
|
||
└──────┘ │ └───────┘ └───────┘
|
||
│
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
<blockquote>
|
||
<div><p>Note that even if multiple Sessions puppet one Character, there is only ever one instance of that Character.</p>
|
||
</div></blockquote>
|
||
<p>Mode <code class="docutils literal notranslate"><span class="pre">0</span></code> is the default and mimics how many legacy codebases work, especially in the DIKU world. The equivalence of higher modes are often ‘hacked’ into existing servers to allow for players to have multiple characters.</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>MAX_NR_SIMULTANEOUS_PUPPETS = 1
|
||
</pre></div>
|
||
</div>
|
||
<p>This setting limits how many <em>different</em> puppets your <em>Account</em> can puppet <em>simultaneously</em>. This is used to limit true multiplaying. A value higher than one makes no sense unless <code class="docutils literal notranslate"><span class="pre">MULTISESSION_MODE</span></code> is also set <code class="docutils literal notranslate"><span class="pre">>1</span></code>. Set to <code class="docutils literal notranslate"><span class="pre">None</span></code> for no limit.</p>
|
||
</section>
|
||
<section id="character-creation-and-auto-puppeting">
|
||
<h2>Character creation and auto-puppeting<a class="headerlink" href="#character-creation-and-auto-puppeting" title="Permalink to this headline">¶</a></h2>
|
||
<p>When a player first creates an account, Evennia will auto-create a <code class="docutils literal notranslate"><span class="pre">Character</span></code> puppet of the same name. When the player logs in, they will auto-puppet this Character. This default hides the Account-Character separation from the player and puts them immediately in the game. This default behavior is similar to how it works in many legacy MU servers.</p>
|
||
<p>To control this behavior, you need to tweak the settings. These are the defaults:</p>
|
||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>AUTO_CREATE_CHARACTER_WITH_ACCOUNT = True
|
||
AUTO_PUPPET_ON_LOGIN = True
|
||
MAX_NR_CHARACTERS = 1
|
||
</pre></div>
|
||
</div>
|
||
<p>There is a default <code class="docutils literal notranslate"><span class="pre">charcreate</span></code> command. This heeds the <code class="docutils literal notranslate"><span class="pre">MAX_NR_CHARACTERS</span></code>; and if you make your own character-creation command, you should do the same. It needs to be at least <code class="docutils literal notranslate"><span class="pre">1</span></code>. Set to <code class="docutils literal notranslate"><span class="pre">None</span></code> for no limit. See the <a class="reference internal" href="../Howtos/Beginner-Tutorial/Beginner-Tutorial-Overview.html"><span class="doc std std-doc">Beginner Tutorial</span></a> for ideas on how to make a more advanced character generation system.</p>
|
||
<aside class="sidebar">
|
||
<p>Combining these settings with <code class="docutils literal notranslate"><span class="pre">MAX_NR_SIMULTANEOUS_PUPPETS</span></code> could allow for a game where (for example) a player can create a ‘stable’ of Characters, but only be able to play one at a time.</p>
|
||
</aside>
|
||
<p>If you choose to not auto-create a character, you will need to provide a character-generation, and there will be no (initial) Character to puppet. In both of these settings, you will initially end up in <code class="docutils literal notranslate"><span class="pre">ooc</span></code> mode after you login. This is a good place to put a character generation screen/menu (you can e.g. replace the <a class="reference internal" href="../api/evennia.commands.default.account.html#evennia.commands.default.account.CmdOOCLook" title="evennia.commands.default.account.CmdOOCLook"><span class="xref myst py py-class">CmdOOCLook</span></a> to trigger something other than the normal ooc-look).</p>
|
||
<p>Once you created a Character, if your auto-puppet is set, you will automatically puppet your latest-puppeted Character whenever you login. If not set, you will always start OOC (and should be able to select which Character to puppet).</p>
|
||
</section>
|
||
</section>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</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="Guests.html" title="Guest Logins"
|
||
>next</a> |</li>
|
||
<li class="right" >
|
||
<a href="Text-Encodings.html" title="Text Encodings"
|
||
>previous</a> |</li>
|
||
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 2.x</a> »</li>
|
||
<li class="nav-item nav-item-1"><a href="Concepts-Overview.html" >Core Concepts</a> »</li>
|
||
<li class="nav-item nav-item-this"><a href="">Character connection styles</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
|
||
|
||
<div class="footer" role="contentinfo">
|
||
© Copyright 2023, The Evennia developer community.
|
||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
|
||
</div>
|
||
</body>
|
||
</html> |