fishfolk / bones

An easy-to-use game engine for making real games.
https://fishfolk.org/development/bones/introduction/
Other
236 stars 20 forks source link

feat: RNG Generator in bones #473

Closed RockasMockas closed 1 month ago

RockasMockas commented 1 month ago

This PR focused on finally linking the random seed generated by the matchmaker (pushing it to client was implemented in previous PR) into the GgrsSessionRunner + SyncingInfo, and then using it to create and insert a RngGenerator resource automatically for the developer to use easily.

Additionally, I created reworked the previous flow, now having a new interface that both re-wraps all of the Turborand methods (a few functions were inconsistent naming-wise, and gives us more flexibility to change stuff in the future), and also implements a number of missing functionality that will be helpful to devs. This new RngGenerator struct now supports:

  1. Basic Number Generation: Methods for integers, floats, and booleans.
  2. Range-based Generation: Methods for numbers within specified ranges.
  3. Character/String Generation: Methods for various character types and ASCII strings.
  4. Collection Manipulation: Methods for shuffling and sampling from collections (Vec/SVec/Vecdeque)
  5. Probability/Weighted Selection: Methods for chance-based and weighted random selection.
  6. Vector Generation: Methods for random Vec2 and Vec3 values.
MaxCWhitehead commented 1 month ago

Otherwise looks great - thanks!