I have already posted a link to my Animated Dice extension, but as I would find out later, it was still very unstable, with some bugs that would lead to Vassal errors.
Now, with the help of an ASL player, which tried to use it, it seems to be working ok, with the exception of a last detail (so far): the dice images on the chat window. I have used it with a test extension, with OCS and with Vasl, and the dice images display properly when testing with 2 different Vassal instances. So, if I roll in one instance, the animation displays in the other Vassal instance and the chat dice images show up properly. Iām using two vassal instances, but a single user. The guy who is helping me tried with two users in two different computers and it seems that the chat dice images are displaying ok for the player who is rolling, but placeholders are showing up for the opponent. Since I canāt reproduce it on my computer, Iām asking here to see if someone has any idea why this is happening.
I get the placeholders showing if I run an Animated Dice log file without installing the Animated Dice extension. Check that they didnāt get the following message on the second computer
- This game was saved with extension 'Animated 3D Dice Extension' loaded. You do not have this extension loaded. Place the file into the 'D:\Data\Vassal\Modules\Battle For Moscow\BattleforMoscow_ext' folder to load it
Also, Itās annoying that the āRollingā message and the dice display are 2 separate Commands that need 2 separate Next clicks (or 2 separate uindos) to step through in the log. I would combine the two into a single Command.
I have to say you are a brave man developing a Die Roller for the VASL crowd.
I rolled 6 dice and got 3 sixes. Talk about streaky.
Random ran = new Random();
OMG!!! They will eat you alive Thatās the original RNG we stopped using under protest in 2007 due to the VASL folks whinging.
Also, Itās annoying that the āRollingā message and the dice display are 2 separate Commands that need 2 separate Next clicks (or 2 separate uindos) to step through in the log. I would combine the two into a single Command.
I did so for when someone is using the extension with another player that isnāt. So, the Rolling message will display before the animation and the chat dice will display after the animation.
I have to say you are a brave man developing a Die Roller for the VASL crowd.
I rolled 6 dice and got 3 sixes. Talk about streaky.
Random ran = new Random();
OMG!!! They will eat you alive Thatās the original RNG we stopped using under protest >in 2007 due to the VASL folks whinging.
Is Random ran = new Random() really biased?
If so, what would you suggest in place of it, to get a fair result?
Btw, Iām not doing it specifically for ASL. In OCS it is working ok. I think it should work well with any game using one or two 6 sided dice. I did nothing for it to work in OCS and ASL. In the case of ASL, just the chat presents this problem, since they use a specific chatter class. Anyway, Vasl has pre-established buttons for specific types of dice roll, so I donāt know if they will use it anyway. Iāll make the extension available for whoever wants to use or modify it. It can fit from wargames to backgammon.
I get the placeholders showing if I run an Animated Dice log file without installing the Animated Dice extension. Check that they didnāt get the following message on the second computer
This game was saved with extension āAnimated 3D Dice Extensionā loaded. You do not have this extension loaded. Place the file into the āD:\Data\Vassal\Modules\Battle For Moscow\BattleforMoscow_extā folder to load it
Brent, when I try two instances of vassal, one with the extension and another without it, I still get the dice image, so I supposed, when I first saw it, that the images where somehow sent to the opponent:
But it seems youāre getting the placeholders in this case. I donāt know what causes it, but I think it would be safer to send text only messages for those that donāt have the extension installed. Is there a way to send a chat message that, once the images arenāt found, would display a text only message? I would have to, somehow, encode it on the command sent, I suppose.
No, images are never sent to other clients, they have to exist in the target client. Where you running the extra client under the IDE? That may have been picking up the images that would not normally be available to a normal client.
Thatās not really possible within the existing DisplayText command. The inclusion of images in the chat message by tags is an add-on hack. There are no changes you could make to DisplayText that could maje a Dice-unaware client display anything differently.
One possibility you could try is to create a new DisplayDice command to display the images. Then you send the text of the result as a DisplayText command and piggyback on a DisplayDice command to show the images. Clients that do not have AnimatedDice loaded would ignore the DisplayDice command.
DisplayDice would just locally build a DisplayText and execute it.
This gives you the Text PLUS the image, not Text OR the image, but would work cleanly on clients that donāt have the extension loaded.
Iām not sure I understood the approach, mainly the part in which DisplayDice would build the DisplayText.
I can have a DisplayText command followed by a DisplayDice command as a simple approach, but then the modules that have the extension installed will present two chat lines, one with text and one with the dice images. I think it isnāt a problem having both text and images on the same line, but having two lines would make things too poluted, since I already have the āRollingā line displayed. Yet, I think this isnāt what you have in mind.
The only way you can get a client without the extension to display a message without the Die images is to send a standard DisplayText command with the message without the source tags.
The Animated part would be sent as a separate DisplayDice command that in DisplayDice.executeCommand() does something like
<Do Dice Animation>
final Chatter.DisplayText animatedText = new Chatter.DisplayText(..., 'Report with images included');
animatedText.execute();
--
i.e. build a DisplayText command on the local client and execute it, but donāt send it anywhere.
Now, the problem you have is that on a client that has the extension, you donāt actually want to display that original text that is for the non-extension client.
Thatās where it getās interesting.
You could possibly insert your own Command Encoder that checks for a DisplayText, identifies that this is an alternate display for the extension and suppress it.
To do this, you would need to do something like
final GameModule gm = GameModule.getGameModule();
final Chatter chat = gm.getChatter();
gm.remove(chat)
gm.addCommandEncode(mySpecialCommandEncoder);
gm.add(chat);
As there is no other way to install your CommandEncoder before the already existing Chatter CommandEncoder.
Thanks for the suggestion and explanation, but I think it is becoming too complicated just to deal with a occasions where one side doesnāt have the extension, which shouldnāt be the rule, as stated by uckelman.
Iāll settle for a middle term solution. Iāll present the results as numbers before the dice images and allow users to prevent both the dice images display and the numbers display. So, if someone wants to play another person without the extension, they will get the numbers with the place holders behind. If that is bothering somehow, the one with the extension can switch off the dice images. The bonus is the it will become more customizable this way.
Here is the new version, displaying numbers and dice images with the option to turn off both.
I have optimized the buttons response too, since I found out that the sound clip was causing some delay. They are more responsive now.
Here is the link, if you are willing to try it:
Btw, is there any place I can make this link available? I noticed in Vassal site, that we can create a module page, but there is no place for extensions outside a module page. Since this extension is generical, I would like to make it available to anyone wanting to try it with any module that uses one or two 6 sided dice.
I have packed it with a readme and a license allowing anyone to change and use it at will. Is there any place in vassal site I can make the link available? If not, what would you suggest?