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