Use Real Dice Rolls?
Moderators: dorpond, Azhrei, giliath
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: Use Real Dice Rolls?
Btw, here is some source code for java based facial recognition software: http://www.advancedsourcecode.com/javaface.asp
After watching the linked youtube video, I think it would be pretty easy to try and use this for "dice" recognition. I don't know what recognition methods it's using (faces are, after all, different than dice)... but it would be a good place to start. Start with a D6 and take baseline top-down pictures of the dice to set the "Select the Image to be Recognized" images. Then take a bunch of random shots of D6 dice from above and with varying orientations and angles... and see how well the program handles the recognition.
If it works really well... you might have something to build on.
After watching the linked youtube video, I think it would be pretty easy to try and use this for "dice" recognition. I don't know what recognition methods it's using (faces are, after all, different than dice)... but it would be a good place to start. Start with a D6 and take baseline top-down pictures of the dice to set the "Select the Image to be Recognized" images. Then take a bunch of random shots of D6 dice from above and with varying orientations and angles... and see how well the program handles the recognition.
If it works really well... you might have something to build on.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
- jfrazierjr
- Deity
- Posts: 5176
- Joined: Tue Sep 11, 2007 7:31 pm
Re: Use Real Dice Rolls?
pirklbauer31 wrote:That's why I asked if it was possible to combine using real dice with RPTools
If you build a java class which can "read" dice, in whatever way you decided to build such an application, then we can easily help you plug in the actual results for SIMPLE dice rolls. Regardless of how you actual "read" the dice rolls:
- bluetooth dice, which I would assume would be very expensive
- camera software that turns the dice into a number
- some form of magic I am unaware of
If for some reason, you don't want to do java, well, then thing get a bit more complicated, but not overely so. In this case, I would have MapTool configured with a webservice. This is where things get tricky since you really HAVE to decide ahead of time something. Will you tell MapTool someone is about to rolls some dice, then read the results from the external application, and plug into MapTool
OR
Will you roll the dice first manually and THEN tell Dicetool the result/go get the result.
Either way is acceptable.
Honestly, the more I think about it, the more I think that MapTool hosting a webservice call and/or(ie for either way) a web service client would be best and then it could be fairly extensible to other applications with a correct API without the external application needing to know anything about MapTool's internals.
One issue with your thought process would be: what happens with various game mechanics? Example:
Shadowrun's variable dice pool. Does it default to count successes, does it default to just summing all the dice, what?
D&D 5e's Advantage/Disadvantge. In that system you have modifiers to either roll d20 twice and take the higher or d20 twice and take the lower depending upon the situation. Would you be required to roll BOTH at the same time so MapTool could somehow know to apply only one of the two possible results(this could be accomplished with quickly and easily with a variable to say if high/low is used), but what happens if the person only rolls a SINGLE d20.
The thing is, the simple cases really are simple. But as with game systems, thinks break down from simple once you have to start dealing with the changes from one game system to another.
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.
Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..
Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..
- jfrazierjr
- Deity
- Posts: 5176
- Joined: Tue Sep 11, 2007 7:31 pm
Re: Use Real Dice Rolls?
And if this was supposed to be more than a project test, in order to make the reader software fairly good, you would have to also handle testing with various fonts on dice and 6 sided dice with pips vs actual numbers.Full Bleed wrote:Btw, here is some source code for java based facial recognition software: http://www.advancedsourcecode.com/javaface.asp
After watching the linked youtube video, I think it would be pretty easy to try and use this for "dice" recognition. I don't know what recognition methods it's using (faces are, after all, different than dice)... but it would be a good place to start. Start with a D6 and take baseline top-down pictures of the dice to set the "Select the Image to be Recognized" images. Then take a bunch of random shots of D6 dice from above and with varying orientations and angles... and see how well the program handles the recognition.
If it works really well... you might have something to build on.
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.
Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..
Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..
-
- Kobold
- Posts: 9
- Joined: Sat Apr 22, 2017 7:16 pm
Re: Use Real Dice Rolls?
jfrazierjr wrote:pirklbauer31 wrote:That's why I asked if it was possible to combine using real dice with RPTools
If you build a java class which can "read" dice, in whatever way you decided to build such an application, then we can easily help you plug in the actual results for SIMPLE dice rolls. Regardless of how you actual "read" the dice rolls:
THEN once that's done, we can deal with how maptool is "notified" that there is dice rolled to deal with.
- bluetooth dice, which I would assume would be very expensive
- camera software that turns the dice into a number
- some form of magic I am unaware of
If for some reason, you don't want to do java, well, then thing get a bit more complicated, but not overely so. In this case, I would have MapTool configured with a webservice. This is where things get tricky since you really HAVE to decide ahead of time something. Will you tell MapTool someone is about to rolls some dice, then read the results from the external application, and plug into MapTool
OR
Will you roll the dice first manually and THEN tell Dicetool the result/go get the result.
Either way is acceptable.
- I guess the image recognition part would be the best approach for getting the dice values.
- Programming in Java is fine for me
- I thought of first manually rolling the dice, then getting the result
I'll probably focus on DnD since that's the game I play and know a bit about.
My Prof. also said, that a Proof of concept (The concept being: "Play DnD digitally, but still use real dice so you don't completely lose all physical aspect) as a result of
the project will be enough.
While searching for existing applications to play DnD i found Roll20 first(which turned out to not be the thing i was looking for) and RPTools.
Since RPTools seems to be OpenSource, I hoped to be able to use that for my project.
I hope what I wrote makes at least some kind of sense now.
Btw: Thanks for all the replies so far!
- JamzTheMan
- Great Wyrm
- Posts: 1872
- Joined: Mon May 10, 2010 12:59 pm
- Location: Chicagoland
- Contact:
Re: Use Real Dice Rolls?
Like jfrazierjr, there are several ways to tackle this. And unless you plan on writing the actual dice "recognition" code inside the MapTool project itself, it can come second. I would highly recommend the dice rolling to be a separate project and create an API in MapTool to access that "data".
It can start out as simple as your dice project logging it's results to a flat file and create a file watcher in MapTool to watch this file and pull in the results. Eventually moving to creating a macro command that "fetches" the results. Obviously you can't really initiate the dice process by rolling dice and pushing the results to MT as MT needs to know what these dice rolls are for. Unless you plan on creating a special "marker" to also be used. If it were me, and I was going to go the camera route, I may create some sort of custom flash card system with a QR code or something. The QR code would contain enough data to tell MapTool what you want to do with the dice rolls. Probably just a URI like maptool://macro?rollInit which calls the rollInit macro passing the dice results as arguments.
Creating your dice project outside of MapTool will give you more flexibility in choosing existing libraries to leverage. You wouldn't be locked into Java if you found, say, a better library to use written in C++.
So,
Step 1, flesh out the work flow (press MT macro, prompt user, roll dice? or roll dice, press MT macro? Roll dice & tell MT what to do? etc). Basically, how will the user tell MapTool how to use the dice he/she just rolled?
Step 2, Decide on technology (bluetooth, camera, some other sensor), start on a simple POC (proof of concept)
Step 3, Get your POC to display/log your results for a simple die
Step 4, Download MapTool from GitHub and get it to compile and run in your development environment
Step 5, Decide on API method or bake it into the MT project (if your POC is written in Java, you have options here)
Step 6, Flesh it out and profit!
So, unless the MapTool part is really the core of your project and the dice part is just black box, don't worry about it at this point. It can be solved several ways, none of them difficult. If you really want to nail down the MapTool part first, then you have to at least generate a program to simulate your dice results to send to MT.
It can start out as simple as your dice project logging it's results to a flat file and create a file watcher in MapTool to watch this file and pull in the results. Eventually moving to creating a macro command that "fetches" the results. Obviously you can't really initiate the dice process by rolling dice and pushing the results to MT as MT needs to know what these dice rolls are for. Unless you plan on creating a special "marker" to also be used. If it were me, and I was going to go the camera route, I may create some sort of custom flash card system with a QR code or something. The QR code would contain enough data to tell MapTool what you want to do with the dice rolls. Probably just a URI like maptool://macro?rollInit which calls the rollInit macro passing the dice results as arguments.
Creating your dice project outside of MapTool will give you more flexibility in choosing existing libraries to leverage. You wouldn't be locked into Java if you found, say, a better library to use written in C++.
So,
Step 1, flesh out the work flow (press MT macro, prompt user, roll dice? or roll dice, press MT macro? Roll dice & tell MT what to do? etc). Basically, how will the user tell MapTool how to use the dice he/she just rolled?
Step 2, Decide on technology (bluetooth, camera, some other sensor), start on a simple POC (proof of concept)
Step 3, Get your POC to display/log your results for a simple die
Step 4, Download MapTool from GitHub and get it to compile and run in your development environment
Step 5, Decide on API method or bake it into the MT project (if your POC is written in Java, you have options here)
Step 6, Flesh it out and profit!
So, unless the MapTool part is really the core of your project and the dice part is just black box, don't worry about it at this point. It can be solved several ways, none of them difficult. If you really want to nail down the MapTool part first, then you have to at least generate a program to simulate your dice results to send to MT.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork
-
- Kobold
- Posts: 9
- Joined: Sat Apr 22, 2017 7:16 pm
Re: Use Real Dice Rolls?
According to this, it might actually work!JamzTheMan wrote:Like jfrazierjr, there are several ways to tackle this. And unless you plan on writing the actual dice "recognition" code inside the MapTool project itself, it can come second. I would highly recommend the dice rolling to be a separate project and create an API in MapTool to access that "data".
It can start out as simple as your dice project logging it's results to a flat file and create a file watcher in MapTool to watch this file and pull in the results. Eventually moving to creating a macro command that "fetches" the results. Obviously you can't really initiate the dice process by rolling dice and pushing the results to MT as MT needs to know what these dice rolls are for. Unless you plan on creating a special "marker" to also be used. If it were me, and I was going to go the camera route, I may create some sort of custom flash card system with a QR code or something. The QR code would contain enough data to tell MapTool what you want to do with the dice rolls. Probably just a URI like maptool://macro?rollInit which calls the rollInit macro passing the dice results as arguments.
Creating your dice project outside of MapTool will give you more flexibility in choosing existing libraries to leverage. You wouldn't be locked into Java if you found, say, a better library to use written in C++.
So,
Step 1, flesh out the work flow (press MT macro, prompt user, roll dice? or roll dice, press MT macro? Roll dice & tell MT what to do? etc). Basically, how will the user tell MapTool how to use the dice he/she just rolled?
Step 2, Decide on technology (bluetooth, camera, some other sensor), start on a simple POC (proof of concept)
Step 3, Get your POC to display/log your results for a simple die
Step 4, Download MapTool from GitHub and get it to compile and run in your development environment
Step 5, Decide on API method or bake it into the MT project (if your POC is written in Java, you have options here)
Step 6, Flesh it out and profit!
So, unless the MapTool part is really the core of your project and the dice part is just black box, don't worry about it at this point. It can be solved several ways, none of them difficult. If you really want to nail down the MapTool part first, then you have to at least generate a program to simulate your dice results to send to MT.
Thank you for your input and help so far
- JamzTheMan
- Great Wyrm
- Posts: 1872
- Joined: Mon May 10, 2010 12:59 pm
- Location: Chicagoland
- Contact:
Re: Use Real Dice Rolls?
Anything is possible with Time & Money.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork
Re: Use Real Dice Rolls?
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
- Full Bleed
- Demigod
- Posts: 4736
- Joined: Sun Feb 25, 2007 11:53 am
- Location: FL
Re: Use Real Dice Rolls?
I just tried the facial recognition software I linked above... and it's a *fail* for dice when the orientation changes. Or, at least, using semi-translucent dice and color pictures as my test dice/pictures really fooled it by creating all kinds of random tones to match.wolph42 wrote:my $0.02: https://www.simplicity.be/article/recognizing-dices/
I believe that the isolation/threshold techniques in your article would need to be used to remove various shadows, reflections, and extraneous data. But, even so, it will be far more complicated to remove some extraneous data from poly dice as you won't just be looking at pips.
This project will really end up being a poly dice/image recognition project.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."
Re: Use Real Dice Rolls?
I can imagine, there are so many variables to keep track of and indeed, the fact that the numeral system is used. Also the dice can rotate which means that classic OCR is also difficult e.g. try to recognize 6 and 9 rotated. Still for someone who wants to put time and effort in it, it can be a fun project. You can also decide to limit the scope to one specific set of dice, e.g. only black and white polys! e.g. this set is pretty common and most easy to OCR.
I mean if MT would at any time support ODR (optical dice recognition) but the function would be limited to one set of dice, I wouldn't hesitate to buy that set.
more link, more focused on java:
https://sourceforge.net/projects/javaocr/
http://tess4j.sourceforge.net/
previous one: https://www.simplicity.be/article/recognizing-dices/
I mean if MT would at any time support ODR (optical dice recognition) but the function would be limited to one set of dice, I wouldn't hesitate to buy that set.
more link, more focused on java:
https://sourceforge.net/projects/javaocr/
http://tess4j.sourceforge.net/
previous one: https://www.simplicity.be/article/recognizing-dices/
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Use Real Dice Rolls?
I think a way you could cope with the d4 would be to roll onto glass with the camera underneath.
Obviously you would need to read the results and convert them to appropriate value. Fortunately for us, dice tend to have fixed opposites.
Obviously you would need to read the results and convert them to appropriate value. Fortunately for us, dice tend to have fixed opposites.
Re: Use Real Dice Rolls?
Every d4 I've ever seen has three numbers on each face.Jagged wrote:I think a way you could cope with the d4 would be to roll onto glass with the camera underneath.
Re: Use Real Dice Rolls?
I guess technically it can be done. It would just be the number you don't see on the side facing down.taustinoc wrote:Every d4 I've ever seen has three numbers on each face.Jagged wrote:I think a way you could cope with the d4 would be to roll onto glass with the camera underneath.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Use Real Dice Rolls?
I'd also recommend going with a gaming system that uses all d6 to limit the scope.