Commit graph

322 commits

Author SHA1 Message Date
Erik Ogenvik
b509b8b11d Don't load server rules in client. 2018-12-16 23:20:33 +01:00
Erik Ogenvik
e85f0831b2 Restructure rule classes.
Classes under "rulesets" have been moved to "rules", and split up into
futher subdirectories matching their library. As a result we can now
better separate the python bindings, so that things that belongs to the
simulation are separeted from things that belongs to the ai.
2018-10-31 21:38:35 +01:00
Erik Ogenvik
dd22925d31 Load any user supplied files at startup.
At startup any python file contained in
~/.local/share/cyphesis/cyphesis.d or ~/.local/share/cyphesis/cyaiclient.d are executed.
This provides a method by which for example debugging can be setup.
2018-10-11 22:35:00 +02:00
Erik Ogenvik
6459ae4818 Separate main loop code into own class.
To be shared between server and client.
2018-09-22 23:11:22 +02:00
Erik Ogenvik
04fe84821e Use proper singletons everywhere.
I.e. ones where the lifespan is fully controlled.
The only exception is Options, since it's accessed during static
initialization.
2018-08-04 18:01:20 +02:00
Erik Ogenvik
e6bc7b2790 Use Ref for handling ref counting.
All LocatedEntities should always be handled through Ref instances.
These makes sure that the ref counting is correctly handled.
2018-07-22 23:48:42 +02:00
Erik Ogenvik
c80336840b Further work on converting Python bindings. 2018-07-22 19:47:35 +02:00
Erik Ogenvik
d128e1c406 Properly shut down the io_service.
We previously got hangs and errors when shutting down.
2018-05-22 22:47:11 +02:00
Erik Ogenvik
4ee75f5665 Vacuum sqlite db with interval (25 min). 2018-05-19 23:52:16 +02:00
Erik Ogenvik
86318d5f6e Make database persistence standard.
We now use sqlite to persist the world by default.
Postgresql support is provided as an option.
2018-05-19 23:33:58 +02:00
Erik Ogenvik
b0cf29b18d Use SQLite 3 for persistence.
Instead of storing data in Postgres we store it by default in SQLite,
using an in-process database.
This makes setup and handling much easier.
2018-05-19 21:47:24 +02:00
Erik Ogenvik
4e788e90c7 Separate out Postgres specific parts. 2018-05-16 21:48:18 +02:00
Erik Ogenvik
66baf9c9dc Stor all rules as files only.
We should only store entities and accounts in the database.
2018-05-16 11:22:09 +02:00
Erik Ogenvik
f1785bd9b9 Reload python modules all at once.
To prevent inconsistencies when multiple file changes.
2018-05-10 01:15:35 +02:00
Erik Ogenvik
6e62796876 Reload rules in a better manner. 2018-05-10 00:21:30 +02:00
Erik Ogenvik
5b282419be Finalize conversion to Python 3. 2018-05-07 11:15:26 +02:00
Erik Ogenvik
701d1a7208 Initial work on porting to Python 3. 2018-05-07 11:15:26 +02:00
Erik Ogenvik
e80d07560c Reload entity scripts when python code changes.
For now we reload all scripts. We should be smarter and only reload
those scripts which are affected though.
2018-04-30 23:34:58 +02:00
Erik Ogenvik
7b0849d224 Enable assets manager. 2018-04-27 23:12:15 +02:00
Erik Ogenvik
7ae19d5038 Use Singleton base class.
I.e. make sure that all objects have a defined life time. This requires
that we actually set up and tear down the singletons.
2018-04-25 20:15:29 +02:00
Erik Ogenvik
283733225f Added assets manager with file observation.
Initial code for a manager which automatically reload assets, rules and
scripts.
2018-04-25 20:15:29 +02:00
Erik Ogenvik
fd4cc2dfb7 Added "assets-download" build target.
This will download the Ember assets from amber.worldforge.org.
2018-02-06 13:45:11 +01:00
Erik Ogenvik
e7fa53214b Use nullptr instead of NULL. 2018-02-06 13:45:11 +01:00
Erik Ogenvik
7fb146eb36 Standardize installation of standard types.
This way the base types are exposed to clients.
2018-02-06 13:45:10 +01:00
Erik Ogenvik
e43fbbea7f Don't set "ipv6_only".
This seems to throw exceptions.
2017-08-13 17:16:02 +02:00
Erik Ogenvik
88aef433a4 Listen to both ipv6 and ipv4. 2017-08-08 13:59:53 +02:00
Erik Ogenvik
e9ce696dd7 Open sockets earlier in startup.
So we also fail earlier.
2017-06-24 21:46:48 +02:00
Erik Ogenvik
5e8d20a020 Use correct types. 2017-05-27 20:27:48 +02:00
Erik Ogenvik
7aaa9b9ba7 Optimize includes. 2017-03-19 21:36:52 +01:00
Erik Ogenvik
1067a4af5b Shut down in correct order.
To avoid invalid reads.
2016-12-15 18:27:42 +01:00
Olek Wojnar
d9edddbb71 Remove obsolete buildTime/buildDate system
The __TIME__ and __DATE__ macros were interfering with reproducible builds.
2016-09-04 15:35:21 -04:00
Erik Ogenvik
3966c31fdb Allow directory for binaries to be set.
By default it will use binreloc to figure out where it's running, as
with other directories.
2015-05-28 21:22:11 +02:00
Erik Ogenvik
140d124028 Removed excessive logging. 2015-05-24 12:52:37 +02:00
Erik Ogenvik
f5d6eaf033 Make Cyphesis spawn AI clients automatically.
By default an AI child process is spawned at startup, unless the
"aiclients" config value is set to 0.
2015-05-24 11:25:08 +02:00
Erik Ogenvik
f5dae1fba7 Rename Teleport* to Possess*
So that the functionality can be used in more general situations.
2015-05-24 11:25:06 +02:00
Erik Ogenvik
7ec0ea3dd4 Integrate signal handling with boost::asio.
When a signal is caught we want to exit from the boost::asio loop.
However, we can't do this by pusing another handler onto the io_service,
since this will involve a malloc call, and this can cause a deadlock (if
the signal handler is invoked from within a malloc call).
Therefore we instead need to use the signal_set functionality of
boost::asio, which guarantees that signal handling is done without
issue.
2015-04-10 22:00:56 +02:00
Erik Ogenvik
81a7c3f1d9 Format logging a bit better. 2015-04-10 21:58:31 +02:00
Erik Ogenvik
29b4de49dc Fixed incorrect format. 2015-04-09 10:57:35 +02:00
Erik Ogenvik
37f4f97c12 Clean up HttpCache when shutting down.
Also print some info.
2015-04-08 19:16:54 +02:00
Erik Ogenvik
3b9ceae5d6 Clean up monitors when shutting down. 2015-04-08 19:16:54 +02:00
Erik Ogenvik
18930c7957 Added explanatory text. 2014-10-01 19:45:42 +02:00
Erik Ogenvik
2f3ab1da18 Let the Domain handle sights.
As any world can contain multiple domains, we let the domain handle the
sights calculations.
This is a change from how this previously was done, as previously
sight checks were only done for the top level World entity. This has
changes however, so that sights checks now are done for all entities.

When determining whether an entity can be seen, the system first checks
the size of the entity against the distance from the observer. If this
check fails, the system makes exceptions if the entity in case is
outfitted or wielded.
2014-09-15 21:11:36 +02:00
Erik Ogenvik
3b295ca0a1 Added concept of a default entity.
Instead of the root entity always being the default one (for new
entities being created etc.) we now can specify another entity which is
the default one.
2014-08-27 22:17:09 +02:00
Erik Ogenvik
277bf7fc10 Improve TCP/IP responsiveness. 2014-04-09 23:08:57 +02:00
Erik Ogenvik
a8956015f9 Clarify destruction order. 2014-02-17 23:22:17 +01:00
Erik Ogenvik
850fb9247b Use more canonical way to prevent io_server stops. 2014-02-08 13:53:56 +01:00
Erik Ogenvik
c3e2487979 Support boost 1.46.
io_service::stopped() isn't available in this version.
2014-02-07 16:11:42 +01:00
Erik Ogenvik
27d264f8c0 Reset the io_sevice when it runs out of work. 2014-02-07 16:03:34 +01:00
Erik Ogenvik
9ddbce3187 Fix shutdown order issue.
The io_service needs to be destroyed pretty early on in the shutdown
process, thus it's easier with a heap allocated one.
2014-02-04 20:57:09 +01:00
Erik Ogenvik
bf4b853e61 Use a timer for soft exit. 2014-02-04 16:10:22 +01:00