Maths
When configuring game maths, two main approaches can be followed:
- Embeded: having all the details in the application and configuring for them in the Back Office just the "picker", e.g.,
{"rtp": 96}. - Flexible: provide the whole maths objects through the Back Office, making it possible to add future games from the Back Office (without any new required deploy)
During runtime, the game server will have available the maths configuration on every method call. There are two different "maths" concept inside the game servers.
- The "raw maths" or "math DTOs", which are the maths that are defined in the protobuf files and the ones that can be configured in the Back Office.
- The "engine maths", which are the ones that are generated from the raw maths and passed from the game server to the game engine. This conversion is performed by the "maths mapper" that must be provided as part of the server configuration.
Additional Notes
- The mapper is not eagerly executed at boot time but instead, lazily done the first time is required by the runtime instance or after it expires from cache.
- Because of the above, the mapper can do some convertion/generation operations that are heavier than those required for every play/spin, but still, it should not take as much as seconds.
- Maths that require heavy computation must be precomputed and used as "raw configurations" instead of leveraging the mapper.
- At some point, the server project will include a "generator" module, which will allow to have a BackOffice-ready application to configure these pre-computed maths, so separating the pre-computation of maths to its own module might be a good idea.
Use Integers, avoid Strings
Whenever possible, use numeric values (preferrably int32/64) and/or enums in the protofiles, avoiding any strings.
Avoid float, prefer double
Try to avoid the use of float values anywhere, favoring always double. The server API works solely with double values and the conversion/casting from float to double will cause precision loss in most cases.