Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Genesys Dice #48

Closed
frankieali opened this issue Jun 17, 2022 · 13 comments
Closed

Genesys Dice #48

frankieali opened this issue Jun 17, 2022 · 13 comments
Labels
enhancement New feature or request

Comments

@frankieali
Copy link
Contributor

The team at Quest Portal have requested support for the Genesys game dice. They even sent over 3D models and vector images.

I've already started working on implementing this feature but wanted to add it here for tracking purposes. One thing that need reworked is identifying dice not by their number of sides, but by some other unique identifier. I'm also looking into creating a small parser that can be added as a plug-in. Then '3 green dice'(3dg) could be written as ggg which is more commonly used on Discord rollers. I'll probably add a new displayResults module over at dice ui to ensure the final results are easy to parse.

@frankieali frankieali added the enhancement New feature or request label Jun 17, 2022
@arranf
Copy link

arranf commented Sep 8, 2022

@frankieali I also am keen to try this out. Is there any way I can contribute?

@arranf
Copy link

arranf commented Sep 9, 2022

@frankieali I've started work on this - I've got some 3D models of the dice that I've tweaked and I'm working on playing with Babylon exporter to create the textures similar to the way you've done so.

@arranf
Copy link

arranf commented Sep 11, 2022

Quick update:

@frankieali I'm looking at changing some of the parsing code in dice-box to remove the implicit assumption all dice are dX because Genesys uses named dice (i.e. boost).

I think on the code side I can add the support. With the 3D models I'm hitting the boundaries of my knowledge when it comes to mapping the die faces to the results. I'd appreciate some advice on how to proceed there.

@frankieali
Copy link
Contributor Author

Hey @arranf. Yes, I think you're right about the dX names. I ran into that same issue when implementing the fate die as "df". The dice model files have gotten a little more complex to implement than I had hoped because there's specific information that you have to provide in each set. I got a great set of 3D dice models from the team at Quest Portal. I've overdue in implementing them.
Concerning the parsing code, I was thinking this would be a good opening to introduce a plug-in system. Then parsing code is not hard-coded in the core project, but is something that could be developed as a separate package or packed with the dice model themselves.
I've been working on predetermined dice rolls in the meantime, which is going to introduce a lot of code changes. I did not have a lot of bandwidth to work on this project in August, but hopefully I can make some headway this month.
I'll try to get the Genesys dice theme into the https://github.com/3d-dice/dice-themes project soon. It may only roll up numbers, but these can be remapped by another module that handles dice results similar to https://github.com/3d-dice/dice-ui/tree/main/src/displayResults

@arranf
Copy link

arranf commented Sep 11, 2022

@frankieali

RE the Genesys dice theme.
I've got a 80% working Genesys theme (will be 100% very shortly!). The guys over at Quest Portal shared with me the same ones they sent you and I've had some issues with performance from the geometry around the symbols on the faces. I can make a PR with what I have now but I was planning on tweaking those models to make them more performant.

I'd love to work with you on changing the parsing logic and remapping. I haven't had a chance to look at that yet.

Quick question: does the vite build take a long time for you for the dice-box repo? I think it's transpiling all of Babylon each time for me and it takes up to 5 minutes on a 2015 XPS with an i7. Haven't run into this before.

@frankieali
Copy link
Contributor Author

So when I'm developing code, I switch the dice-box repo to use the source code directly and skip the compiling step. Here's what I do.
In the package.json files you'll see these entries

	"files": [
		"dist",
		"copyAssets.js"
	],
	"main": "./dist/dice-box.es.js",
	"dev-files": [
		"src"
	],
	"dev-main": "./src/index",

I change these entries when developing to

	"prod-files": [
		"dist",
		"copyAssets.js"
	],
	"prod-main": "./dist/dice-box.es.js",
	"files": [
		"src"
	],
	"main": "./src/index",

This changes the entry point for the module to the source files. Then I will create an npm link. From my Dice-Box folder path in terminal I generate the virtual link like so
~Dev/fantastic/Dice-Box > nvm link
Then, I have a separate project to bring in all my modules for testing. First I set up the skeleton project using vite. Then you can link your local module using
~Dev/DiceAppTest > nvm link @3d-dice/dice-box

The code in the main.js file of my DiceAppTest is simply:

import './style.css'
import DiceBox from '@3d-dice/dice-box'
let Box = new DiceBox("#dice-box",{
	assetPath: '/assets/dice-box/',
})
Box.init().then(async(world)=>{
	Box.onRollComplete = (results) => {
		console.log(results)
	}
	Box.roll(['1d4','1d5','1d6','1d7','1d8'])
})

Then I run npm run dev from my DiceAppTest folder. It will pick up any changes in Dice-Box instantly.

Let me know if you have any questions on this. I'd could even upload my DiceAppTest project if you think it would help.

@frankieali
Copy link
Contributor Author

Once I've hit a code release point, I switch the package.json back, run a build, test it and push out the updates.

@arranf
Copy link

arranf commented Sep 11, 2022

@frankieali Thanks this is super helpful. I was doing the npm link but I wasn't doing the rest. I'll try and doc this somewhere useful on your docs site.

I put up a PR for the unoptimized Genesys theme but I'm just trying to figure out the face index mapping. Then I'll get started on a module that remaps the results.

@frankieali
Copy link
Contributor Author

Dice face mapping ... real quick (sorry, got a family event)
In Blender, under viewport overlays, ensure "Mesh Edit Mode" has "faces" checked. Then, when in edit mode on the collider model, you should be able to see the face number on the collider model that maps to the higher res dice face. In the image below you can see that the value of 9 maps to face number 17 (which appears very tiny in the center of the face).
Screen Shot 2022-09-11 at 11 08 21 AM

@arranf
Copy link

arranf commented Sep 11, 2022

No worries! Thanks for responding!

Will do this now :)

@arranf
Copy link

arranf commented Sep 11, 2022

An initial PR is up for the Genesys dice theme: 3d-dice/dice-themes#1

The next steps as I understand are:

  • Get rid of the initial restriction of prefixing dice with d
  • Add a remapper to map from the magic numerical constants in the theme to a better set of outputs

@Zireael07
Copy link

Any updates?

@frankieali
Copy link
Contributor Author

Released at @3d-dice/dice-themes/themes/genesys. Picker and Results addon available at @3d-dice/dice-ui. Demo available under "Genesys Picker" tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants