1 #summary Protocol for frontend/engine interaction. |
1 #summary Protocol for frontend/engine interaction. |
2 #labels Documentation,Engine,Frontend,Protocol |
2 #labels Documentation,Engine,Frontend,Protocol |
|
3 |
|
4 <wiki:toc max_depth="3" /> |
3 |
5 |
4 = Introduction = |
6 = Introduction = |
5 |
7 |
6 The frontend interacts with the engine in two separate occasions: |
8 The frontend interacts with the engine in two separate occasions: |
7 * map preview generation; |
9 * map preview generation; |
10 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). |
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). |
11 |
13 |
12 = Map Preview = |
14 = Map Preview = |
13 Frontend needs to generate a preview of the map that is going to be used in game; there is no handshaking. |
15 Frontend needs to generate a preview of the map that is going to be used in game; there is no handshaking. |
14 |
16 |
15 Files on which this protocol is implemented: [http://code.google.com/p/hedgewars/source/browse/QTfrontend/hwmap.cpp hwmapp.cpp], [http://code.google.com/p/hedgewars/source/browse/project_files/HedgewarsMobile/Classes/MapConfigViewController.m MapConfigViewController.m] |
17 Files in which this protocol is implemented: [http://code.google.com/p/hedgewars/source/browse/QTfrontend/hwmap.cpp hwmapp.cpp], [http://code.google.com/p/hedgewars/source/browse/project_files/HedgewarsMobile/Classes/MapConfigViewController.m MapConfigViewController.m] |
16 |
18 |
17 == Protocol == |
19 == Protocol == |
18 || *Frontend* || *Engine* || *Format* || |
20 || *Frontend* || *Engine* || *Format* || |
19 || UUID || || {{{eseed{ ... }}}} || |
21 || UUID || || {{{eseed { ... }}}} || |
20 || Template Filter || || {{{e$template_filter N}}} || |
22 || Template Filter || || {{{e$template_filter N}}} || |
21 || Map Type || || {{{e$mapgen N}}} || |
23 || Map Type || || {{{e$mapgen N}}} || |
22 || Maze Value || || {{{e$maze N}}} || |
24 || Maze Value || || {{{e$maze N}}} || |
23 || || 128x32 byte array || {{{0YSD3 ... FSAD0}}} || |
25 || || 128x32 byte array || {{{0YSD3 ... FSAD0}}} || |
24 |
26 |
|
27 == Message Format == |
25 === UUID === |
28 === UUID === |
26 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. |
29 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. |
27 |
30 |
28 Example: _eseed {AERTB-62FASDSAD-NNIASDSADASD-12P}_ |
31 Example: _eseed {AERTB-62FASDSAD-NNIASDSADASD-12P}_ |
29 |
32 |
60 || 4 || Medium Floating Islands || |
63 || 4 || Medium Floating Islands || |
61 || 5 || Large Floating Islands || |
64 || 5 || Large Floating Islands || |
62 |
65 |
63 Example: _e$mazesize 4_ |
66 Example: _e$mazesize 4_ |
64 |
67 |
65 === Array === |
68 === Image Array === |
66 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. |
69 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. |
67 |
70 |
68 This image format is supported by many platforms, but it's very easy to parse anyways. The result is always a 256x128 pixel image. |
71 This image format is supported by many platforms, but it's very easy to parse anyways. The result is always a 256x128 pixel image. |
69 |
72 |
70 _No example needed_ |
73 _No example needed_ |