MadScienceZone / gma-mapper

Fantasy role-playing battle grid map for use with GMA or standalone.
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Client-side implementation of random tables #244

Closed MadScienceZone closed 2 weeks ago

MadScienceZone commented 1 month ago

This has been discussed in the GMA server project repo issue 104. The idea is for the server to provide the definition of a random outcome table (for things like the wand of wonder or the outcome of a teleport spell or the next action of a creature currently in a confused condition). This would, I think be in the form of a new type of die-roll preset. For example, something of the form

#;tablename;flags;dieroll-expression;n0;outcome0;...;nN-1;outcomeN-1;*;outcomeN;

The ; characters are arbitrary but must be consistent. Whatever character follows the initial # becomes the field delimiter for the rest of the definition. The outcome strings may use the GMA markup formatting codes.

This would arrive along with the other die roll presets and the client would store it as a known lookup table. When it detects a table lookup die-roll (to be determined what that will look like, but perhaps a new client-side syntax to add to the two known formats we already have (percentile rolls and the general multi-purpose die rolls), something like

#tablename[expression][|mods]

would roll the dieroll-expression defined in the table plus the ad-hoc expression and mods supplied by the user, roll them on the server then take the server's result and look it up in the table, scanning the table's list of values until the first one is found that the result is greater than or equal to (so the assumption is that the definition of the table is given in sorted order already). The outcome string is then presented to the user in whatever manner the client wishes, graphically or whatever.

MadScienceZone commented 3 weeks ago

Experimental implementation for this feature is evolving on the globalpresets branch. The specification of the table is now split between the Name and DieRollSpec fields. See the protocol spec for details on that branch.

MadScienceZone commented 2 weeks ago

Feature complete on the develop branch now as 4.29 beta. Once it seems stable enough I'll release it for real. The needed server-side support is up and running in the sandbox server (and already released as the 5.27.1 server)