EngineProtocol.wiki
changeset 1 d51ef96162d8
parent 0 89253999c825
child 2 ba21be2f1b7a
equal deleted inserted replaced
0:89253999c825 1:d51ef96162d8
     1 #summary Protocol for frontend/engine interaction.
     1 #summary Protocol for frontend/engine interaction.
     2 #labels Documentation
     2 #labels Documentation,Engine,Frontend,Protocol
     3 
     3 
     4 = Introduction =
     4 = Introduction =
     5 
     5 
     6 The frontend interacts with the engine in two separate occasions:
     6 The frontend interacts with the engine in two separate occasions:
     7   * map preview generation;
     7   * 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).
    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 
    11 
    12 = Map Preview =
    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.
    13 Frontend needs to generate a preview of the map that is going to be used in game; there is no handshaking.
    14 
    14 
    15 Files on which this protocol is implemented: MapConfigViewController.m
    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]
       
    16 
    16 == Protocol ==
    17 == Protocol ==
    17 || *Frontend*      || *Engine*          || *Format*                  ||
    18 || *Frontend*      || *Engine*          || *Format*                  ||
    18 || UUID            ||                   || {{{eseed{ ... }}}}        ||
    19 || UUID            ||                   || {{{eseed{ ... }}}}        ||
    19 || Template Filter ||                   || {{{e$template_filter N}}} ||
    20 || Template Filter ||                   || {{{e$template_filter N}}} ||
    20 || Map Type        ||                   || {{{e$mapgen N}}}          ||
    21 || Map Type        ||                   || {{{e$mapgen N}}}          ||
    21 || Maze Value      ||                   || {{{e$maze N}}}            ||
    22 || Maze Value      ||                   || {{{e$maze N}}}            ||
    22 ||                 || 128x32 byte array || {{{0YSD3 ... FSAD0}}}     ||
    23 ||                 || 128x32 byte array || {{{0YSD3 ... FSAD0}}}     ||
    23 
    24 
    24 === UUID ===
    25 === UUID ===
    25 The UUID is a 32 bytes array composed of ASCII characters; groups of letters should be separated by '-'.
    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.
    26 
    27 
    27 Example: _eseed {AERTB-62FASDSAD-NNIASDSADASD-12P}_
    28 Example: _eseed {AERTB-62FASDSAD-NNIASDSADASD-12P}_
    28 
    29 
    29 === Template Filter ===
    30 === Template Filter ===
    30 _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.
    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.
    31 
    32 
    32 || *Value* || *Filter Selected* ||
    33 || *Value* || *Filter Selected* ||
    33 || 0       || None          ||
    34 || 0       || None              ||
    34 || 1       || Large         ||
    35 || 1       || Large             ||
    35 || 2       || Medium        ||
    36 || 2       || Medium            ||
    36 || 3       || Small         ||
    37 || 3       || Small             ||
    37 || 4       || Cavern        ||
    38 || 4       || Cavern            ||
    38 || 5       || Wacky         ||
    39 || 5       || Wacky             ||
    39 
    40 
    40 Example: _e$template_filter 0_
    41 Example: _e$template_filter 0_
    41 
    42 
    42 === Map Type ===
    43 === Map Type ===
    43 _N_ is a boolean variable (0/1) that selects standard map generation or maze map generation.
    44 _N_ is a boolean variable (0/1) that selects standard map generation or maze map generation.
    59 || 4       || Medium Floating Islands ||
    60 || 4       || Medium Floating Islands ||
    60 || 5       || Large Floating Islands  ||
    61 || 5       || Large Floating Islands  ||
    61 
    62 
    62 Example: _e$mazesize 4_
    63 Example: _e$mazesize 4_
    63 
    64 
       
    65 === 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.
       
    67 
       
    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.
       
    69 
       
    70 _No example needed_
       
    71 
    64 = In-Game =
    72 = In-Game =