Guides

CircleMUD with CircleMUD

CircleMUD source code predates modern compiler defaults and 64-bit architectures. This guide addresses compilation failures on GCC 12+, systemd integration, and the specific logic of zone reset commands that cause boot-time crashes when misconfigured. Follow these steps to produce a stable binary with functioning world resets on contemporary Linux distributions.

45-60 minutes7 steps
CircleMUD with CircleMUD illustration
Placeholder illustration shown while custom artwork is being produced.
1

Install dependencies and regenerate build scripts

CircleMUD's stock autoconf scripts target 1990s systems. Install automake and autoconf, then regenerate the configure script to detect modern shared libraries and 64-bit architecture flags.

terminal
sudo apt-get install build-essential automake autoconf
aclocal && autoconf && autoheader
./configure --prefix=/opt/circlemud

⚠ Common Pitfalls

  • Using stock configure without regeneration causes header detection failures on glibc 2.34+
  • Running autoconf without aclocal first produces broken configure scripts
2

Patch implicit function declarations for GCC 10+

Modern GCC treats implicit function declarations as errors. Add explicit includes and prototype declarations in comm.c and act.wizard.c to resolve strlen, sprintf, and socket API warnings that halt compilation.

comm.c
/* Add to top of comm.c and act.wizard.c */
#include <string.h>
#include <unistd.h>

/* Add to protos.h if missing */
void parse_pfile_aliases(char *arg, struct char_data *ch);

⚠ Common Pitfalls

  • Missing #include <string.h> causes cryptic 'incompatible implicit declaration' errors
  • Forgetting to declare extern functions in protos.h leads to linker errors
3

Configure circlemud.conf for systemd and log rotation

Edit the configuration file to use absolute paths for lib and log directories, disable background daemon mode when running under systemd, and set appropriate max_players limits to avoid modern kernel OOM killer triggers.

circlemud.conf
# /opt/circlemud/circlemud.conf
lib /opt/circlemud/lib
log /var/log/circlemud/syslog
daemon no
max_players 100
max_filesize 65536

⚠ Common Pitfalls

  • Relative paths break when service files use WorkingDirectory directives
  • Setting max_players above 300 without increasing file descriptor limits causes EMFILE errors
4

Validate zone file syntax and reset command sequences

Parse stock .zon files to ensure reset commands (M for mobile, O for object, G for give) follow the exact sequence: parent room must exist before loading objects or mobs into it. Check that command letters are uppercase and terminated with the S (end) command.

30.zon
# 30.zone example
30 25 2 500  # number, lifespan, mode, top_vnum
* Load mob
M 0 301 1 3000  # M if_flag mob_vnum max_exist room_vnum
* Give object to mob
G 1 302 999     # G if_flag obj_vnum max_exist
S               # Terminator

⚠ Common Pitfalls

  • Missing S terminator causes the zone parser to read into the next file
  • Loading objects into non-existent rooms creates null pointer dereferences on reset
5

Adjust reset intervals and pulse timing

Modify the zone header's reset interval (typically 15-30 minutes) and align it with the global pulse loop in comm.c. For modern VPS hosting, reduce the zone reset frequency to prevent CPU throttling during peak hours.

comm.c
/* In comm.c, verify PULSE_ZONE is defined */
#define PULSE_ZONE (75 * PULSE_PER_MUD_HOUR)

/* In db.c, zone reset logic */
if ((time_info.hours % zone_table[i].lifespan) == 0)
    reset_zone(i);

⚠ Common Pitfalls

  • Setting resets too frequent (under 5 minutes) causes lag spikes
  • Modifying PULSE_ZONE without adjusting PULSE_VIOLENCE desynchronizes combat rounds
6

Test reset behavior with isolated zones using OLC

Use OLC to create a test zone with minimal complexity. Trigger manual resets with the 'reset' command while monitoring syslog for 'SYSERR: Attempt to reset non-existent zone' messages. Verify that mob inventory resets correctly without duplicating objects.

ingame.txt
# In game as IMP
zedit
<create new zone>
save
reset
# Check syslog for errors

⚠ Common Pitfalls

  • OLC ZEDIT without saving to disk creates ephemeral zones that fail on reboot
  • Manually resetting a zone while players are inside rooms can cause duplicate object bugs
7

Debug crash loops from reset command mismatches

If the MUD crashes on boot with segmentation faults in reset_zone, enable core dumps and use gdb to backtrace. Common causes include: referencing room vnums outside the zone's range, loading mobs with invalid vnums, or giving objects to mobs that failed to load.

terminal
ulimit -c unlimited
./autorun &
# After crash:
gdb bin/circle core
gdb> bt full
# Look for reset_zone -> load_mobile

⚠ Common Pitfalls

  • Core dumps disabled by default on modern systems via ulimit
  • Assuming zone file syntax is valid because it worked in 1995; modern compilers are stricter about pointer arithmetic

What you built

With these modifications, CircleMUD compiles cleanly on GCC 12+ and executes zone resets without memory corruption. Monitor syslog for reset errors during the first 24 hours of uptime. For production deployments, wrap the binary in a systemd service file with Restart=always to handle rare pulse loop crashes during high-load resets.