This commit is contained in:
Perttu Ahola 2014-09-18 18:12:59 +03:00
parent bb8f8a6084
commit 61a2e6d2d6
3 changed files with 11 additions and 8 deletions

View File

@ -19,19 +19,21 @@ C++ modules can interface with each other by using Cereal.
Module structure
----------------
module
|-- client
| `-- init.lua << Client-side code
|-- server
| `-- init.cpp << Server-side code
|-- include
| `-- api.h << Structures for interfacing between modules
`-- data
|-- client_lua
| `-- init.lua << Client-side code
`-- client_data
`-- media.png << Data files
Module behavior
---------------
No script or data transfer to the client is initiated by the core. The
module/client/init.lua file is a convention followed by the built-in modules.
No script or data transfer to the client is initiated by the core. Conventions
followed by builtin modules:
- module/client_lua/{init,*}.lua - builtin/client_lua
- module/client_data/* - builtin/client_data
Modules can be unloaded at runtime. Handling of client-side state is left up to
the C++ modules themselves.
@ -45,8 +47,7 @@ C++ modules are run in threads, and everything they can officially access is
thread-safe.
C++ modules can provide direct library functionality inlined in their include/
files. They cannot export any internally defined functions directly, but they
can provide convenience wrappers for event-based interfaces.
files. See builtin/network as an example.
Startup sequence and what the module should do:
- constructor : Don't access other modules. Throw on fatal errors.

View File

@ -13,7 +13,7 @@ struct Module: public interface::Module
{
interface::Server *m_server;
Event::Type m_EventType_test1_thing;
Event::Type m_EventType_test1_thing; // You can cache these for more speed
Module(interface::Server *server):
interface::Module("test1"),

View File

@ -7,3 +7,5 @@ Buildat TODO
- There should be some kind of an easy synchronous calling mechanism between
modules.
- Modules should be run in threads.
- Network should leave socket fds in m_server when destructing, and pick them up
on core:continue.