Evennia-Directory Overview

This is an overview of the directories relevant to Evennia coding.

The Game directory

The game directory is created with evennia --init . In the Evennia documentation we always assume it's called mygame. Apart from the server/subfolder within, you could reorganize this folder if you preferred a different code structure for your game.

  • mygame/
    • commands/ - Overload default Commands or add your own Commands/Command sets here.
    • `server/ - The structure of this folder should not change since Evennia expects it.
      • conf/ - All server configuration files sits here. The most important file isserver.conf.
      • logs/ - Portal log files are stored here (Server is logging to the terminal by default)
    • typeclasses/ - this folder contains empty templates for overloading default game entities of Evennia. Evennia will automatically use the changes in those templates for the game entities it creates.
    • web/ - This holds the Web features of your game.
    • world/ - this is a "miscellaneous" folder holding everything related to the world you are building, such as build scripts and rules modules that don't fit with one of the other folders.

Evennia library layout:

If you cloned the GIT repo following the instructions, you will have a folder namedevennia. The top level of it contains Python package specific stuff such as a readme file, setup.py etc. It also has two subfoldersbin/ and evennia/ (again).

The bin/ directory holds OS-specific binaries that will be used when installing Evennia with pip as per the Getting started instructions. The library itself is in theevennia subfolder. From your code you will access this subfolder simply by import evennia.

  • evennia
    • __init__.py - The "flat API" of Evennia resides here.
    • commands/ - The command parser and handler.
      • default/ - The default commands and cmdsets.
    • comms/ - Systems for communicating in-game.
    • contrib/ - Optional plugins too game-specific for core Evennia.
    • game_template/ - Copied to become the "game directory" when using evennia --init.
    • help/ - Handles the storage and creation of help entries.
    • locale/ - Language files (i18n).
    • locks/ - Lock system for restricting access to in-game entities.
    • objects/ - In-game entities (all types of items and Characters).
    • players/ - Out-of-game Session-controlled entities (players, bots etc)
    • scripts/ - Out-of-game entities equivalence to Objects, also with timer support.
    • server/ - Core server code and Session handling.
      • portal/ - Portal proxy and connection protocols.
    • settings_default.py - Root settings of Evennia. Copy settings from here tomygame/server/settings.py file.
    • typeclasses/ - Abstract classes for the typeclass storage and database system.
    • utils/ - Various miscellaneous useful coding resources.
    • web/ - Web resources and webserver. Partly copied into game directory on initialization.

All directories contain files ending in .py. These are Python modules and are the basic units of Python code. The roots of directories also have (usually empty) files named __init__.py. These are required by Python so as to be able to find and import modules in other directories. When you have run Evennia at least once you will find that there will also be .pyc files appearing, these are pre-compiled binary versions of the .py files to speed up execution.

The root of the evennia folder has an __init__.py file containing the "flat API". This holds shortcuts to various subfolders in the evennia library. It is provided to make it easier to find things; it allows you to just import evennia and access things from that rather than having to import from their actual locations inside the source tree.

你可能感兴趣的:(evennia)