xaya / taurion_gsp

Taurion - A Fully Decentralised MMO built for the Xaya Platform.
https://taurion.io
GNU General Public License v3.0
23 stars 10 forks source link

Compress waypoints data in moves #155

Closed domob1812 closed 4 years ago

domob1812 commented 4 years ago

With #145, paths sent in moves got a lot bigger when moving long distances. Moving e.g. across the entire map could result in a list of waypoints that exceeds the value-size-limit in Xaya. This change replaces the value passed to wp in a move with an encoded string (which is the previous array serialised as string, compressed and base64-encoded). Moves across the map that previously would have taken 3.5 KiB now need less than 700 bytes in encoded form (which is good enough for the 2 KiB size limit).

The first impact this has is that now the findpath method returns an additional output, encoded. This is the encoded string corresponding to the returned waypoints in wp.

Secondly, the wp field in a character update move now needs to be passed a string of the right form (i.e. returned by findpath) instead of a plain JSON array of waypoints. It can also be set explicitly to JSON null, which corresponds to an empty set of waypoints, e.g. for stopping movement or mining.