This module implements the main Evennia server process, the core of the game engine.

This module should be started with the ‘twistd’ executable since it sets up all the networking features. (this is done automatically by evennia/server/server_runner.py).

class evennia.server.server.Evennia(application)[source]

Bases: object

The main Evennia server handler. This object sets up the database and tracks and interlinks all the twisted network services that make up evennia.


Setup the server.

application - an instantiated Twisted application


Optimize some SQLite stuff at startup since we can’t save it to the database.


We make sure to store the most important object defaults here, so we can catch if they change and update them on-objects automatically. This allows for changing default cmdset locations and default typeclasses in the settings file and have them auto-update all already existing objects.


This is triggered by the amp protocol when the connection to the portal has been established. This attempts to run the initial_setup script of the server. It returns if this is not the first time the server starts. Once finished the last_initial_setup_step is set to ‘done’


check so default channels exist on every restart, create if not.


Called by the amp client once receiving sync back from Portal


mode (str) – One of shutdown, reload or reset

shutdown(mode='reload', _reactor_stopping=False)[source]

Shuts down the server from inside it.

mode - sets the server restart mode.
  • ‘reload’ - server restarts, no “persistent” scripts are stopped, at_reload hooks called.

  • ‘reset’ - server restarts, non-persistent scripts stopped, at_shutdown hooks called but sessions will not be disconnected.

  • ‘shutdown’ - like reset, but server will not auto-restart.

_reactor_stopping - this is set if server is stopped by a kill

command OR this method was already called once - in both cases the reactor is dead/stopping already.


Return the server info, for display.


This is called first when the server is starting, before any other hooks, regardless of how it’s starting.


This is called every time the server starts up, regardless of how it was shut down.


This is called just before a server is shut down, regardless of it is fore a reload, reset or shutdown.


This is called only when server starts back up after a reload.


This is called just after the portal has finished syncing back data to the server after reconnecting.


mode (str) – One of ‘reload’, ‘reset’ or ‘shutdown’.


This is called only time the server stops before a reload.


This is called only when the server starts “cold”, i.e. after a shutdown or a reset.


This is called only when the server goes down due to a shutdown or reset.