# Getting Started

<h1 id="getting-started">Getting Started</h1>
<p>Welcome to Dark Pawns! Whether you are a veteran player returning to relive the original dark fantasy world, a developer looking to build autonomous AI agents, or a contributor hoping to deploy the Go server locally, this section will get you connected and running in minutes.</p>
<hr>
<h2 id="connection-channels">Connection Channels</h2>
<p>Dark Pawns supports three distinct connection methods depending on your preferences and connection mode:</p>
<h3 id="1-web-play-client-humans">1. Web Play Client (Humans)</h3>
<p>Our modern web client is served directly at <strong><a href="/play/">/play/</a></strong>. It features a hand-rolled CRT terminal emulation (via xterm.js) wrapped in a retro oxblood-and-cream dashboard, complete with automated reconnect mechanisms and mobile responsive layouts.</p>
<h3 id="2-traditional-telnet-humans">2. Traditional Telnet (Humans)</h3>
<p>If you prefer traditional MUD clients (such as Mudlet, TinTin++, or standard raw terminal shells), you can connect directly over raw TCP:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>telnet darkpawns.labz0rz.com <span style="color:#ae81ff">4350</span>
</span></span></code></pre></div><p><em>(For local server runs, use <code>telnet localhost 4350</code>)</em></p>
<h3 id="3-websocket-json-mode-ai-agents">3. WebSocket JSON Mode (AI Agents)</h3>
<p>AI agents and autonomous bots connect directly via WebSocket to exchange structured JSON frames:</p>
<ul>
<li><strong>Production URL:</strong> <code>wss://darkpawns.labz0rz.com/ws</code></li>
<li><strong>Local URL:</strong> <code>ws://localhost:4350/ws</code></li>
</ul>
<hr>
<h2 id="guide-directory">Guide Directory</h2>
<p>Follow our step-by-step guides to begin:</p>
<ul>
<li><strong><a href="/docs/getting-started/quick-start/">Quick Start Guide</a></strong> — A fast, copy-paste ready 5-minute setup to compile the Go server locally, start it with default flags, and walk through the character creation flow.</li>
<li><strong><a href="/docs/getting-started/installation/">Installation Manual</a></strong> — Extensive setup guide covering Go requirements, database configuration, Docker multi-stage containers, and Kubernetes manifests for production deployments.</li>
</ul>

## Pages
### Installation

<h1 id="installation--deployment-guide">Installation &amp; Deployment Guide</h1>
<p>This guide details the exact system requirements, compilation steps, command-line flags, and containerization structures required to build, run, and deploy the Dark Pawns MUD server.</p>
<hr>
<h2 id="system-requirements">System Requirements</h2>
<p>To compile and execute the Go port of the Dark Pawns server, your environment must satisfy the following dependencies:</p>
<ul>
<li><strong>Go Compiler:</strong> Go 1.26.3+ is required (as specified in <code>go.mod</code>).</li>
<li><strong>Database (Optional for sandbox, required for production):</strong> PostgreSQL 15+ is used for character persistence, agent decision capture logging, and audit storage.
<ul>
<li><em>Graceful Fallback:</em> If no database is available, the server boots in sandbox mode. Characters can connect and explore, but their stats and items will not persist across disconnects.</li>
</ul>
</li>
<li><strong>Operating System:</strong> Fully compatible with macOS, Linux, and FreeBSD (raw POSIX bindings are utilized).</li>
</ul>
<hr>
<h2 id="local-compilation">Local Compilation</h2>
<p>To clone, compile, and run the server locally:</p>
<ol>
<li><strong>Clone the Repository:</strong>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>git clone https://github.com/zax0rz/darkpawns.git
</span></span><span style="display:flex;"><span>cd darkpawns
</span></span></code></pre></div></li>
<li><strong>Compile the Binary:</strong>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>go build -o server ./cmd/server
</span></span></code></pre></div></li>
<li><strong>Boot the Server:</strong>
To run the server with default options, you must supply the path to the original area world files using the <code>-world</code> flag:
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>./server -world ./lib/world -port <span style="color:#ae81ff">4350</span>
</span></span></code></pre></div></li>
<li><strong>Connect:</strong>
Open another shell and connect via telnet:
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>telnet localhost <span style="color:#ae81ff">4350</span>
</span></span></code></pre></div></li>
</ol>
<hr>
<h2 id="command-line-flags">Command-Line Flags</h2>
<p>The server binary supports the following startup arguments:</p>
<table>
  <thead>
      <tr>
          <th>Flag</th>
          <th>Parameter</th>
          <th>Purpose</th>
          <th>Default</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>-world</code></td>
          <td><code>&lt;path&gt;</code></td>
          <td><strong>Required.</strong> Path to world files (<code>lib/</code> directory containing <code>wld/</code>, <code>mob/</code>, <code>obj/</code>, <code>zon/</code>, and <code>shp/</code> folders).</td>
          <td><em>None (Fails if omitted)</em></td>
      </tr>
      <tr>
          <td><code>-scripts</code></td>
          <td><code>&lt;path&gt;</code></td>
          <td>Path to Lua scripts directory.</td>
          <td><code>world/lib/scripts</code></td>
      </tr>
      <tr>
          <td><code>-port</code></td>
          <td><code>&lt;port&gt;</code></td>
          <td>Port on which the TCP telnet and HTTP/WS server will listen.</td>
          <td><code>4350</code></td>
      </tr>
      <tr>
          <td><code>-db</code></td>
          <td><code>&lt;conn_string&gt;</code></td>
          <td>PostgreSQL connection string.</td>
          <td><code>postgres://postgres:postgres@localhost/darkpawns?sslmode=disable</code></td>
      </tr>
      <tr>
          <td><code>-web</code></td>
          <td><code>&lt;path&gt;</code></td>
          <td>Path to legacy human web client static assets.</td>
          <td><em>None</em></td>
      </tr>
      <tr>
          <td><code>-hugo</code></td>
          <td><code>&lt;path&gt;</code></td>
          <td>Path to compiled Hugo static site (serves as root <code>/</code> path).</td>
          <td><em>None</em></td>
      </tr>
  </tbody>
</table>
<hr>
<h2 id="containerization-docker">Containerization (Docker)</h2>
<p>The repository provides five multi-stage Dockerfiles optimized for distinct production and observation tasks:</p>
<table>
  <thead>
      <tr>
          <th>Dockerfile</th>
          <th>Purpose</th>
          <th>Build Command</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>Dockerfile</code></td>
          <td>Standard production build including Lua VM sandboxes.</td>
          <td><code>docker build -f Dockerfile -t darkpawns .</code></td>
      </tr>
      <tr>
          <td><code>Dockerfile.local</code></td>
          <td>Development workspace container with hot-reloading hooks.</td>
          <td><code>docker build -f Dockerfile.local -t darkpawns-dev .</code></td>
      </tr>
      <tr>
          <td><code>Dockerfile.ai-agent</code></td>
          <td>AI agent sidecar image (Python).</td>
          <td><code>docker build -f Dockerfile.ai-agent -t dp-agent .</code></td>
      </tr>
      <tr>
          <td><code>Dockerfile.privacy-filter</code></td>
          <td>Fail-closed PII and audit scrubbing sidecar.</td>
          <td><code>docker build -f Dockerfile.privacy-filter -t dp-privacy .</code></td>
      </tr>
      <tr>
          <td><code>Dockerfile.prebuilt</code></td>
          <td>Lean runtime image utilizing a pre-built static Go binary.</td>
          <td><code>docker build -f Dockerfile.prebuilt -t darkpawns-static .</code></td>
      </tr>
  </tbody>
</table>
<h3 id="running-via-docker">Running via Docker</h3>
<p>To boot the production server container locally, mounting the world files:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>docker run -d <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  -p 4350:4350 <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  -v <span style="color:#66d9ef">$(</span>pwd<span style="color:#66d9ef">)</span>/lib/world:/app/lib/world <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  --name darkpawns-server <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  darkpawns
</span></span></code></pre></div><hr>
<h2 id="production-deployment-kubernetes">Production Deployment (Kubernetes)</h2>
<p>Full orchestration manifests reside inside the <strong><code>k8s/</code></strong> directory. To deploy a high-availability, persisted Dark Pawns cluster with Postgres backing and AI sidecars, execute the following sequence:</p>
<ol>
<li><strong>Initialize Namespace:</strong>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>kubectl apply -f k8s/namespace.yaml
</span></span></code></pre></div></li>
<li><strong>Mount Configs and Secrets:</strong>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>kubectl apply -f k8s/configmap.yaml
</span></span><span style="display:flex;"><span>kubectl apply -f k8s/secrets.yaml
</span></span></code></pre></div></li>
<li><strong>Deploy Postgres Persistence:</strong>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>kubectl apply -f k8s/postgres.yaml
</span></span></code></pre></div></li>
<li><strong>Deploy Redis (caching layer):</strong>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>kubectl apply -f k8s/redis.yaml
</span></span></code></pre></div></li>
<li><strong>Deploy Game Server &amp; Services:</strong>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>kubectl apply -f k8s/server.yaml
</span></span></code></pre></div></li>
<li><strong>Deploy Autonomous Agent Sidecar:</strong>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>kubectl apply -f k8s/ai-agent.yaml
</span></span></code></pre></div></li>
</ol>
<p>Check the status of the cluster deployment:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>kubectl get pods -n darkpawns
</span></span></code></pre></div>
### Quick Start

<h1 id="quick-start-guide">Quick Start Guide</h1>
<p>This guide will get you connected to a running Dark Pawns MUD in less than five minutes, and walk you through our in-game character creation flow.</p>
<hr>
<h2 id="5-minute-setup">5-Minute Setup</h2>
<p>To get a local server up and running on your system:</p>
<h3 id="1-compile-the-server">1. Compile the Server</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>git clone https://github.com/zax0rz/darkpawns.git
</span></span><span style="display:flex;"><span>cd darkpawns
</span></span><span style="display:flex;"><span>go build -o server ./cmd/server
</span></span></code></pre></div><h3 id="2-start-the-server-in-sandbox-mode">2. Start the Server in Sandbox Mode</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>./server -world ./lib/world -port <span style="color:#ae81ff">4350</span>
</span></span></code></pre></div><h3 id="3-connect-via-telnet">3. Connect via Telnet</h3>
<p>Open a second terminal window and execute:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>telnet localhost <span style="color:#ae81ff">4350</span>
</span></span></code></pre></div><p>You will see our ASCII graphic splash page and be prompted to enter your character&rsquo;s name!</p>
<hr>
<h2 id="character-creation-flow">Character Creation Flow</h2>
<p>When you connect with a new name, the server enters the character creation flow. This is a step-by-step state machine managed by <code>pkg/session/session_login.go</code>.</p>
<p>Both human players (entering plain text) and AI agents (answering via <code>&quot;type&quot;: &quot;char_input&quot;</code> JSON messages) go through this identical process:</p>
<h3 id="step-1-password-creation">Step 1: Password Creation</h3>
<p>Enter a secure password. If the database is connected, this is hashed via bcrypt. On subsequent logins, this password is required to play.</p>
<h3 id="step-2-ansi-color-prompt">Step 2: ANSI Color Prompt</h3>
<pre tabindex="0"><code>Do you want ANSI color? (Y/N):
</code></pre><p>Choose <code>Y</code> to enable vivid colored terminal sequences or <code>N</code> for plain ASCII. <em>(Note: If you are connecting an AI agent, the server automatically strips ANSI escape sequences recyclically on all outbound JSON state strings to ensure clean text processing for FSMs and LLMs).</em></p>
<h3 id="step-3-sex-selection">Step 3: Sex Selection</h3>
<pre tabindex="0"><code>Select your sex (M/F):
</code></pre><p>Choose <code>M</code> for Male or <code>F</code> for Female.</p>
<h3 id="step-4-race-selection">Step 4: Race Selection</h3>
<pre tabindex="0"><code>Select your race:
</code></pre><p>Select one of the 7 playable races:</p>
<ul>
<li><code>0</code>: <strong>Human</strong> (Well-balanced)</li>
<li><code>1</code>: <strong>Elf</strong> (+DEX, frail)</li>
<li><code>2</code>: <strong>Dwarf</strong> (+CON, stocky)</li>
<li><code>3</code>: <strong>Kender</strong> (+DEX, +CHA, thieves)</li>
<li><code>4</code>: <strong>Minotaur</strong> (+STR, brute force)</li>
<li><code>5</code>: <strong>Rakshasa</strong> (+INT, malevolent spirits)</li>
<li><code>6</code>: <strong>Ssaur</strong> (+INT, evolved lizardmen)</li>
</ul>
<h3 id="step-5-class-selection">Step 5: Class Selection</h3>
<pre tabindex="0"><code>Select your class:
</code></pre><p>Select one of the base classes:</p>
<ul>
<li>
<p><code>0</code>: <strong>Magic-user</strong> (Spellcaster)</p>
</li>
<li>
<p><code>1</code>: <strong>Cleric</strong> (Healer and buffer)</p>
</li>
<li>
<p><code>2</code>: <strong>Thief</strong> (Stealth and high backstabs)</p>
</li>
<li>
<p><code>3</code>: <strong>Warrior</strong> (Exceptional Strength frontline)</p>
</li>
<li>
<p><code>9</code>: <strong>Psionic</strong> (Mental spellcaster using Mind/Psi pool)</p>
</li>
<li>
<p><code>8</code>: <strong>Ninja</strong> (Agility and evasion) — <strong>Human-only</strong></p>
</li>
</ul>
<p><em>(Note: Remort-only classes — Magus(4), Avatar(5), Assassin(6), Paladin(7), Ninja(8, also base for humans), Ranger(10), Mystic(11) — are locked until you achieve Hero status on your first character life).</em></p>
<h3 id="step-6-hometown-selection">Step 6: Hometown Selection</h3>
<pre tabindex="0"><code>Choose your hometown:
</code></pre><p>Choose your starting capital:</p>
<ul>
<li><code>K</code>: <strong>Kir Drax&rsquo;in</strong></li>
<li><code>O</code>: <strong>Kir-Oshi</strong></li>
<li><code>A</code>: <strong>Alaozar</strong></li>
</ul>
<h3 id="step-7-stats-rolling--confirmation">Step 7: Stats Rolling &amp; Confirmation</h3>
<p>The server rolls your base attributes using the original AD&amp;D formula:</p>
<ol>
<li><strong>Attribute Roll:</strong> Rolls <strong>4d6</strong> (four six-sided dice), drops the lowest die, and sums the remaining three. This is repeated six times.</li>
<li><strong>Attribute Sorting:</strong> The six rolls are sorted in descending order.</li>
<li><strong>Class Priority Assignment:</strong> Base rolls are assigned to attributes based on your chosen class&rsquo;s stat priority:
<ul>
<li><em>Warrior:</em> STR, CON, DEX, CHA, WIS, INT</li>
<li><em>Mage:</em> INT, WIS, DEX, CON, STR, CHA</li>
<li><em>Cleric:</em> WIS, INT, CON, STR, DEX, CHA</li>
<li><em>Thief:</em> DEX, STR, CON, CHA, INT, WIS</li>
<li><em>Ninja:</em> DEX, STR, CON, INT, WIS, CHA</li>
<li><em>Psionic:</em> INT, WIS, DEX, CON, STR, CHA</li>
</ul>
</li>
<li><strong>Racial Bonuses:</strong> Racial modifiers are applied to the finalized rolls.</li>
<li><strong>Strength Check:</strong> Warriors who roll a natural 18 Strength are additionally granted an exceptional Strength rating (<code>18/xx</code> where <code>xx</code> is a roll from 1 to 100).</li>
</ol>
<pre tabindex="0"><code>Str: 18  Int: 12  Wis: 10  Dex: 14  Con: 15  Cha: 11
Keep this character? (Y/N):
</code></pre><p>Enter <code>Y</code> to confirm and enter the game, or <code>N</code> to re-roll your attributes.</p>
<p>Once confirmed, the server issues a standard <code>&quot;state&quot;</code> message welcoming you into the starting room (such as Room 3001, the Temple). You are now ready to play!</p>

