2014-09-16 15:27:57 +03:00
|
|
|
Buildat
|
|
|
|
=======
|
2014-09-19 19:38:20 +03:00
|
|
|
A minecraftlike with vast extendability.
|
2014-09-16 15:27:57 +03:00
|
|
|
|
2014-09-18 19:35:07 +03:00
|
|
|
License: Apache 2.0
|
2014-09-16 20:39:57 +03:00
|
|
|
|
2014-09-16 17:58:01 +03:00
|
|
|
Client
|
|
|
|
------
|
|
|
|
Built using Polycode C++.
|
2014-09-16 15:27:57 +03:00
|
|
|
|
2014-09-16 18:22:12 +03:00
|
|
|
Module code is transfered from the server and run in a safe Lua sandbox.
|
|
|
|
|
2014-09-19 10:01:50 +03:00
|
|
|
Extensions are non-sandboxed code installed separately on each client.
|
|
|
|
|
2014-09-16 17:58:01 +03:00
|
|
|
Server
|
|
|
|
------
|
2014-09-20 15:30:37 +03:00
|
|
|
Built using C++ with most functionality in runtime-compiled C++ modules.
|
2014-09-16 18:22:12 +03:00
|
|
|
|
|
|
|
Module structure
|
|
|
|
----------------
|
|
|
|
module
|
2014-09-19 10:01:50 +03:00
|
|
|
|-- deps.txt << Module and extension dependencies
|
2014-09-18 19:57:52 +03:00
|
|
|
|-- <module>.cpp << Server-side code
|
2014-09-19 15:54:23 +03:00
|
|
|
|-- api.h << Structures for interfacing between modules
|
2014-09-18 18:12:59 +03:00
|
|
|
|-- client_lua
|
2014-09-18 19:57:52 +03:00
|
|
|
| `-- init.lua << Client-side code (by convention)
|
2014-09-18 18:12:59 +03:00
|
|
|
`-- client_data
|
2014-09-18 19:57:52 +03:00
|
|
|
`-- media.png << Data files (by convention)
|
2014-09-16 18:22:12 +03:00
|
|
|
|
|
|
|
Module behavior
|
|
|
|
---------------
|
2014-09-18 18:12:59 +03:00
|
|
|
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
|
2014-09-16 15:27:57 +03:00
|
|
|
|
2014-09-17 13:37:34 +03:00
|
|
|
Modules can be unloaded at runtime. Handling of client-side state is left up to
|
|
|
|
the C++ modules themselves.
|
2014-09-16 18:59:29 +03:00
|
|
|
|
2014-09-16 22:42:47 +03:00
|
|
|
The first module to be loaded is called __loader. It loads all other modules.
|
|
|
|
|
2014-09-17 00:41:27 +03:00
|
|
|
C++ modules can use the core/ and interface/ headers. Everything else is
|
|
|
|
considered unstable.
|
|
|
|
|
2014-09-17 13:37:34 +03:00
|
|
|
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/
|
2014-09-18 18:12:59 +03:00
|
|
|
files. See builtin/network as an example.
|
2014-09-17 13:37:34 +03:00
|
|
|
|
2014-09-17 15:52:15 +03:00
|
|
|
Startup sequence and what the module should do:
|
2014-09-18 17:52:44 +03:00
|
|
|
- constructor : Don't access other modules. Throw on fatal errors.
|
|
|
|
- init() : Subscribe to events; access other external things.
|
|
|
|
- "core:start" : Start doing whatever the module wants to actively do.
|
2014-09-19 17:00:15 +03:00
|
|
|
- "core:unload" : Module will be unloaded immediately after event handler.
|
2014-09-18 17:52:44 +03:00
|
|
|
- "core:continue" : Continue doing stuff after a reload.
|
2014-09-17 15:52:15 +03:00
|
|
|
|
2014-09-19 10:01:50 +03:00
|
|
|
Dependencies: deps.txt
|
|
|
|
----------------------
|
|
|
|
File format: One entry per line. Indentation for presentational purposes only.
|
|
|
|
|
|
|
|
Module entry:
|
2014-09-20 02:11:58 +03:00
|
|
|
module:<module_name> <options>
|
|
|
|
Extra CXXFLAGS:
|
|
|
|
cxxflags:<flags>
|
|
|
|
Extra LDFLAGS:
|
|
|
|
ldflags:<flags>
|
2014-09-19 10:01:50 +03:00
|
|
|
|
|
|
|
Options:
|
|
|
|
? - Optional dependency
|
2014-09-20 02:36:16 +03:00
|
|
|
r - Reverse dependency; load before the specified module
|
2014-09-19 10:01:50 +03:00
|
|
|
|
|
|
|
Example:
|
2014-09-20 02:11:58 +03:00
|
|
|
module:network
|
|
|
|
module:plants ?
|
|
|
|
module:stuff ?r
|
|
|
|
ldflags:-lsasl2
|
2014-09-19 10:01:50 +03:00
|
|
|
|
2014-09-19 10:30:49 +03:00
|
|
|
Extension structure
|
|
|
|
-------------------
|
|
|
|
extension
|
|
|
|
`-- init.lua << Loaded when the module is required
|
2014-09-20 10:04:28 +03:00
|
|
|
`-- init.cpp << Compiled as a Lua module and loaded if init.lua doesn't exist
|
2014-09-19 10:30:49 +03:00
|
|
|
|
|
|
|
Extension behavior
|
|
|
|
------------------
|
|
|
|
Extensions use the new Lua 5.1/5.2 module interface.
|
|
|
|
|
|
|
|
If an extension wish to provide an interface to sandboxed code, it should
|
2014-09-19 11:29:23 +03:00
|
|
|
implement table "safe", which contains the safe interface.
|
2014-09-19 10:30:49 +03:00
|
|
|
|
|
|
|
Extensions and modules use require "buildat/extension/<name>" to use extensions.
|
|
|
|
|
2014-09-20 11:17:27 +03:00
|
|
|
The __menu extension is specially loaded automatically at client startup if no
|
|
|
|
server address is provided on the command line. __menu can then connect to a
|
|
|
|
server. When disconnecting from a server, the whole client window is closed and
|
|
|
|
reopened.
|
2014-09-19 22:45:24 +03:00
|
|
|
|
2014-09-17 03:00:54 +03:00
|
|
|
Network protocol
|
|
|
|
----------------
|
|
|
|
(Type, length, data) tuples on TCP. In the future TLS can be taken into use. A
|
|
|
|
name->type registry is used for determining numeric packet types.
|
|
|
|
|
2014-09-17 23:22:00 +03:00
|
|
|
Data is freeform. Types 0...99 are reserved for initialization.
|
2014-09-17 03:00:54 +03:00
|
|
|
|
2014-09-18 01:12:06 +03:00
|
|
|
Core uses cereal's portable binary serialization, except for low-level packet
|
|
|
|
streaming.
|
2014-09-17 04:04:50 +03:00
|
|
|
|
|
|
|
|