Autoreload of rules and scripts in Cyphesis

Posted by admin on May 21, 2018

I've done some work in Cyphesis to allow for much more powerful features for live editing of the world, mainly editing rules and scripts.

Cyphesis have since long before had support for live editing of rules. It has been possible to send Atlas operations from clients for editing or installing new rules.
However, this is not really the workflow you would want, since any rule change would be detached from the source code.
Instead you want a workflow where rules are stored in the source tree, using Git, and then updated in the running server when they are installed into the server installation location.
 
To achieve this I've worked on these areas:
1) Rules are no longer stored in the database (which used to be PostgreSQL, but now is SQLite). Only accounts and entities are stored in the database. The rules are instead stored on disk, as Atlas files (xml).
2) The Cyphesis server process will observe all file changes in the rules directory, and automatically reload any changed files.
3) The server will also observe all file changes for the Python scripts directory, and reload any Python scripts that changes.
 
This setup works nicely with CMake, since it will by default only install files that have changed.
The workflow is now instead
1) Make edits in the Cyphesis source directory for the rule or script you want to change.
2) Execute "make install" which will CMake copy only the changed files into the Cyphesis installation location.
3) Have Cyphesis automatically pick up on the change and reload or add the changes.
 
Having tried this workflow I can say that it's a huge improvement compared to the previous one. It's now much more easier add or alter entity types and alter their behaviour.

Comments

Leave a Reply



(Your email will not be publicly displayed.)


Captcha Code

Click the image to see another captcha.