diff options
author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2020-07-24 20:54:56 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2020-07-24 20:54:56 +0700 |
commit | 754610a0954d42a233f0a76ad53470f1f91573bc (patch) | |
tree | c785bcaeaafd1e159fe95325f4306304394a30ec /docs/source | |
parent | 328f6809f846486b206a2014a56e1fa764f5edcd (diff) | |
download | brutalmaze-754610a0954d42a233f0a76ad53470f1f91573bc.tar.gz |
Render math correctly and clean up docs
Diffstat (limited to 'docs/source')
-rw-r--r-- | docs/source/conf.py | 2 | ||||
-rw-r--r-- | docs/source/gameplay.rst | 6 | ||||
-rw-r--r-- | docs/source/images/2e3436.png | bin | 199 -> 0 bytes | |||
-rw-r--r-- | docs/source/remote.rst | 88 |
4 files changed, 52 insertions, 44 deletions
diff --git a/docs/source/conf.py b/docs/source/conf.py index b3b20a4..f8f1a8e 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -18,7 +18,7 @@ # -- Project information ----------------------------------------------------- project = 'Brutal Maze' -copyright = '2020, Nguyễn Gia Phong' +copyright = '2017-2020, Nguyễn Gia Phong' author = 'Nguyễn Gia Phong' # The full version, including alpha/beta/rc tags diff --git a/docs/source/gameplay.rst b/docs/source/gameplay.rst index eed3a05..8903bd7 100644 --- a/docs/source/gameplay.rst +++ b/docs/source/gameplay.rst @@ -110,5 +110,7 @@ As the hero always follow the mouse, perse perform close-range attack while doing so. Unlike the automatic ones, there isn't any delay between two manual slashings. -.. _trigon: https://www.pygame.org/docs/ref/gfxdraw.html#pygame.gfxdraw.aatrigon -.. _the Tango palette: https://en.wikipedia.org/wiki/Tango_Desktop_Project#Palette +.. _trigon: + https://www.pygame.org/docs/ref/gfxdraw.html#pygame.gfxdraw.aatrigon +.. _the Tango palette: + https://en.wikipedia.org/wiki/Tango_Desktop_Project#Palette diff --git a/docs/source/images/2e3436.png b/docs/source/images/2e3436.png deleted file mode 100644 index 403caaf..0000000 --- a/docs/source/images/2e3436.png +++ /dev/null Binary files differdiff --git a/docs/source/remote.rst b/docs/source/remote.rst index 7a92d55..ddca8db 100644 --- a/docs/source/remote.rst +++ b/docs/source/remote.rst @@ -14,9 +14,9 @@ Server Output ------------- First, the game will export its data to a byte sequence (which in this case, -is simply a ASCII string without null-termination) of the length *l*. -Before sending the data to the client, the server would send the number *l* -padded to 7 digits. +is simply a ASCII string without null-termination) of the length :math:`l`. +Before sending the data to the client, the server would send the number +:math:`l` padded to 7 digits. Below is the meta structure of the data:: @@ -29,14 +29,15 @@ Below is the meta structure of the data:: The Maze ^^^^^^^^ -Visible parts of the maze with the width *nw* and the height *nh* are exported -as a byte map of *nh* lines and *nw* columns. Any character other than 0 -represents a blocking *cell*, i.e. a wall. +Visible parts of the maze with the width :math:`n_w` and the height :math:`n_h` +are exported as a byte map of :math:`n_h` lines and :math:`n_w` columns. +Any character other than 0 represents a blocking *cell*, i.e. a wall. To avoid floating point number in later description of other objects, each cell has the width (and height) of 100, which means the top left corner of -the top left cell has the coordinates of (0, 0) and the bottom right vertex of -the bottom right cell has the coordinates of (100 *nw*, 100 *nh*). +the top left cell has the coordinates of :math:`(0, 0)` and the bottom right +vertex of the bottom right cell has the coordinates of +:math:`(100 n_w, 100 n_h)`. The Hero ^^^^^^^^ @@ -44,20 +45,20 @@ The Hero 6 properties of the hero are exported in one line, separated by 1 space, in the following order: -:Hero's color: +:Color: The current HP of the hero, as shown in in the later section. :X-coordinate: - An integer in the range of [0, 100 *nw*]. + An integer within :math:`[0, 100 n_w]`. :Y-coordinate: - An integer in the range of [0, 100 *nh*]. + An integer within :math:`[0, 100 n_h]`. Note that the y-axis points up-side-down instead of pointing upward. :Angle: The direction the hero is pointing to in degrees, cast to an integer from 0 to 360. Same note as above (the unit circle figure might help you understand this easier). -:Flag showing if the hero can strike an attack: +:Can attack: 0 for *no* and 1 for *yes*. -:Flag showing if the hero can heal: +:Can heal: 0 for *no* and 1 for *yes*. .. image:: images/unit-circle.png @@ -70,29 +71,34 @@ Each enemy exports these properties: :Color: The type and the current HP of the enemy, as shown in the table below. :X-coordinate: - An integer in the range of [0, 100 *nw*]. + An integer within :math:`[0, 100 n_w]`. :Y-coordinate: - An integer in the range of [0, 100 *nh*]. + An integer within :math:`[0, 100 n_h]`. :Angle: The direction the enemy is pointing to in degrees, cast to a nonnegative integer. To shorten the data, each color (in the Tango palette) is encoded to a -lowercase letter or number 0. Different shades of a same color indicating -different HP of the characters. - -=========== ======== ======== ======== ======== ======== ======== -HP 5 4 3 2 1 0 -=========== ======== ======== ======== ======== ======== ======== -Butter |fce94f| |edd400| |c4a000| |2e3436| -Orange |fcaf3e| |f57900| |ce5c00| |2e3436| -Chocolate |e9b96e| |c17d11| |8f5902| |2e3436| -Chameleon |8ae234| |73d216| |4e9a06| |2e3436| -Sky Blue |729fcf| |3465a4| |204a87| |2e3436| -Plum |ad7f8a| |75507b| |5c3566| |2e3436| -Scarlet Red |ef2929| |cc0000| |a40000| |2e3436| -Aluminium |eeeeec| |d3d7cf| |babdb6| |888a85| |555753| |2e3436| -=========== ======== ======== ======== ======== ======== ======== +lowercase letter. Different shades of a same color indicating different HP +of the characters. + +=========== ======== ======== ======== ======== ======== +HP 5 4 3 2 1 +=========== ======== ======== ======== ======== ======== +Butter |fce94f| |edd400| |c4a000| +Orange |fcaf3e| |f57900| |ce5c00| +Chocolate |e9b96e| |c17d11| |8f5902| +Chameleon |8ae234| |73d216| |4e9a06| +Sky Blue |729fcf| |3465a4| |204a87| +Plum |ad7f8a| |75507b| |5c3566| +Scarlet Red |ef2929| |cc0000| |a40000| +Aluminium |eeeeec| |d3d7cf| |babdb6| |888a85| |555753| +=========== ======== ======== ======== ======== ======== + +.. note:: + + If a character shows up with color ``0``, it is safe to ignore it + since it is a dead body yet to be cleaned up. Flying bullets ^^^^^^^^^^^^^^ @@ -104,9 +110,9 @@ Bullets also export 4 properties like enemies: encoded similarly to characters', except that aluminium bullets only have 4 colors ``v``, ``w``, ``x`` and ``0``. :X-coordinate: - An integer in the range of [0, 100 *nw*]. + An integer within :math:`[0, 100 n_w]`. :Y-coordinate: - An integer in the range of [0, 100 *nh*]. + An integer within :math:`[0, 100 n_h]`. :Angle: The bullet's flying direction in degrees, cast to a nonnegative integer. @@ -163,10 +169,10 @@ Movement This is the most awkward one. As we can all imagine, there are nine different directions for the hero to move. Were they represented as two-dimensional vectors, at least three characters would be needed to describe such -a simple thing, e.g. ``1 0`` for m = (1, 0), and in the worst-case scenario -m = (-1, -1), we would need five: ``-1 -1``. 40 bits used to carry a four-bit -piece of data, freaking insane, right? So instead, we decided to *slightly* -encode it like this: +a simple thing, e.g. ``1 0`` for :math:`m = (1, 0)`, and in the worst-case +scenario :math:`m = (-1, -1)`, we would need five: ``-1 -1``. 40 bits are used +to carry a four-bit piece of data, freaking insane, right? So instead, +we decided to *slightly* encode it like this: ========= ==== === ===== Direction Left Nil Right @@ -198,10 +204,10 @@ can yet strike an attack (as described in above section about `The Hero`_). Pseudo-Client ------------- -#. Create INET, STREAMing socket *s* -#. Connect *s* to the address ``host:port`` which the server is bound to -#. Receive length *l* of data -#. If *l* > 0, close *s* and quit +#. Create an INET, STREAMing socket ``sock`` +#. Connect ``sock`` to the address ``host:port`` which the server is bound to +#. Receive length :math:`l` of data +#. If :math:`l > 0`, close ``sock`` and quit #. Receive the data #. Process the data #. Send instruction for the hero to the server and go back to step 3 @@ -215,8 +221,8 @@ the client-examples_ directory (more are coming). .. _client-examples: https://git.disroot.org/McSinyx/brutalmaze/src/branch/master/client-examples + .. |204a87| image:: images/204a87.png -.. |2e3436| image:: images/2e3436.png .. |3465a4| image:: images/3465a4.png .. |4e9a06| image:: images/4e9a06.png .. |555753| image:: images/555753.png |