Author Topic: Steve's Ole Dice Roller  (Read 9645 times)

0 Members and 1 Guest are viewing this topic.

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Steve's Ole Dice Roller
« on: January 16, 2019, 12:57:08 am »
Having a little free time once again, (by avoiding my writing commitment like a lazy bum), I decided to play around and create a little dice rolling routine for fun, and this is what I've got so far.  ;)

At this point, it doesn't actually do *anything* much, except highlight the selection process I'm going to be using for user interactions.   I wanted something a little different than the standard keyboard entry routines, so I came up with this little process for user input.   Test it out if you guys get a chance and tell me if it seems intuitive enough for ease of selection/use.  If there's any issues, I'd like to address them ASAP, before things get more complicated once I start adding modifiers into the process.  ;)

NOTE: You'll probably need one of the latest development builds for this to work properly as it relies upon the fixes to the precompiler and the _TRIM$ keyword.

* SODR v0.5.7z (Filesize: 71.35 KB, Downloads: 226)
« Last Edit: January 24, 2019, 08:58:45 pm by SMcNeill »
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Steve's Ole Dice Roller (work in progress)
« Reply #1 on: January 16, 2019, 02:19:16 am »
That's quite a collection of colours. May I ask where you got the info? I hope you did a cut-n-paste otherwise that's a set of sore fingers right there...

Hmm... issues...

Although I am a big fan of 'Old English' text, I do not happen to have it installed, but after a short search the font was found.

The 'sets', 'number', and 'sides' worked just fine. My screen capture looks a bit weird but I'm going to guess it was probably the font I used. But attached it anyway so you can see that it works...

 
Screenshot from 2019-01-16 18-06-43.png


J
ps: I'm also using qb64-dev
Logic is the beginning of wisdom.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Steve's Ole Dice Roller (work in progress)
« Reply #2 on: January 16, 2019, 05:04:31 am »
Test it out if you guys get a chance and tell me if it seems intuitive enough for ease of selection/use.

Yep.  That's intuitive all right.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Steve's Ole Dice Roller (work in progress)
« Reply #3 on: January 16, 2019, 10:58:46 am »
I left my Old English fonts on my Windows King George III computer. Sorry.

Pete :(
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Steve's Ole Dice Roller (work in progress)
« Reply #4 on: January 16, 2019, 11:07:54 am »
So apparently I’ll need to package (or embed) the fonts with the final version...  And here I was thinking OldEnglish fonts were standard with most systems.  O_o!

At least that’s one issue found, before I get any further.  Thanks for the feedback, guys. 
« Last Edit: January 16, 2019, 11:09:06 am by SMcNeill »
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Steve's Ole Dice Roller (work in progress)
« Reply #5 on: January 16, 2019, 12:58:59 pm »
Added a screenshot of how the screen should actually look for folks, once the proper fonts and all have been found and loaded with the program.  I'll package everything needed up into a nice zip/7z archive as progress on the project progresses. but for now a screenshot is all the updated progress you get while I add in a few bells and whistles.  :)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Steve's Ole Dice Roller (work in progress)
« Reply #6 on: January 16, 2019, 01:37:11 pm »
I went back to QBF to look up some old dice routines. I found this neat 3400+ line QBasic Yahtzee contribution by Myst It's a pain to copy but once you have it on the clipboard, it pastes and runs perfectly in QB64. I couldn't find the custom made 3-D dice roll simulation TheBob made. I'll have to ask him if he remembers where he posted them. Bob made some kind of comment about one of my dice routines; something about my results would only be valid if I was rolling dice on Mars. I told him I could try rolling the same dice on Uranus, but it would probably just keep coming out craps. I'll be sure to forego that story when I ask him where he's hiding his dice.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Steve's Ole Dice Roller (work in progress)
« Reply #7 on: January 16, 2019, 02:00:51 pm »
What I’m shooting for is (once again) an over-engineered RPG dice roller which can handle anything we want from it....

Options will include:

Rolling sets of multiple dice of various sides.  3 sets of 2d10 would result in 3 numbers generated by rolling two different 10-sided dice.  (Not 3 sets of INT(RND *19) + 2 to generate values of 2 to 20, but 3 sets of 2 rolls of INT(RND * 10) + 1...  The two may generate the same values, but at a distinctly different probability curve.)

Modifiers per dice:  +1 per dice, for example, so 2D6+1 will generate 2 numbers from 2 to 7, add them together for a total of 4 to 14.

Modifiers per set:  (3S2D6)+1 would be 3 sets of 2D6, with 1 added to each set.  Rolls might be:
(1,3) + 1 = 5
(2,3) + 1 = 6
(4,5) + 1 = 10

Modifiers to total roll:  3S2D6T+1...  much like above, 3 sets of 2D6, with 1 added to the total sum:
(1,3) = 4
(2,3) = 5
(4,5) = 9
—————-
+1    = 19

Ability to keep/discard dice:    4D6K3h — roll 4 6-sided dice, keep the three highest:
(1, 2, 5, 5) = 12

Ability to reroll edge cases:  2D6R1R6 — roll 2 6-sided dice, reroll 1’s, reroll 6,s:
(1, 2, 4) = 6   <— in this case, the one got rerolled.

Ability to use “open dice”:  2D6O6 — roll 2 6-sided dice, open roll 6’s:
(3, 6, 4) = 13 <— a 6 was rolled, roll another dice (which was the 4)

And most of these “dice rules” will apply to sets as well, so we can:
Roll 10 sets of 2D10, and drop the lowest set, for 9 numbers from 2-20...

And so on, with every customizable option I can imagine from all my years playing various pen-and-paper  RPGs.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Steve's Ole Dice Roller (work in progress)
« Reply #8 on: January 16, 2019, 02:17:19 pm »
RPGs, I gave that stuff up years ago, but I I recall that they usually require die with more sides than the standard 6-sides used in casino games. I threw one of those once on a craps table in Vegas and the casino boss threatened to have me removed. I told him he couldn't throw me out, because I was a level 5 elf master; so instead, he shoved me in a hollow tree and had me bake cookies for the entire crew. Not the kind of chips I was hoping to come away with.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Steve's Ole Dice Roller (work in progress)
« Reply #9 on: January 16, 2019, 09:52:59 pm »
Ah, Bob just reposted it here: https://www.tapatalk.com/groups/qbasic/bob-do-you-remember-that-3-d-dice-roll-simulation--t39421.html#p212448

It's very compact code that creates a 3-D look to the dice, but not true 3-D, spinning on an axis, etc. Still, for a dice game, they are perfect to add the visual effects to give the game a nice polished appearance.

For RPG dice, it would be more of a design challenge, for sure.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Steve's Ole Dice Roller (work in progress)
« Reply #10 on: January 16, 2019, 10:47:11 pm »
v0.5 is available for testing/breaking...

Packaged it all up together in a 7z file which I attached to the bottom of the first post, and it's beginning to take on the pretty little look of a decent project.

I think the selection process is more or less finished, with the exception of a few pop-ups so the user can choose modifiers as I was speaking about earlier to apply to their dice rolls, but those should be a breeze to implement now that I've gotten everything else up to this point in the process...   And all that'll be left after that is to actually just roll the dice and obey the ruleset the user creates.  :)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Steve's Ole Dice Roller (work in progress)
« Reply #11 on: January 16, 2019, 11:15:56 pm »
So right now it has a hover feature to pick the elements to test. Anything else besides making those input selections?

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Steve's Ole Dice Roller (work in progress)
« Reply #12 on: January 16, 2019, 11:35:37 pm »
So right now it has a hover feature to pick the elements to test. Anything else besides making those input selections?

Pete

It should now have 3 extra areas with 19 selectable/clickable lines. 

The next stage is to display a pop-up when the user clicks on one of those lines, with the available options you can set for each area, such as:

Click the DICE list from 1 to 19, generate a pop up for:
Keep ### of Highest Rolls
Keep ### of Lowest Rolls
Discard ### of Highest Rolls
Discard ### of Lowest Rolls
Add ### to each Roll
Subtract ### from each Roll
Reroll any ###’s
Open roll with ###’s
(Other options as I think of them)

Then you create the rule you wish and it fills the spot you chose...

After that it’s just rolling and obeying the set rules.  The framework is all laid out and the hard part is done (which is why I’d call it v0.5 as it’s about half finished).  Now it’s just a case of taking advantage of the routines available and tying it all together to finish.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Steve's Ole Dice Roller (work in progress)
« Reply #13 on: January 17, 2019, 09:20:07 am »
A few questions -

Are the source files within the ZIP being updated? (I'm getting the same behavior now that I was getting last time I checked and the download count didn't seem to reset.)

Is Linkedlist.bas supposed to compile? (I'm not running the dev version.)

Have you considered separating the mechanism from the interface, so that the roller calculations may be attached elsewhere? Every special font or graphic will significantly shave down the number of compatible systems out in the future. You probably want a screen-0 brain back there, no?

How tightly thought-out is the math behind re-rolling? You had my interest at "probability curve". And also the mechanics of re-rolling... if we want to roll a six-sided dice and promptly throw away all "2" results it lands on, may I think of this as a 5-sided dice that is missing the 2?

You're not done when it works, you're done when it's right.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Steve's Ole Dice Roller (work in progress)
« Reply #14 on: January 17, 2019, 09:46:14 am »
A few questions -

Are the source files within the ZIP being updated? (I'm getting the same behavior now that I was getting last time I checked and the download count didn't seem to reset.)

Is Linkedlist.bas supposed to compile? (I'm not running the dev version.)

Have you considered separating the mechanism from the interface, so that the roller calculations may be attached elsewhere? Every special font or graphic will significantly shave down the number of compatible systems out in the future. You probably want a screen-0 brain back there, no?

How tightly thought-out is the math behind re-rolling? You had my interest at "probability curve". And also the mechanics of re-rolling... if we want to roll a six-sided dice and promptly throw away all "2" results it lands on, may I think of this as a 5-sided dice that is missing the 2?

Only one zip uploaded so far, so if you downloaded it once, I haven't updated it since then.  ;)

When I get to the dice rolling routine, the core mechanic behind it is going to be a formula based processing routine, much like I described to Pete previously.  Send it a formula, it'll send you a plain text array of results which you can work with.

So send it "2D6", it'll send you an array of:
"(1,3) = 4"

Send it "3S4D6+1K3H", it'll obey the ruleset you told it -- roll 3 sets of 2D6, add 1 to each dice, and keep the 3 highest, for a return of:
"(2, 3, 7, 4) = 14"
"(3, 3, 3, 5) = 11"
"(2, 5, 6, 7) = 18"

The idea is to have the main interface just be a pretty little UI which keeps things simple for people to use and interact with, but the core rolling routine is going to be able to process a custom format dice rolling formula. 

For an idea of how the core will work, take a moment to look at my old dice rolling routine, which I reshared here: https://www.qb64.org/forum/index.php?topic=981.0  It's been around since November of 2013, so it just seems like it's time to give it an updated UI and expandable features, thus the birth of this little project.  ;)
« Last Edit: January 17, 2019, 10:05:44 am by SMcNeill »
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!