diff -r 3e447fab8d32 -r 79417f0b3cfe EngineProtocol.wiki --- a/EngineProtocol.wiki Mon Oct 23 11:38:46 2017 -0400 +++ b/EngineProtocol.wiki Mon Oct 23 16:41:34 2017 +0100 @@ -8,8 +8,8 @@ == Introduction == The frontend interacts with the engine in two separate occasions: - * map preview generation; - * game setup and statistics messages. + * map preview generation; + * game setup and statistics messages. 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). @@ -20,25 +20,25 @@ === Protocol === || *Frontend* || *Engine* || *Format* || -|| Seed || || {{{eseed { ... }}}} || +|| UUID || || {{{eseed { ... }}}} || || Template Filter || || {{{e$template_filter N}}} || || Map Type || || {{{e$mapgen N}}} || || Maze Value || || {{{e$maze_size N}}} || -|| || 128x32 byte array || {{{0YSD3 ... FSAD0}}} || +|| || 128×32 byte array || {{{0YSD3 ... FSAD0}}} || === Message format === ==== Seed ==== -In the QT frontend, the seed is a 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. +In the Qt frontend, the seed is a 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. -This is however just due to convenience. UUIDs are not a particularly good source of entropy and any 1-249 character string can be used. For example. 人算不如天算 is a valid seed. +This is however just due to convenience. UUIDs are not a particularly good source of entropy and any 1-249 character string can be used. For example “人算不如天算” is a valid seed. -If the string is of the form AAAAAAAAA|BBBBB (2 pipe separated strings) then only AAAAAAAAA will be used for terrain generation while AAAAAAAAA|BBBBB will be used for everything else. This allows players to use keep a terrain they generated but change the rest of the seed to ensure new positions etc. +If the string is of the form `AAAAAAAAA|BBBBB` (2 pipe separated strings) then only `AAAAAAAAA` will be used for terrain generation while `AAAAAAAAA|BBBBB` will be used for everything else. This allows players to use keep a terrain they generated but change the rest of the seed to ensure new positions etc. -Example: _eseed {AERTB-62FASDSAD-NNIASDSADASD-12P}_ +Example: `eseed {AERTB-62FASDSAD-NNIASDSADASD-12P}` ==== 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. +`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* || || 0 || None || @@ -48,19 +48,19 @@ || 4 || Cavern || || 5 || Wacky || -Example: _e$template_filter 0_ +Example: `e$template_filter 0` ==== Map type ==== -_N_ is a boolean variable (0/1) that selects standard map generation or maze map generation. +`N` is a boolean variable (0/1) that selects standard map generation or maze map generation. || *Value* || *Map Type* || || 0 || Standard Map || || 1 || Maze Map || -Example: _e$mapgen 1_ +Example: `e$mapgen 1` ==== Maze value ==== -_N_ selects the type of maze selected, similarly to Template Filter +`N` selects the type of maze selected, similarly to Template Filter. || *Value* || *Filter Selected* || || 0 || Small Tunnels || @@ -70,16 +70,16 @@ || 4 || Medium Floating Islands || || 5 || Large Floating Islands || -Example: _e$maze_size 4_ +Example: `e$maze_size 4` ==== 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. +The reply from engine is a 128×32 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. +This image format is supported by many platforms, but it's very easy to parse anyways. The result is always a 256×128 pixel image. -_No example needed_ +_No example needed._ == 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. -[https://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). +This document needs more fleshing out, but in the interest of contributing, submitting an image I'd made after reading a GCI task. +[https://hg.hedgewars.org/hedgewars/raw-file/default/doc/hwdemo.png HWD file] with a little colour markup of various interesting parts of the game. By the way, 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 to see why).