PDA

View Full Version : Instant Dice - Disable Rolling Animation



xelab
September 18th, 2020, 21:51
This extension is now only availible on DMs Guild here (https://www.dmsguild.com/product/347009/Fantasy-Grounds-Instant-Dice).

This extension allows making any roll initiated by (double)-clicking or hotkey instant, by disabling rolling animation.
You can still use animated roll, by drag-and-dropping the dice to the chat window.
The setting can be enabled / disabled in options at any time on each individual client basis.

Compatible with FGU and FGC.

https://www.fantasygrounds.com/forums/attachment.php?attachmentid=39484&stc=1&d=1600458292

In case you find any bugs, please let me know.

Versions:
1.0: Initial release
1.1: Removed unused hooks, should improve compatibility
1.2: Implemented proper random seed setting

xelab
September 19th, 2020, 23:43
[ reserved ]

Three of Swords
September 20th, 2020, 14:01
Nice job! In my test games, this might be useful. But I suspect my players would mutiny if I tried using it in an active game. :)

Does it roll or is it instant if you drag the roll to a token on a map?

Zacchaeus
September 20th, 2020, 14:44
Does it roll or is it instant if you drag the roll to a token on a map?

Read the second line of the first post.

xelab
September 21st, 2020, 10:30
But I suspect my players would mutiny if I tried using it in an active game.

Please also note, this is per client setting, so you can disable it for yourself as GM, but allow some of the players to enable it (only) for themselves

Three of Swords
September 22nd, 2020, 02:39
Thanks for the info, both of you. Guess I should read more, and have more caffeine, before posting.

xelab
September 27th, 2020, 11:58
Version 1.1: removed unused hooks, should improve compatibility.
I would be really surprised if there are any conflicts at all now.

Weissrolf
December 1st, 2020, 19:59
Unfortunately this extension leads to the same seed being used every time I restart FGU. So rolls on a table or saving-throws on a PC always return the sequence of roll results.

Weissrolf
December 1st, 2020, 20:55
I tried to add a seed using:


math.randomseed( os.time() )

Unfortunately it seems that FGU does not support "os.time" (anymore)?!

Weissrolf
December 1st, 2020, 21:22
Turns out that os.time and os.clock are still supported by FGU, but using "math.randomseed" leads to dice rolls always returning the same one value. Unfortunately without seeding using this very useful extension is out of the question.

Frankly, FGU should just offer an option to disable 3D rolling altogether, especially since its results are so much worse (I say broken) than /die rolling.

Weissrolf
December 1st, 2020, 21:30
Seems like I made it work. Instead of issuing a new math.randomseed with every roll I did so only during initialization of the extension. This at least leads to different rolling results every time FGU is restarted.

eporrini
December 1st, 2020, 23:49
Seems like I made it work. Instead of issuing a new math.randomseed with every roll I did so only during initialization of the extension. This at least leads to different rolling results every time FGU is restarted.

Is the updated version posted in the download link?

Weissrolf
December 2nd, 2020, 01:07
Nah, I am not the original author and still testing and working on the modification.

Weissrolf
December 2nd, 2020, 03:48
Here is how to fix this. Just replace the following function (textblock) with my modification. This adds a seed that should work on Windows, Linux and OS X and discards the first three random numbers to get better results on early rolls.


function onInit()
ActionsManager.roll = roll_override;
--ActionsManager.onDiceLanded = onDiceLanded_override;
actionDrop_old = ActionsManager.actionDrop;
ActionsManager.actionDrop = actionDrop_override
registerOptions_dice()
math.randomseed( tonumber(tostring(os.time()):reverse():sub(1,6)) )
math.random() math.random () math.random ()
end

I am working on getting a Multiply-with-carry random generator working with this instead of the default math.random (same as /die). Since I lack LUA coding experience and the LUA engine in FGU is somewhat limited this may or may not work out.

Weissrolf
December 2nd, 2020, 03:55
I would love to upload a modified extension file, but I cannot find out what kind of ZIP files FGU expects? Neither Windows Sendto nor 7z ZIP Deflate seem to work.

damned
December 2nd, 2020, 07:01
Windows Send To - but dont include the parent folder - just the contents.

Weissrolf
December 2nd, 2020, 09:47
Of course, stupid me included the folder. Thank you for the hint! :)

Here is the modified extension.

Removed by request.

Smithicus
December 2nd, 2020, 17:28
Here is how to fix this. Just replace the following function (textblock) with my modification. This adds a seed that should work on Windows, Linux and OS X and discards the first three random numbers to get better results on early rolls.


function onInit()
ActionsManager.roll = roll_override;
--ActionsManager.onDiceLanded = onDiceLanded_override;
actionDrop_old = ActionsManager.actionDrop;
ActionsManager.actionDrop = actionDrop_override
registerOptions_dice()
math.randomseed( tonumber(tostring(os.time()):reverse():sub(1,6)) )
math.random() math.random () math.random ()
end

I am working on getting a Multiply-with-carry random generator working with this instead of the default math.random (same as /die). Since I lack LUA coding experience and the LUA engine in FGU is somewhat limited this may or may not work out.

This may explain the issue with math.randomseed used within LUA: https://stackoverflow.com/questions/35455489/difference-between-math-random-and-math-randomseed-in-lua (math.randomseed and LUA)

Weissrolf
December 3rd, 2020, 19:27
Curiously Instant Dice turns off /die chat command animation in Classic, but not in Unity.

Drantos
December 4th, 2020, 00:22
Thx for your work Weissrolf :-)

It is quite cool that the animation is off for hidden rolls in the dice tower too.

Cheers Drantos

Weissrolf
December 4th, 2020, 14:28
I suggest everyone who is concerned about weighted 3D dice to use the modded extension. We can neither prove nor disprove what practical impact 3D dice have on actual game-play, but this extension allows us to get more randomly spread dice results to begin with.

At least you get a choice here.

Weissrolf
December 4th, 2020, 15:33
One clarification: With Instant Dice you can still drag rolls to the chat and onto tokens and it will still do 3D rolls then. Just all those click-rolls and automated rolls are replaced with a simple random number generator.

Weissrolf
December 15th, 2020, 10:24
Curiously the very first roll after a campaign start is not handled by Instant Dice, so the first roll is a 3D roll. Yesterday we also had several single instances during the campaign where 3D dice were rolled instead of ID making the roll, despite the roll being a click-roll (no drag).

Weissrolf
December 16th, 2020, 16:29
Distribution of 1 mio. D20 results using Instant Dice (modded) vs. Random.org (real random numbers):

https://i.imgur.com/Hf2vtoo.png
Expected: 5%, standard deviation: 0.021%

https://i.imgur.com/O895899.png
Expected: 5%, standard deviation: 0.023%

For comparison, standard deviation of FGU 3D: 0.248%, FGC 3D: 0.137%

Doubles (tripples, quadruples, etc. count as multiple doubles):

https://i.imgur.com/bJgqJQB.png
Expected: 0.25%, standard deviation: 0.006%

https://i.imgur.com/8XAHvSj.png
Expected: 0.25%, standard deviation: 0.006%

For comparison, standard deviation of FGU 3D: 0.027%, FGC 3D: 0.017%

xelab
December 17th, 2020, 13:18
Wow, great work visualizing this numbers. As far as I know Lua uses Mersenne Twister for RNG and unless you do cryptography or quantum mechanics simulations there is practically no difference to true RNG. The random seed must be properly randomized of course.
Big thanks to Weissrolf for pointing this out, did not expect FG to fix the seed...
I will update first post and incorporate feedback in the coming days.

Weissrolf
December 17th, 2020, 13:25
AFAIK Fantasy Grounds uses Lua 5.1, which in turn uses the old C Rand instead of Mersenne Twister. I tried to implement some other RNG, but this was not possible with the stripped down Lua of FG. C Rand is implemented differently on each OS platform, so the results are only (fully) valid for my Windows 10 installation.

Keep in mind that I only showed distribution here. Consecutive rolls of 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 ,1,2,3... would also be uniformly distributed, but not random. ;)

I did show better random capabilities from Instant Dice (math.random) compared to 3D dice in another (locked) thread, though. It's still rather weak, especially compared to something like PCG32. But likely better than rolling tumbled dice.

Weissrolf
December 18th, 2020, 21:01
It's worth mentioning that for D8 rolls FG Classic 3D dice create measurably better randomness than Instant Dice (math.org = C Rand) on my W10 system.

If FG Unity would use Classic's dice physics then its results were far better. The latest 4.0.5 changes seem to improve results, though, despite looking rather funny (like dice doing backflips short before stopping). Still checking...

Milmoor
February 15th, 2021, 08:35
Of course, stupid me included the folder. Thank you for the hint! :)

Here is the modified extension.
You might want to remove this now this extension has moved to Dmsguild. I assume Xelab has incorporated your changes by now.

Weissrolf
February 15th, 2021, 08:52
I removed the download link by request. Was this extension improved since its original inception. Currently it keeps rolling 3D dice for the very first role of each player and even some rolls in-between. Not much of a real problem, just wondering.

xelab
February 15th, 2021, 09:01
Must be an incompatibility with some other extension. This never happened for me on either FGU or FGC, and is not reproducible by me.
The extension has indeed been improved (due to your feedback Weissrolf) incorporate proper random seed setting at initialization.

Weissrolf
February 15th, 2021, 11:13
It seems to happen because I set "local skip_roll = true" instead of "false". I did this so that ID defaults to being enabled (3D dice off) for all new players. I changed it back now, since all my current players should have ID enabled now anyway.

xelab
February 15th, 2021, 11:25
Yeah, that must have caused the issue. To change the default you have to adjust the OptionsManager definition. You have to change the default there.
By the way, this is exactly how I set it up on DMs Guild (3d dice disabled by default).

Weissrolf
February 15th, 2021, 11:48
Thanks, I think I found the line and changed the default to "on".

Weissrolf
February 15th, 2021, 11:49
Do you happen to know why the /die command is affected by the extension in Classic, but not in Unity?

xelab
February 15th, 2021, 11:57
No, different implementations I guess. However, if you use a die that does not physically exist (e.g. d7) it will always use tables (so no rolling animation anyway).

Baelzar
February 22nd, 2021, 02:29
So before we play tonight, does 1.1 from the forums still work with FGU after the 2/16 updates?

Weissrolf
February 22nd, 2021, 09:33
Did you test it yourself yet? I just did a few rolls now and it looks like it is working. We will be playing tonight and keep using it.

Weissrolf
March 30th, 2021, 14:33
The version I am using does a 3D roll every time after a character gets an effect added or removed. Does that happen with the latest retail version of Instant Dice, too?

Weissrolf
April 13th, 2021, 10:33
Turns out that in Pathfinder 2 the automation of "Persistent damage" rolls (handled as an "effect") get broken when Instant Dice is used. The rolls are made and shown in chat, but the results are not applied to the CT.

Makabriel
June 6th, 2021, 03:43
Clearing comment

Baelzar
June 6th, 2021, 03:58
$5 .... really? Wow...I know, what a bargain!

Weissrolf
June 6th, 2021, 10:27
Is this extension still supported?

xelab
June 10th, 2021, 13:01
Is this extension still supported?

The version from DMs Guild is still supported

Weissrolf
June 10th, 2021, 14:46
Does the paid version work with PF2 effects automation (persistent damage and save roll being applied)? If so then I will buy it.

xelab
June 11th, 2021, 11:24
Does the paid version work with PF2 effects automation (persistent damage and save roll being applied)? If so then I will buy it.

The extension has been only tested with DnD 5e rules and is only supported for 5e on DMs Guild.
However, it may work with other rulesets, since the extension is based only on the CoreRPG module of FG.

Having said that if you did encounter a problem with Pathfinder, that problem would, unfortunately, be present in the version on DMs Guild as well.
I do not have any experience with Pathfinder, so do not know even where to look for a possible cause, sorry about that.