Skip to content

Game: OpenD6 FUNC_2 adds the pips of both attributes instead of averaging them #109

Open

Description

@ccady

FUNC_2 in globalScripts/Convert_OPEND6_FANTASY.gd averages two OpenD6 attributes (dice codes like 3D+1) and converts the average to a backend percentile. It's used for CH (CHARISMA/ACUMEN) and SD (ACUMEN/PHYSIQUE).

It halves the dice (die = dieCombo/2), but the pips (the +N) from both scores are added together and never halved. The comment says "First average dice (add/2; remainder to +; ...)", but when the dice add up to an odd number, the leftover half die is dropped instead of going into the pips.

As a result, the "average" of two equal scores isn't equal to either one, and can land on either side of them:

Inputs FUNC_1 of each Current FUNC_2
3D+1, 3D+1 60, 60 70 (too high)
3D+2, 3D+2 70, 70 60 (too low)
3D, 2D 50, 25 25 (equal to the lower one)

For reference, FUNC_1 converts nD+p to (n - 1) × 25 + p × 10.

Possible fixes

A. Average in pips, rounding down. Turn each code into pips (3 × dice + pips, since 3 pips = 1D in OpenD6), average them, round down, convert back to nD+p, then apply the FUNC_1 formula.

var pips = (3 * die1 + extra1 + 3 * die2 + extra2) / 2   # integer division
var die = pips / 3
var extra = pips % 3

B. Average in pips, rounding half up. Same as A, but a leftover half pip rounds up: (total_pips + 1) / 2.

C. Average the two percentiles. Convert each score with FUNC_1, then average the results:

return int(round((FUNC_1(score1) + FUNC_1(score2)) / 2.0))
Inputs FUNC_1 of each Current A B C
3D+1, 3D+1 60, 60 70 60 60 60
3D+2, 3D+2 70, 70 60 70 70 70
3D, 2D 50, 25 25 35 45 38
2D+2, 3D 45, 50 45 45 50 48
4D, 2D 75, 25 50 50 50 50

All three fix the main bug: two equal scores now give the same result as FUNC_1.

Suggestion: option C

  • It's the most accurate. It's the exact average of what each attribute converts to, off by at most 0.5 from rounding. A and B round to whole pips, and one pip is worth 10 percentile points, so they can be off by 5 or more. In the 3D / 2D row, the true average is 37.5, and A and B give 35 and 45.
  • It avoids a quirk in FUNC_1. One pip is worth 10 points, but one die is only worth 25, not 30. So 2D+2 (45) and 3D (50) are only 5 points apart. Averaging in pips and then converting carries that unevenness into the result. Averaging after conversion doesn't.
  • It's consistent. D20_Converter.gd already averages percentiles, and Game: BFRPG FUNC_2 drops the half before rounding when averaging two abilities #108 suggests the same approach for BFRPG. It also removes the hand-rolled dice and pip arithmetic, including the "+3 and up adds a die" carry.
  • The backend doesn't need values on the OpenD6 grid. Backend capabilities are 0–100 percentiles checked with a d100 roll-under, so a value like 38 works fine.

If results should stay on values a real OpenD6 code could produce, A is the OpenD6-native choice. It matches how OpenD6 treats dice and pips, and it's closest to what the existing comment describes.

@MacDugRPG, you wrote this converter. Does C work for you, or do you want results that map back to real OpenD6 codes (A or B)? Once that's settled, I'm happy to fix it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions