PDA

View Full Version : Instant Dice - Disable Rolling Animation



xelab
September 18th, 2020, 20: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, 22:43
[ reserved ]

Three of Swords
September 20th, 2020, 13: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, 13: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, 09: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, 01:39
Thanks for the info, both of you. Guess I should read more, and have more caffeine, before posting.

xelab
September 27th, 2020, 10: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, 18: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, 19: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, 20: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, 20: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, 22: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, 00:07
Nah, I am not the original author and still testing and working on the modification.

Weissrolf
December 2nd, 2020, 02: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, 02: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, 06:01
Windows Send To - but dont include the parent folder - just the contents.

Weissrolf
December 2nd, 2020, 08: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, 16: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, 18:27
Curiously Instant Dice turns off /die chat command animation in Classic, but not in Unity.

Drantos
December 3rd, 2020, 23: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, 13: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, 14: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, 09: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, 15: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, 12: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, 12: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, 20: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, 07: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, 07: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, 08: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, 10: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, 10: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, 10:48
Thanks, I think I found the line and changed the default to "on".

Weissrolf
February 15th, 2021, 10: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, 10: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, 01: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, 08: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, 13: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, 09: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, 02:43
Clearing comment

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

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

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

The version from DMs Guild is still supported

Weissrolf
June 10th, 2021, 13: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, 10: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.

MrDDT
March 11th, 2022, 16:41
@Xelab

You still keep this updated I've noticed a few conflicts but if you not able to update it, I wont bother to post them.

Baelzar
March 11th, 2022, 18:42
@Xelab You still keep this updated I've noticed a few conflicts but if you not able to update it, I wont bother to post them.Are you talking about the original free version from these forums, or the one for sale on dmsguild? I think version 1.4?

MrDDT
March 11th, 2022, 20:01
Are you talking about the original free version from these forums, or the one for sale on dmsguild? I think version 1.4?

DMsG 1.4 version.

I'm having a few conflicts with stuff, and I don't want to post a huge detailed post if this is not being updated. I know there were other issues too, Xelab has been rarely around. We miss him.

Baelzar
March 11th, 2022, 20:38
I'll join your request because I just bought the extension last week.

Baelzar
March 13th, 2022, 03:03
Xelab is apparently MIA according to Rob T, so currently it's unsupported. 51970

jharp
March 13th, 2022, 06:39
Having talked to Rob, I will likely be supporting this product. I'll take a look at the code and see what I can see.

Jason

jharp
March 13th, 2022, 06:41
DMsG 1.4 version.

I'm having a few conflicts with stuff, and I don't want to post a huge detailed post if this is not being updated. I know there were other issues too, Xelab has been rarely around. We miss him.

@MrDDT - Let me know what issues you are having and let me see if it something I can help with.

Weissrolf
March 13th, 2022, 09:58
I switched to JHarp's Insta-Dice instead for the better support and probably better implementation. This also comes with the added benefit of updating via the Forge (and disadvantage of not getting changelogs that way).

https://forge.fantasygrounds.com/shop/items/163/view

Now that JHarp has taken over support for Instant Dice, too, I wonder if we should even keep two extensions anymore?

MrDDT
March 13th, 2022, 15:24
@MrDDT - Let me know what issues you are having and let me see if it something I can help with.

Let me switch over to yours jharp, and see what I have. If your product is working for me I wont worry about this one.

Mostly has to do with conflicts with other exts. This works out of the box but as you know Instant Dice hijacks pretty much all rolls and that can cause issues with other people that hijack rolls.

jharp
March 13th, 2022, 16:26
I added a sale that starts at 10am local today.

Jason

Weissrolf
March 13th, 2022, 18:05
Instant Dice also did not work with automated save rolls in Pathfinder 2, Insta-Dice does.

Baelzar
March 14th, 2022, 01:04
I switched to JHarp's Insta-Dice instead for the better support and probably better implementation. This also comes with the added benefit of updating via the Forge (and disadvantage of not getting changelogs that way). -SNIP-Well hell, I didn't even know about this or I wouldn't have bought the old one last week. Can you get refunded on DMsguild purchases?

jharp
March 14th, 2022, 02:49
Well I will be maintaining Instant Dice so if there are people that don't want to rebuy (and I can understand if you don't want to) and are having issues please let me know by post or DM.

Jason

nephranka
March 14th, 2022, 14:51
Are there any know conflicts with the new request a roll ext? It would be helpful for me to know if there are any ext that can not be resolved due to the nature of how this ext works? Thanks.

jharp
March 14th, 2022, 15:24
As discussed on the Insta-Dice forge page, it does not support non-standard dice like in Conan. Since the Conan ruleset is in the Vault I can't really do anything to fix this.

Other than that, it seems compatible with all other rulesets. However, if you have a particular ruleset you want to know about I can try it with it. Others who own it can report their rulesets too, but I only routinely test with 2E, and 5E.

I also understand that the Forge has the same refund policy as the normal store, but I don't know this personally.

Jason

jharp
March 14th, 2022, 15:27
Are there any know conflicts with the new request a roll ext? It would be helpful for me to know if there are any ext that can not be resolved due to the nature of how this ext works? Thanks.

With a more direct answer, I have no reports of any existing (there are previous ones that have been fixed) conflicts.

Jason

nephranka
March 14th, 2022, 17:20
With a more direct answer, I have no reports of any existing (there are previous ones that have been fixed) conflicts.

Jason

Sounds good. I will give it a try. I am in 5e but run around 70 exts (as high as 100). So, I will usually find a conflict if it is there. I am trying to reduce the number but there are really goods one out there I can't resist.

jharp
March 14th, 2022, 17:47
Well let me know if you find one and I'll give my best effort to fix.

Jason

jharp
March 15th, 2022, 20:14
Due to a small miscommunication, it turns out I will not be supporting Xelab's extensions. So I am not supporting Instant Dice. If you have some issues with Instant Dice you will need to contact Xelab. Alternatively, you can try Insta-Dice.

Jason