Skip to content

MegaMOO 0.9.0-beta

Pre-release
Pre-release

Choose a tag to compare

@MalifaxLax MalifaxLax released this 04 Aug 21:41
· 141 commits to main since this release

Two things a verb could not do before: wait without freezing the game, and
talk to anything outside the server.

suspend

suspend(n) steps aside for a while and then carries on from the next line,
with your variables exactly as you left them. Other verbs run meanwhile.

pobj.msg("You begin meditating...")
suspend(5)
pobj.msg("You feel refreshed.")

Until now the only way to wait was pause(), which sleeps the verb thread and
freezes every player and every ticker for the duration. That makes patrols,
rituals and staged events straightforward:

for _step in ('north', 'east', 'south', 'west'):
    call_verb(this, 'gmove', args=_step)
    suspend(10)

Exactly one verb still runs at any instant. That guarantee is load-bearing —
a fifth of the verb corpus reads a property, changes it and writes it back, and
interleaving would silently lose updates — so it is preserved. What changes is
that "one at a time" no longer means "one until it finishes". Serialisation
moved from a single-worker pool to an explicit baton, and the pool grew so a
parked verb cannot deadlock the server.

A suspend is a yield point: the world can move across it. An object read before
the call may have moved or been recycled by the time the verb wakes. Re-read
what matters — the same rule MOO has always had.

request

request() calls something outside the server — a web service, a local model —
and returns immediately. The answer arrives later by calling a verb:

request('http://127.0.0.1:11434/api/generate',
        reply='npc_said', on=this, method='POST',
        json={'model': 'llama3.2', 'prompt': argstr, 'stream': False},
        tag=pobj.objnum)

The reply verb receives ok, status, body, error and tag as ordinary
variables. Failures arrive the same way, with ok false and error saying
why — by then your verb has already returned, so there is nowhere for an
exception to go.

The response body is never run as code. It arrives as a value, so a model that
emits something resembling Python cannot get it executed.

Between them these are what AI-driven NPCs need: the model call without
freezing the world, and the ability to wait mid-verb.

Fixes

  • The login screen reported the wrong version — the starter said 0.7.0 while
    running 0.9. There were four version strings disagreeing with each other;
    there is now one, and the MOTD derives from it.
  • Task.suspend's documentation described a suspend() builtin that did not
    exist, with an example that could not work. It exists now.

Also

Requires Python 3.10+. No pip install needed for the core server.

unzip megamoo-0.9.0-beta.zip
cd megamoo
python3 megamoo.py mm.db        # default port 7777
telnet localhost 7777