View Full Version : Custom Dice?
Brianide
March 5th, 2014, 15:23
Does anyone know how to edit the 3D dice in FG? I'm looking to put together a FATE-based ruleset, but I've never tried to make custom dice. I read somewhere on the Internet that someone had made a FATE extension, but I don't know what it's capable of. I'd like simple double-click rolling on the sheets to throw 4dF if possible. If not, I suppose I can simply do it via text in the chat box.
Trenloe
March 5th, 2014, 15:31
There is now a dF including in Fantasy Grounds - load up a CoreRPG campaign and you'll see it with the other dice (the last one on the right) and you can roll multiples by typing in chat, for example, /die 4dF
There has been a few threads discussing FATE rulesets in the last 2 months - do a search for fate in the forums and you'll find at least 3 threads with "FATE" in the title that discuss what is available and what can be done - including a few rulesets.
Brianide
March 5th, 2014, 15:31
Thanks! I can probably just grab their work and mod it to my liking, then.
Valarian
March 6th, 2014, 13:07
There's also a Fate ruleset. Still to be updated ti Fate Core but quite usable.
Brianide
March 6th, 2014, 15:33
Sounds great. I'll get to work on it soon.
lokiare
March 7th, 2014, 23:31
I'm still interested. Is there a way to change the graphics of the dice, preferably through some kind of extension based programming?
Trenloe
March 8th, 2014, 02:38
I'm still interested. Is there a way to change the graphics of the dice, preferably through some kind of extension based programming?
You can't change the graphics of the actual 3D dice that roll. But, you can then map those results to specific custom values. See the Warhammer FRP 3 ruleset: https://www.fantasygrounds.com/library/WFRP_3E.xcp or the Star Wars: Edge of the Empire ruleset: https://www.fantasygrounds.com/forums/showthread.php?20055-Star-Wars-Edge-of-the-Empire-FG-3-0
These use the <die> object to change the result displayed after the roll to a graphic icon: https://www.fantasygrounds.com/refdoc/die.xcp
For example, for changing the result graphic of the d6:
<icon name="d6icon" file="graphics/dice/d6/d6.png" />
<icon name="d6icon.1" file="graphics/dice/d6/d6.1.png" />
<icon name="d6icon.2" file="graphics/dice/d6/d6.2.png" />
<icon name="d6icon.3" file="graphics/dice/d6/d6.3.png" />
<icon name="d6icon.4" file="graphics/dice/d6/d6.4.png" />
<icon name="d6icon.5" file="graphics/dice/d6/d6.5.png" />
<icon name="d6icon.6" file="graphics/dice/d6/d6.6.png" />
Brianide
March 8th, 2014, 05:13
Surely there's some way to mod FG to substitute new 3D models or something. Pull the dice into Blender and edit the faces? I have no idea how that's all handled.
Trenloe
March 8th, 2014, 05:15
Surely there's some way to mod FG to substitute new 3D models or something. Pull the dice into Blender and edit the faces? I have no idea how that's all handled.
Not at present.
It is in the FG wishlist: https://fg2app.idea.informer.com/proj/?ia=40886
Brianide
March 8th, 2014, 05:50
What would need to be done to make this work? I'm a software developer. Is there any way I could look at the code?
joeru
March 8th, 2014, 07:50
Yea, would be awesome to have a possibility to do custom UV maps for the 3D dice.
EDIT: The basic idea of implementation...
Provide a basic UV map template for each die type (d4, etc.), that anyone can edit to make a new die of his liking.
Provide a handler in the <customdie> to define the UV texture map file.
(And the small additional job of actually programming FG to use that UV map in the rendering of the dice. :eek: )
Blacky
March 8th, 2014, 10:28
With the fear of having pink dices with green blinking gothic numbers on it ^^
But I guess the risk exist for the frames anyway.
Zeus
March 8th, 2014, 18:10
Surely there's some way to mod FG to substitute new 3D models or something. Pull the dice into Blender and edit the faces? I have no idea how that's all handled.
I have asked this question in the past as I was interested in adding a zocchihedron (100 sided) model, the answer was that the dice rendering routines only supported the application of a bitmap color for the dice (which are baked models) with an overall bitmap for the decals. No bitmap texturing is possible as far as I know (well not without re-coding the dice rendering routines or possibly merging textures with decals). As Trenloe says its on the wish list.
Wbweather
May 28th, 2014, 17:06
You can't change the graphics of the actual 3D dice that roll. But, you can then map those results to specific custom values. See the Warhammer FRP 3 ruleset: https://www.fantasygrounds.com/library/WFRP_3E.xcp or the Star Wars: Edge of the Empire ruleset: https://www.fantasygrounds.com/forums/showthread.php?20055-Star-Wars-Edge-of-the-Empire-FG-3-0
These use the <die> object to change the result displayed after the roll to a graphic icon: https://www.fantasygrounds.com/refdoc/die.xcp
For example, for changing the result graphic of the d6:
<icon name="d6icon" file="graphics/dice/d6/d6.png" />
<icon name="d6icon.1" file="graphics/dice/d6/d6.1.png" />
<icon name="d6icon.2" file="graphics/dice/d6/d6.2.png" />
<icon name="d6icon.3" file="graphics/dice/d6/d6.3.png" />
<icon name="d6icon.4" file="graphics/dice/d6/d6.4.png" />
<icon name="d6icon.5" file="graphics/dice/d6/d6.5.png" />
<icon name="d6icon.6" file="graphics/dice/d6/d6.6.png" />
I can't seem to get the individual icons for the die face to be displayed (i.e. d6icon.1, d6icon.2. etc). I can get the generic d6icon to show up. Is there a setting somewhere that tells fantasy grounds to display the alternate icons?
Trenloe
May 28th, 2014, 17:16
I can't seem to get the individual icons for the die face to be displayed (i.e. d6icon.1, d6icon.2. etc). I can get the generic d6icon to show up. Is there a setting somewhere that tells fantasy grounds to display the alternate icons?
The setting to display the different icons in the chat window to show the result is based off the XML shown above, but it needs to be included in a specific <die name="d6"> tag - more info here: https://www.fantasygrounds.com/refdoc/die.xcp. This doesn't change the actual faces of the 3D dice in FG, it just changes the end result displayed in the chat window.
Which ruleset are you trying to change? If CoreRPG put the icon name entries in the <die name="d6"> section in gamelements.xml and then define the icon names (as shown in the XML above) in grapgics\graphics_icons.xml
Wbweather
May 29th, 2014, 04:02
I have done this and still not getting it to work. I am not sure how to structure the <die name="d6> tag.
Is this correct?
<die name="d6">
<icon>d6icon</icon>
<position>320,-78</position>
</die>
<die name="d6.1"><icon>d6icon.1</icon></die>
<die name="d6.2"><icon>d6icon.2</icon></die>
<die name="d6.3"><icon>d6icon.3</icon></die>
<die name="d6.4"><icon>d6icon.4</icon></die>
<die name="d6.5"><icon>d6icon.5</icon></die>
<die name="d6.6"><icon>d6icon.6</icon></die>
Or should it look like this?
<die name="d6">
<icon>d6icon</icon>
<icon>d6icon.1</icon>
<icon>d6icon.2</icon>
<icon>d6icon.3</icon>
<icon>d6icon.4</icon>
<icon>d6icon.5</icon>
<icon>d6icon.6</icon>
<position>320,-78</position>
</die>
In both cases I only get a d6icon displayed, never a d6icon.1, d6icon.2, etc.
I am borrowing Valarian's "One Ring" ruleset, based on Foundation Core, if that make any difference.
Valarian
May 29th, 2014, 08:22
Sounds like you're trying to do what I've been considering having read this. Have you declared the graphics for the die in order to be able to use them as icons? That would go in to the graphics XML files in the extension. Alternatively, I'll be looking to use the correct die fonts as a result of this post. I'll let everyone know when there's an updated extension.
Moon Wizard
May 29th, 2014, 09:16
The extra die tags defined are being used as images of each die face, as a workaround for the fact that FG does not currently support custom die textures or custom die fonts. When the dice are rolled, the ruleset is capturing the result after the chatwindow.onDiceLanded event, and then turning the die plus result into one of the extra die tags to show the correct graphic in the chat window.
I am looking at the Star Wars EotE ruleset for the following info. I didn't build this ruleset, so I'm not familiar with it; but this is the chain of events that should occur when a dice roll lands in the chat window.
See the following chain of function calls:
chatwindow.onDiceLanded
ChatManager.processDiceLanded
ChatManager.processDice
ChatManager.processResultDie
The resulting message is passed to the chatwindow. See resultMsg variable.
All the special processing is required to turn the die roll into the correct images in the window.
Regards,
JPG
Valarian
May 29th, 2014, 10:06
Ah thanks, from the above post I was thinking that it was something that had been built in to FG3 (if you define the additional icons). It looks as though it's a little more involved and would need to be a change to the existing die handler functionality. Still on my to-do list, though when I'll look at it I don't know.
joeru
May 29th, 2014, 10:20
I have asked this question in the past as I was interested in adding a zocchihedron (100 sided) model, the answer was that the dice rendering routines only supported the application of a bitmap color for the dice (which are baked models) with an overall bitmap for the decals. No bitmap texturing is possible as far as I know (well not without re-coding the dice rendering routines or possibly merging textures with decals). As Trenloe says its on the wish list.
So I sort of missed this while reading the response earlier: could someone in the know mind clarifying what this "overall bitmap for the decals" exactly is? It sounds an awful lot like a UV map.
Okay, so you might not be able to do flecked / wood grain / marble dice, but you might change the symbols?
Moon Wizard
May 29th, 2014, 19:23
The current architecture for the dice does not support swapping textures, and the die decals are currently textures.
The dice subsystem needs to be rebuilt from scratch to add support for fully customizable dice. Zeph and I have been discussing this on the side.
Regards,
JPG
Zeus
June 3rd, 2014, 10:38
So I sort of missed this while reading the response earlier: could someone in the know mind clarifying what this "overall bitmap for the decals" exactly is? It sounds an awful lot like a UV map.
Okay, so you might not be able to do flecked / wood grain / marble dice, but you might change the symbols?
The dice use two material shaders as far as I can tell. One to support the base color of the dice and the other to apply a UV texture map for the dice numbers that can also be colored. As JPG has said the challenge is that the current FG DirectX architecture does not allow for the die meshes to be re-textured dynamically at run time - consider them pre-baked for all intent and purposes. JPG and I have been talking about it at some length and to modify the existing code would require and considerable effort to overhaul the existing engine.
To demonstrate the kind of functionality I would like to see in the future for FG and to test as to what might be possible, I started working on a 3D dice proof of concept exercise using the Unity game engine - as a vehicle for discussion with Doug and John. I posted up a small demo app to my web site a while back which I am continuing to adapt and update. You can see latest work in progress version here:
https://www.drzeuss.co.uk/wp-content/uploads/2014/04/3D%20Dice.html (https://www.drzeuss.co.uk/wp-content/uploads/2014/04/3D%20Dice.html)
The current versions supports 3 materials/shaders per die, all customisable at run-time. At present you can re-color the base die material (shiny/matte), apply a pattern texture material (alpha/shiny/matte) as well as re-color the text material. In a not to distant version you will also be able to:
- register new dice (based upon an existing d4,d6,d8,d10 or d20 die mesh) with a new UV texture map for the text/symbols of the die.
- register your own pattern UV texture maps
- change the specular color of the base, pattern and text layers
You can see that by applying a base color (shiny/matte doesn't matter) and then applying a pattern texture at say 50% alpha transparency you get, hey presto, patterned die! My favourite combo is: light forest green + camo pattern (50%) + black text, stealth die! Ruddish brown + camo pattern (65%) + white text is quite nice too!
Seosaidh
September 14th, 2014, 04:30
So I looked at the Star Wars ruleset, and I was able to successfully modify Valarian's TOR ruleset to show TOR dice icons. However, the white numbers from the original dice are still present. They are not too obvious (except for the number 4), but they are still irritating. The Star Wars ruleset does not have this problem. I was wondering if anyone could figure (or already knew) how the Star Wars ruleset dealt with this problem. I looked at the methods used to build and deliver the message, but I couldn't find a difference that explained the difference. Changing the font also did not solve the problem. If anyone has any ideas, let me know.
Valarian
September 14th, 2014, 07:23
Trenloe would be the man to talk to. As far as I know, the display methods for Star Wars have been overriddencompletely and the dice results displayed as graphics. The actual results are cleared so they dont display at all.
damned
September 14th, 2014, 13:10
yeah.
the normal dice roll - but then the result is shown as the custom dice.
damned
September 14th, 2014, 13:20
Hey Zeus - i like how you not only kept the spinning dice but extended it... i did note as well though that a lot of spinning dice spin off the screen whereas i didnt notice that so much with rolled dice.
Zeus
September 14th, 2014, 16:25
Hey Zeus - i like how you not only kept the spinning dice but extended it... i did note as well though that a lot of spinning dice spin off the screen whereas i didnt notice that so much with rolled dice.
Yeah, I wrote the Dice PoC code as a mock up of FG's die handling under Unity BEFORE I joined Smiteworks and got access to under the hood :) I was working somewhat blind and therefore the PoC only represents an approximation of FG's dice handling. The PoC code was set up to use real physics to simulate the dice rolling, as per real life occasionally dice roll off the table :)
Jokes aside, the UltraSpin function needs tuning as the velocity of the spin is probably too high, causing the dice to occasionally hit one of the invisible colliders I created around the scene to keep the dice contained. As the velocity is so high its causing the die to hit the boundaries, jumping up and over and escaping the scene. Pesky dice.
damned
September 15th, 2014, 03:29
make the boundaries... higher.
Zeus
September 15th, 2014, 08:24
make the boundaries... higher.
Yes, that would be another approach.
antaskidayo
October 29th, 2017, 18:17
You can't change the graphics of the actual 3D dice that roll. But, you can then map those results to specific custom values. See the Warhammer FRP 3 ruleset: https://www.fantasygrounds.com/library/WFRP_3E.xcp or the Star Wars: Edge of the Empire ruleset: https://www.fantasygrounds.com/forums/showthread.php?20055-Star-Wars-Edge-of-the-Empire-FG-3-0
These use the <die> object to change the result displayed after the roll to a graphic icon: https://www.fantasygrounds.com/refdoc/die.xcp
For example, for changing the result graphic of the d6:
<icon name="d6icon" file="graphics/dice/d6/d6.png" />
<icon name="d6icon.1" file="graphics/dice/d6/d6.1.png" />
<icon name="d6icon.2" file="graphics/dice/d6/d6.2.png" />
<icon name="d6icon.3" file="graphics/dice/d6/d6.3.png" />
<icon name="d6icon.4" file="graphics/dice/d6/d6.4.png" />
<icon name="d6icon.5" file="graphics/dice/d6/d6.5.png" />
<icon name="d6icon.6" file="graphics/dice/d6/d6.6.png" />
is there a step by step process for a newbie like me?
LordEntrails
October 29th, 2017, 20:13
is there a step by step process for a newbie like me?
It requires that you write an extension. There is no step by step guide to create this type of extension, because extensions are capable of doing so many different things.
There is step by step guide for creating a custom decal extension, see the section on Custom Decal Extension section on this page (https://www.fg-con.com/free-downloads/).
The Developer Guides (https://www.fantasygrounds.com/wiki/index.php/Developer_Guides) have more detailed info.
Then as mentioned in this post, you will want to take apart an existing extension that does something similar to what you want to get some ideas.
darrenan
June 6th, 2020, 22:23
I'm trying to make a zero-based D10 (0-9) and not having much luck getting it to work. I'm trying to replace the 10 face of the d10 with a 0 face.
This is in an extension for MoreCore. Here's what I have right now:
Extension.xml
<base>
<includefile source="gameelements.xml" />
<!-- Graphics -->
<includefile source="graphics/dice/d10/base.xml" />
gameelements.xml
<root>
<die name="d4" merge="delete" />
<die name="d6" merge="delete" />
<die name="d8" merge="delete" />
<die name="d12" merge="delete" />
<die name="d20" merge="delete" />
<die name="dF" merge="delete" />
<die name="d10">
<icon>d10icon</icon>
<position>270,-60</position>
</die>
<die name="d10.1"><icon>d10icon.1</icon></die>
<die name="d10.2"><icon>d10icon.2</icon></die>
<die name="d10.3"><icon>d10icon.3</icon></die>
<die name="d10.4"><icon>d10icon.4</icon></die>
<die name="d10.5"><icon>d10icon.5</icon></die>
<die name="d10.6"><icon>d10icon.6</icon></die>
<die name="d10.7"><icon>d10icon.7</icon></die>
<die name="d10.8"><icon>d10icon.8</icon></die>
<die name="d10.9"><icon>d10icon.9</icon></die>
<die name="d10.10"><icon>d10icon.0</icon></die>
graphics/dice/d10/base.xml
<root>
<icon name="d10icon" file="graphics/dice/d10/d10.png" />
<icon name="d10icon.1" file="graphics/dice/d10/d10.1.png" />
<icon name="d10icon.2" file="graphics/dice/d10/d10.2.png" />
<icon name="d10icon.3" file="graphics/dice/d10/d10.3.png" />
<icon name="d10icon.4" file="graphics/dice/d10/d10.4.png" />
<icon name="d10icon.5" file="graphics/dice/d10/d10.5.png" />
<icon name="d10icon.6" file="graphics/dice/d10/d10.6.png" />
<icon name="d10icon.7" file="graphics/dice/d10/d10.7.png" />
<icon name="d10icon.8" file="graphics/dice/d10/d10.8.png" />
<icon name="d10icon.9" file="graphics/dice/d10/d10.9.png" />
<icon name="d10icon.0" file="graphics/dice/d10/d10.0.png" />
</root>
graphics/dice/d10/d10.0.png
36600
36601
What am I missing?
damned
June 7th, 2020, 00:43
Create a new dice called d010 and try that instead.
darrenan
June 7th, 2020, 03:04
So you can't reskin the built-in dice? I'll give that try. Does the name matter? Would d10IS (for invisible sun) work just as well?
darrenan
June 7th, 2020, 03:29
I would appreciate a clear reason why what I'm doing above doesn't work? I feel like I'm trying random stuff to get it to work, I'd rather understand it. Calling it quits for now.
damned
June 7th, 2020, 03:32
So you can't reskin the built-in dice? I'll give that try. Does the name matter? Would d10IS (for invisible sun) work just as well?
I think numbers only after the "d"
You probably could/should be able to just replace the
<icon name="d10icon.0" file="graphics/dice/d10/d10.0.png" />
You will need to do something more complex to change teh actual dice result.
darrenan
June 7th, 2020, 04:42
deleted
bracken
June 8th, 2020, 08:12
I have been playing with this myself over the last week. To create a die that can be used for a roll, (e.g. with /die in the chat box), you are limited to naming your die with a lower-case "d" followed by any number of upper-case "F" and digits. So dFFF would be acceptable for a new die that can be rolled but dABC is not. My code tracking suggests that this is down to the function isDiceString(sWord) in manager_string.lua in CoreRPG. It would be possible to change this, but only if you replaced the whole code file in your extension/ruleset. Unfortunately this would make your extension/ruleset much more prone to breaking if this file is altered in a future update to CoreRPG itself.
However, you can create die with pretty much any name if all you want to use them for is substitution during the display of the result diebox in the chat window display, i.e. you register a function using ActionsManager.registerResultHandler("dice", yourFunctionName) that processes the results of the roll to replace the die type (rRoll.sType) with another so that the icon associated with the other type is displayed in the box instead of the original. To stop the result numbers being displayed on top of the new icon, developers have tended to replace the "dieresult" font with one that has no glyphs for one or more of the digits 0 through 9. Note this appears to be the normal approach for FGC. My scanning of the forums and personal testing suggests that in FGU you can change the icon and font properties of the each rolled die in the resultHandler without having to create dummy die definitions. This means that a font could be created containing the die face glyphs that you desire and applied over a single icon representing the die shape for the result box, applying color at run-time as appropriate or using the alpha channel of the font color to make it transparent if no result number is desired.
Hope that helps.
NB - this is my assumed behaviour of everything based on stepping through code in a number of rulesets and extensions. If anyone spots any errors in what I have stated, please respond as I am learning all this as well!
Regards,
Bracken
Soskas
July 15th, 2020, 18:40
This has been an interesting thread. I'm going to try to do the same thing for a d09. I haven't coded anything in over a decade and that was Matlab. LOL. I will likely be back asking for help.
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.