3.4 KiB
🔥 Libraries
Ember makes use of a number of third-party libraries. This document gives a brief overview of the libraries used and their purpose.
Google FlatBuffers
FlatBuffers is a serialisation library used Ember to generate the message format used for inter-server communication.
Network messages are defined in schemas located in 'spark-schemas/'. The code required to use these messages in the server modules is generated by the FlatBuffers compiler (flatc).
Code generation allows for quick iteration of the inter-server protocols, backwards and forwards compatibility, removes the possibility of mistakes caused by hand-writing serialisation code and allows for the protocol to be readily used in languages other than C++.
Boost
Boost is a large collection of libraries that perform a wide range of tasks. Ember uses the following subset of Boost libraries:
Boost Asio
Asio is an ASynchronous I/O library that primarily deals with networking.
All of Ember's networking, whether it's the client handling or Spark, our inter-server networking library, is layered on top of Boost Asio.
Boost Endian
Endian is used for ensuring that network data is the correct endianness. For example, if Ember is compiled for a big-endian architecture, Boost Endian will ensure that network message fields are still encoded in little-endian (the encoding required by the game client).
Boost Program Options
Program Options is designed for reading configuration files and handling command-line arguments.
Ember's command-line argument and configuration file handling is done with this library.
Botan
Botan is a cryptography library used primarily by Ember's own SRP6 library for its big integer maths and hashing algorithms.
PCRE
PCRE is a regular expression library used for handling character name blacklists and chat filtering.
PCRE was chosen on the basis of its performance and compatibility with regular expressions found in the game client (for the most part), as well its UTF-8 encoding handling.
Although C++'s standard regex facilities (std::regex) are used in some areas of the project, they are not used exclusively due to behavioural differences and compatibility issues experienced across different implementations.
PCRE is also used by the game itself, albeit a seemingly slightly modified version that accepts a different grammar.
RapidXML
RapidXML is a light-weight, header-only, XML parser used by the DBC code generation tool, 'dbcparser'. It is also used by the port mapping library for parsing SSDP and UPnP responses.
Google Test
Google Test, or gtest, is a unit testing library used for Ember's tests, located in the 'tests/' directory.
utf8cpp
utf8cpp is a light-weight, header-only, library for handling UTF-8 strings.
Ember uses utf8cpp to allow for correct handling of strings received from the game client.
Zlib
Zlib is a compression library used for handling compressed messages received from the client, as well as for compressing larger messages sent to the client.
MySQL Connector/C++
MySQLC/CPP is Oracle's C++ wrapper for its C-based MySQL client library. This library is only used if building the project with MySQL support.
Inja
Inja is a lightweight templating library. Ember uses it to generate RPC stubs.
Misc
A number of smaller, often header-only, Boost facilities are used. These include:
- Strong typedef
- UUID generation
- Assert
- Various containers & algorithms