Code Monkey home page Code Monkey logo

cyphesis's Introduction

DEPRECATED

This code has been moved to the Worldforge repository.

Cyphesis, the Worldforge server

Join us on Gitter! Build all

Get it from the Snap Store

Cyphesis is the server for the WorldForge system.

It provides a complete solution for running an MMORPG server. Amongst its features are

  • Fully scriptable through Python
  • Live reload of both rules and world entities; edit your world without having to shut down or reload
  • Complete 3d physics simulation
  • Complex AI system, using Behavioral Trees and Python scripts
  • Out-of-process AI, allowing for distributed AI clients
  • Persistence through either SQLite or PostgreSQL
  • Powerful built in rules for visibility and containment of entities
  • Emergent gameplay through multiple simple systems interacting
  • Quick and powerful procedural terrain generation

Installation

The simplest way to install all required dependencies is by using Conan.

conan remote add worldforge https://artifactory.ogenvik.org/artifactory/api/conan/conan
conan install . --build missing
cmake --preset conan-release -DCMAKE_INSTALL_PREFIX=./build/install/release
cmake --build --preset conan-release -j --target all
cmake --build --preset conan-release -j --target mediarepo-checkout 
cmake --build --preset conan-release -j --target media-process-install 
cmake --build --preset conan-release -j --target install

NOTE: The invocation of the target "media-process-install" is optional. It will go through the raw Subversion assets and convert .png to .dds as well as scaling down textures. If you omit this step Cyphesis will instead use the raw Subversion media. Which you might want if you're developing locally.

Tests

The test suite can be built and run using the check target. For example:

make check

Documentation

Documentation describing how the system works can be found here.

There's also a collection of design documents found in the "docs/design" directory

API documentation

If Doxygen is available API documentation can be generated using the dox target. For example:

make dox

Python stubs

When editing the Python scripts that make up the rulesets it's a good idea to add the directory "docs/python" to your IDE's Python include paths. This directory contains stubs generated from the C++ bindings, which makes things such as type lookup and code completion easier.

These stubs are auto generated from the C++ bindings through the custom target "GeneratePythonDocs". Execute this target whenever you've done edits to the Python bindings.

Dependencies

We use Conan for our dependency handling. If you're developing locally you can issue this command to setup both a " debug" and "release" environment.

conan install -s build_type=Debug . --build missing --update  && conan install . --build missing --update

Running a basic server

Start the server with the cyphesis command. It will output some startup messages and then run in the foreground. If you want to run the server in the background, start the server with the option --cyphesis:daemon=true .

If an empty server is started, it will automatically be populated if the Worldforge Worlds definitions have been installed.

If everything has worked so far, and you are not planning to do any server or world development at this time then you do not need to read any of the rest of these instructions.

Usage and configuration

The main server binary is called cyphesis. Its command line arguments and configuration are managed by "varconf", which means options can be set in configuration files and on the command line. The main configuration file is called cyphesis.vconf, and server settings are stored in the [cyphesis] section. The file can be found in the cyphesis source directory, and is installed into the sysconf directory, which is by default /etc. Settings in this configuration file can be overridden in on the command line, and once overridden they will be stored permanently in ~/.config/cyphesis.vconf. In order to drop back to the default settings, remove this file. Settings can be incrementally overridden in cyphesis.vconf non-interactively by passing them as command line options to cyconf. cyconf will store any settings it is given in cyphesis.vconf and then exited. If you are planning to have multiple servers run on the same system at the same or different times, the easiest way to handle the differences in configuration would be to use the cyphesis.vconf file, and avoid modifying the master configuration file.

As an example, the ruleset to be used is set in cyphesis.vconf as follows:

   [cyphesis]
   ruleset="deeds"

This setting can be overridden by invoking cyphesis with the following option:

   --cyphesis:ruleset=werewolf

It's also possible to specify settings using environment variables. They must be prefixed by "WF_" and first specify the section and then the key, separated by "_". For example, "WF_cyphesis_bindir=/foo/bar" would set the item "bindir" in the "cyphesis" section to "/foo/bar".

For more details of varconf usage see the Varconf documentation. For full details on configuraton options for cyphesis, see the cyphesis(1) man page.

The ruleset specified indicates the entity types available, the set of scripts that will be used for these entities, and the initialisation script used to populate the server.

If an empty server is started, it will automatically be populated if the Worldforge Worlds definitions have been installed.

The default ruleset for this version is called Deeds.

User provided Python scripts

When both the "cyphesis" server and the "cyaiclient" AI process starts they look for extra python scripts to run in the "/.local/share/cyphesis/cyaiclient.d" and "/.local/share/cyphesis/cyphesis.d" directories respectively.

This allows a developer to for example set up Python remote debugging. One example would be to use the remote Python debugger included in PyCharm Professional. By creating a file named "10-debug.py" containing this code a connection will be made at startup with the debugger on port 9999.

import sys

sys.path.append('path_to_pycharm-debug-py3k.egg')
import pydevd

pydevd.settrace('localhost', port=9999, stdoutToServer=False, stderrToServer=False, suspend=False)

Using standard malloc memory allocator in Python

During development it can sometimes be good to use the standard "malloc" memory allocator rather than the Python specific allocator. For example if you want to profile memory usage. This can be enabled by setting the environment variable "PYTHONMALLOC" to something (doesn't matter what). Upon startup Cyphesis will then use malloc, and write a line about this to the log.

Performance measuring through Remotery

Performance tracking through Remotery is built in, but not enabled by default. You need to set the option "--cyphesis:remotery=true" to enable it.

After that's done you can open the file found at external/Remotery/vis/index.html to see real time measurements.

Copyright notices

The server code in C++ is distributed under the GNU General Public License. See the file COPYING for details. The script files included with this distribution are also distributed under the GNU General Public License. Note that this copyright does not cover user scripts that use server services but do not use code from the scripts provided. Using such scripts is considered ordinary use of the server, and does not fall under the heading of derived work.

How to help

If you're interested in helping out with development you should check out these resources:

cyphesis's People

Contributors

aloril avatar alriddoch avatar anthonypesce avatar atorkhov avatar davidjfelix avatar demarii avatar erikogenvik avatar jekintrivedi avatar jessehorne avatar mvanga avatar netsysfire avatar olekw avatar skogler avatar sryan avatar svparulekar avatar ytaben avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cyphesis's Issues

Segfault when changing the ruleset with an existing world and database

Steps to reproduce:

  1. Use the demo worlds, use deeds as the ruleset.
  2. Register an account and go play around a bit.
  3. Shutdown cyphesis, change /etc/cyphesis/cyphesis.vconf to use ruleset="mason" and autoimport="/usr/share/worldforge/worlds/mason/moraf/world.xml"
  4. Start cyphesis again.
  5. Immediate segfault.

Important stdout/stderr which is not in the trace:

2022-07-15T01:22:12 ERROR Rule database table contains no rules.
2022-07-15T01:22:12 INFO Looking for extra python scripts in "/var/lib/cyphesis/.local/share/cyphesis/cyphesis.d".
2022-07-15T01:22:12 INFO Restoring world from database...
2022-07-15T01:22:12 INFO Starting restoring world from storage.
2022-07-15T01:22:12 ERROR Could not restore entity with id 7 of type thing, most likely caused by this type missing.
2022-07-15T01:22:12 ERROR Could not restore entity with id 8 of type land, most likely caused by this type missing.
cyphesis: /home/build/worldforge/cyphesis/src/cyphesis/src/server/StorageManager.cpp:186: void StorageManager::restorePropertiesRecursively(LocatedEntity&): Assertion `ent.getType() != nullptr' failed.

Trace: gdb.txt

Expected behavior:

Something that says "Fatal: Entities present were created by a ruleset which is not the one running. Clear and try again." instead of segfaulting.

Conan install--stuck

Hi,

I started the conan install and worked my way through upgrading conanfile.py to conan 2.0 for the installation requirements. I've shared my work in hopes that it helps others.

Just FYI, this is the 1st time I have ever heard of conan and I have never worked with it, before [WorldForge].

Here's where I am stuck:

]# conan install .. --build missing

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=12
os=Linux

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=12
os=Linux


======== Computing dependency graph ========
Graph root
    conanfile.txt: /home/cyphesis/git/WorldForge/cyphesis/conanfile.txt
Requirements
    atlas/0.7.0@worldforge/testing#c43171da543e3998d9768320474cda71 - Cache
    boost/1.81.0#8dcd9d9df9e0d320714b83cceddbe120 - Cache
    bullet3/2.89#fb848ece2a6d6730043cd60d708e070c - Cache
    bzip2/1.0.8#411fc05e80d47a89045edc1ee6f23c1d - Cache
    cpython/3.10.0#6a5396cadb44e81a53b11e7e87907506 - Cache
    expat/2.4.1#05776613161c5afcf6d8dff34614a46d - Cache
    gdbm/1.19#c420bc00f3cc629aef665fdc3100f926 - Cache
    libbacktrace/cci.20210118#ec1aa63bbc10145c6a299e68e711670c - Cache
    libcap/2.66#0ac291aa98856fc46038c7e1a2a13a6d - Cache
    libffi/3.2.1#33b3eff20f1be5d569235ae100266729 - Cache
    libgcrypt/1.8.4#2c2d11d0bcdb363d0e1334debdff14fd - Cache
    libgpg-error/1.36#d93d9ab320672a75e2158e06e6373605 - Cache
    libuuid/1.0.3#40422af1b64fd820b5e1966e358e352e - Cache
    libxcrypt/4.4.25#663ef6741769a6759bf8549ed4d447f6 - Cache
    libxdg-basedir/1.2.3@worldforge/stable#32bd830bc6daeb63db9ccfa1d71cf6d5 - Cache
    mercator/0.4.0@worldforge/testing#cf5292c840b0c1c1396450d65e9abd0e - Cache
    mpdecimal/2.5.0#bcb80280122e1e66300b59ef21dae7e4 - Cache
    openssl/1.1.1l#030c1f2e04df820ef309a0ad79f254b3 - Cache
    readline/8.1.2#ae31d1d71b027b0fe35903eb6c2e8333 - Cache
    sigc++/2.10.0@worldforge/stable#3ef7f9b6552896664effb355fbeb72cb - Cache
    sqlite3/3.40.1#42e44d48d880b6520ae0fea7dc51b3da - Cache
    termcap/1.3.1#1986f84bf21dd07ea774b027a3201fcb - Cache
    varconf/1.0.3@worldforge/testing#b3de47602c359d3c8190650690429ae6 - Cache
    wfmath/1.0.3@worldforge/testing#0e5adb8f8def2872dbbcb82f62dc58d5 - Cache
    zlib/1.2.13#13c96f538b52e1600c40b88994de240f - Cache
Build requirements
    autoconf/2.71#f4e2bd681d49b4b80761aa587bde94d5 - Cache
    automake/1.16.5#891f585a736bce951cc0e7109aa5ffee - Cache
    b2/4.9.3#5445210661950ce568cfd76158d9e117 - Cache
    bison/3.7.6#274a83ebb4b254bd73ade2a8894f19db - Cache
    flex/2.6.4#e35bc44b3fcbcd661e0af0dc5b5b1ad4 - Cache
    gnu-config/cci.20210814#df744500fb411937e3b45e30e9dc356c - Cache
    libtool/2.4.7#d55a3c2435c19e830fa77aa5c6c19350 - Cache
    m4/1.4.19#c1c4b1ee919e34630bb9b50046253d3c - Cache
ERROR: Version conflict: cpython/3.10.0->sqlite3/3.36.0, None->sqlite3/3.40.1.

I would sincerely appreciate any help. Thank you very much.

cypasswd segfaults when the database is locked

Steps to reproduce:

  1. Use sudo or su to change into your cyphesis user.
  2. Make sure cyphesis is running.
  3. Run e.g cypasswd -r blah to make a user an admin.
  4. Segfault.
$ cypasswd -r blah
2022-07-20T01:40:51 INFO Reading settings from /var/lib/cyphesis/.cyphesis.vconf
2022-07-20T01:40:51 ERROR Varconf Warning: short argument "-r" given on command-line expects a value but none was given.
2022-07-20T01:40:51 ERROR Varconf Warning: short argument "-r" given on command-line expects a value but none was given.
2022-07-20T01:40:51 WARNING Invalid option -- :admin
terminate called after throwing an instance of 'sqlite3pp::database_error'
  what():  database is locked
Aborted (core dumped)

It works correctly when cyphesis is shut down but I expected to be able to manipulate accounts while cyphesis is running.

$ cypasswd -r blah
2022-07-20T01:42:22 INFO Reading settings from /var/lib/cyphesis/.cyphesis.vconf
2022-07-20T01:42:22 ERROR Varconf Warning: short argument "-r" given on command-line expects a value but none was given.
2022-07-20T01:42:22 ERROR Varconf Warning: short argument "-r" given on command-line expects a value but none was given.
2022-07-20T01:42:22 WARNING Invalid option -- :admin
Changing blah to a admin account
Account changed.

OS: Arch Linux
Cyphesis version: 0.6.2.r2217.ga4155ee02-1

Expected behavior:

It does not segfault and instead report a proper error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.