--- a/EngineProtocol.wiki Sun Jan 17 12:45:06 2016 +0000
+++ b/EngineProtocol.wiki Sun Jan 17 12:47:07 2016 +0000
@@ -1,9 +1,11 @@
#summary Protocol for frontend/engine interaction.
#labels Documentation,Engine,Frontend,Protocol
+= Engine protocol =
+
<wiki:toc max_depth="3" />
-= Introduction =
+== Introduction ==
The frontend interacts with the engine in two separate occasions:
* map preview generation;
@@ -11,12 +13,12 @@
Messages are always in form of a string of bytes, and the first byte contains the message size (hence the maximum length is 255-1).
-= Map Preview =
+== Map preview ==
Frontend needs to generate a preview of the map that is going to be used in game; there is no handshaking.
Files in which this protocol is implemented: [http://hg.hedgewars.org/hedgewars/file/default/QTfrontend/hwmap.cpp hwmapp.cpp], [http://hg.hedgewars.org/hedgewars/file/default/project_files/HedgewarsMobile/Classes/MapConfigViewController.m MapConfigViewController.m]
-== Protocol ==
+=== Protocol ===
|| *Frontend* || *Engine* || *Format* ||
|| UUID || || {{{eseed { ... }}}} ||
|| Template Filter || || {{{e$template_filter N}}} ||
@@ -24,13 +26,13 @@
|| Maze Value || || {{{e$maze_size N}}} ||
|| || 128x32 byte array || {{{0YSD3 ... FSAD0}}} ||
-== Message Format ==
-=== UUID ===
+=== Message format ===
+==== UUID ====
The UUID is a 32 bytes array composed of ASCII characters; groups of letters should be separated by '-'. There are standard function calls to automatically generate this string depending on the tools used.
Example: _eseed {AERTB-62FASDSAD-NNIASDSADASD-12P}_
-=== Template Filter ===
+==== Template filter ====
_N_ selects the type of map that is going to be generated. This command is ignored when MapGen is not 0, but it must be set anyways.
|| *Value* || *Filter Selected* ||
@@ -43,7 +45,7 @@
Example: _e$template_filter 0_
-=== Map Type ===
+==== Map type ====
_N_ is a boolean variable (0/1) that selects standard map generation or maze map generation.
|| *Value* || *Map Type* ||
@@ -52,7 +54,7 @@
Example: _e$mapgen 1_
-=== Maze Value ===
+==== Maze value ====
_N_ selects the type of maze selected, similarly to Template Filter
|| *Value* || *Filter Selected* ||
@@ -65,14 +67,14 @@
Example: _e$maze_size 4_
-=== Image Array ===
+==== Image array ====
The reply from engine is a 128x32 bytes array which contains the preview image in pixel-dot notation: every bit represents a pixel of the image, 1 is black, 0 i white. Clearly it can only contain a monochromatic image, but it can be colored by the rendering engine of the frontend.
This image format is supported by many platforms, but it's very easy to parse anyways. The result is always a 256x128 pixel image.
_No example needed_
-= In-Game =
+== In-game ==
This doc needs more fleshing out, but in the interest of contributing, submitting an image I'd made after reading a GCI task.
[http://hg.hedgewars.org/hedgewars/raw-file/default/doc/hwdemo.png HWD file] with a little colour markup of various interesting parts of the game. BTW, if you ever need to debug a crashing demo, appending 032BFF to the end is a good way to make sure the demo doesn't close too early (see the image for why).
\ No newline at end of file