浏览代码

Add hackers section to manual

Daniele Bartolini 8 年之前
父节点
当前提交
ae2ef0bf86
共有 3 个文件被更改,包括 58 次插入1 次删除
  1. 40 0
      docs/hackers/console_api.rst
  2. 10 0
      docs/hackers/index.rst
  3. 8 1
      docs/index.rst

+ 40 - 0
docs/hackers/console_api.rst

@@ -0,0 +1,40 @@
+===========
+Console API
+===========
+
+Any number of clients can connect to the engine via TCP/IP and communicate
+with simple JSON API. The default port number is 10001 as defined by ``CROWN_DEFAULT_CONSOLE_PORT``.
+You can change the port number with ``--console-port`` option.
+
+TCP protocol
+------------
+
+Every message starts with u32 header containing the size in bytes of the
+following JSON message.
+
+JSON messages
+-------------
+
+Every JSON message has a ``type`` key which identifies its type.
+Sending messages with unknown ``type`` will result with an error message:
+
+.. code::
+
+	{
+		"type" : "error",
+		"message" : "Unknown command"
+	}
+
+Execute Lua scripts
+-------------------
+
+Executing Lua script is as simple as sending the following message:
+
+.. code::
+
+	{
+		"type" : "script",
+		"script" : "print('Hello, world!')"
+	}
+
+All the tools are controlled by sending simple Lua scripts to them.

+ 10 - 0
docs/hackers/index.rst

@@ -0,0 +1,10 @@
+Hackers
+=======
+
+This section of the manual is intended for those who want to understand
+the low-level engine structure in order to modify/extend it.
+
+.. toctree::
+	:maxdepth: 2
+
+	console_api

+ 8 - 1
docs/index.rst

@@ -3,10 +3,17 @@ The Flexible Game Engine
 
 .. toctree::
    :maxdepth: 2
-   :caption: Contents:
 
    introduction
    basics
    lua_api
    boot_config
    command_line
+
+Hackers
+=======
+
+.. toctree::
+   :maxdepth: 2
+
+   hackers/index