author | vittorio.giovara@gmail.com |
Mon, 27 Jun 2011 22:35:05 +0000 | |
changeset 115 | 3278ecf295a3 |
parent 7 | a50f628f1564 |
child 204 | feee16fc7297 |
permissions | -rw-r--r-- |
0 | 1 |
#summary Protocol for frontend/engine interaction. |
1
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
2 |
#labels Documentation,Engine,Frontend,Protocol |
0 | 3 |
|
2 | 4 |
<wiki:toc max_depth="3" /> |
5 |
||
0 | 6 |
= Introduction = |
7 |
||
8 |
The frontend interacts with the engine in two separate occasions: |
|
9 |
* map preview generation; |
|
10 |
* game setup and statistics messages. |
|
11 |
||
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). |
|
13 |
||
14 |
= Map Preview = |
|
15 |
Frontend needs to generate a preview of the map that is going to be used in game; there is no handshaking. |
|
16 |
||
2 | 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] |
1
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
18 |
|
0 | 19 |
== Protocol == |
20 |
|| *Frontend* || *Engine* || *Format* || |
|
2 | 21 |
|| UUID || || {{{eseed { ... }}}} || |
0 | 22 |
|| Template Filter || || {{{e$template_filter N}}} || |
23 |
|| Map Type || || {{{e$mapgen N}}} || |
|
7 | 24 |
|| Maze Value || || {{{e$maze_size N}}} || |
0 | 25 |
|| || 128x32 byte array || {{{0YSD3 ... FSAD0}}} || |
26 |
||
2 | 27 |
== Message Format == |
0 | 28 |
=== UUID === |
1
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
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. |
0 | 30 |
|
31 |
Example: _eseed {AERTB-62FASDSAD-NNIASDSADASD-12P}_ |
|
32 |
||
33 |
=== Template Filter === |
|
34 |
_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. |
|
35 |
||
36 |
|| *Value* || *Filter Selected* || |
|
1
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
37 |
|| 0 || None || |
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
38 |
|| 1 || Large || |
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
39 |
|| 2 || Medium || |
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
40 |
|| 3 || Small || |
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
41 |
|| 4 || Cavern || |
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
42 |
|| 5 || Wacky || |
0 | 43 |
|
44 |
Example: _e$template_filter 0_ |
|
45 |
||
46 |
=== Map Type === |
|
47 |
_N_ is a boolean variable (0/1) that selects standard map generation or maze map generation. |
|
48 |
||
49 |
|| *Value* || *Map Type* || |
|
50 |
|| 0 || Standard Map || |
|
51 |
|| 1 || Maze Map || |
|
52 |
||
53 |
Example: _e$mapgen 1_ |
|
54 |
||
55 |
=== Maze Value === |
|
56 |
_N_ selects the type of maze selected, similarly to Template Filter |
|
57 |
||
58 |
|| *Value* || *Filter Selected* || |
|
59 |
|| 0 || Small Tunnels || |
|
60 |
|| 1 || Medium Tunnels || |
|
61 |
|| 2 || Large Tunnels || |
|
62 |
|| 3 || Small Floating Islands || |
|
63 |
|| 4 || Medium Floating Islands || |
|
64 |
|| 5 || Large Floating Islands || |
|
65 |
||
7 | 66 |
Example: _e$maze_size 4_ |
0 | 67 |
|
2 | 68 |
=== Image Array === |
1
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
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. |
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
70 |
|
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
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. |
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
72 |
|
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
73 |
_No example needed_ |
d51ef96162d8
added explanation of returning array and fixed links
vittorio.giovara@gmail.com
parents:
0
diff
changeset
|
74 |
|
0 | 75 |
= In-Game = |