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

The players luck affects the outcome of a blackjack game. #3

Open
TheWhiteCollarPlayers opened this issue May 24, 2017 · 10 comments
Open
Assignees
Labels
blackjack These topics are related to the Blackjack minigame. disussion enhancement

Comments

@TheWhiteCollarPlayers
Copy link
Collaborator

I have been discussing with Shadow from the Cascadia team about general ways to implement a Luck based effect on the "randomness" of dealing cards to the player. I.E. at higher luck levels you will get dealt better cards. I will copy over his suggestions, I am thinking that certain degrees of combinations of his suggestions might work best in order to achieve a more RPG feel to gambling.

@TheWhiteCollarPlayers
Copy link
Collaborator Author

From shadow:
1-2 is considered "low int" in NV with the stupid dialogue options, so 1-2 is bad luck, as an assumption
so make their first card random
but then figure out how far they are from busting/blackjack
and deal their second card in a set of ranges based on luck
higher luck gets lower cards/higher chance of hitting 21
low/bad luck gets higher cards/higher chance of busting.

You may also not want to do that on every turn
So some hands for the player are truly random(edited)
but you could work in that system that works off of luck instead too, and throw that one to the player
If Player.GetValue(Luck) <= Utility.RandomInt(1, 50)
; luck based hand

Else
; random hand

EndIf

1 in 5 chance with maxed luck, 1 in 50 chance with min luck
Of couse RandomInt(1,50) could be tweaked too
range could be 1-100 for 10% chance with 10 luck
or lower for higher chances
You could even calculate the max range for randomint off of luck

@Scrivener07
Copy link
Owner

I agree we should factor in the players luck attribute to the odds of winning a game. The technical details are a little off base though. The card that gets drawn from a deck is much more than simply a random number or an index in a list so just returning a random number wont do the trick.

Lets recap the goal here. We want to increase the players chance of winning a game when their luck is high and decrease the chance of winning when their luck is low. To achieve this we should do it exactly the same way it would be done in real life. In real life you would decrease the odds of winning in favor of the house by stacking the deck with multiple decks of cards. Since the Deck class models real life as closely as I could we can add more card entries to the decks internal card array which will decrease the chances of the player winning a game.

Here is a chart of the odds based on the amount of decks used in a game of black jack.

Number of Decks House Advantage
Single Deck 0.17%
Double Deck 0.46%
Four Decks 0.60%
Six Decks 0.64%
Eight Decks 0.65%

With that, we increase the amount of decks used the lower a players luck attribute is. When a game uses a single deck of 52 cards the player should have a luck of 10.

So I propose a formula like this.
(10 - LUCK) + 1 = DecksUsed

Luck Decks
1 10
2 9
3 8
4 7
5 6
6 5
7 4
8 3
9 2
10 1

@TheWhiteCollarPlayers
Copy link
Collaborator Author

That's genius! And very realistic as well, I love it! But...how smoothly can you implement that? Of course, a simple way would be to run a set of comparisons against the player's Luck stat even before the cards are "shuffled" then add decks based on the stat.

@Scrivener07
Copy link
Owner

Very smoothly if I may toot my own horn. Off the top of my head I can expose like a int Depth property on the Deck class. Then when NewCards is called it can add 52 card deck x times. That could potentially be up to 520 entries in the internal array so I will need to find a workaround for the 128 element array limit. Since this is a predictable maximum using multiple internal arrays may be a good option.

Deck Class

@TheWhiteCollarPlayers
Copy link
Collaborator Author

Wasn't aware of that limit, ugh if this were C I'd say use a pointer in the last element of the array to point to the next array...but alas. In that case, multiple internal arrays would work (pretty sure I know what means).

@Scrivener07 Scrivener07 removed their assignment Jun 10, 2017
@Scrivener07 Scrivener07 added this to the Fully Featured milestone Jun 10, 2017
@Scrivener07 Scrivener07 changed the title Luck based effects on card dealing. The players luck affects the outcome of a game. Jun 10, 2017
@Scrivener07 Scrivener07 changed the title The players luck affects the outcome of a game. The players luck affects the outcome of a blackjack game. Jun 10, 2017
@Scrivener07 Scrivener07 added the blackjack These topics are related to the Blackjack minigame. label Jun 10, 2017
@Scrivener07 Scrivener07 removed this from the Fully Featured milestone Jun 30, 2017
@TheWhiteCollarPlayers
Copy link
Collaborator Author

I do intend to do this, however this might be best saved for when we want to revisit the blackjack code for optimization and improvements. The source code for other games will incorporate the luck stat in some way

@Scrivener07
Copy link
Owner

During our private discussion we talked about making this simple. For each point of luck, grant a bonus to the amount of caps a game will payout.

@TheWhiteCollarPlayers
Copy link
Collaborator Author

Leaving this open, one of those things we can do quickly, a simple check for the multiplier on the payout should suffice for blackjack

@Scrivener07
Copy link
Owner

Scrivener07 commented Feb 28, 2018

The user ForsakenShell had some thoughts to add to the conversation that I found interesting.

I suggest using a logarithmic scale so as your luck gets higher it effects game outcomes less and less.

Example: Log( 10 ) ^Luck
When it hits 7-8 luck it starts really slowing down, after 10 it crawls.

Produces a range of 0-10 for luck 1-10 where 1 = 0, 5 = 0.7; 7 = 0.85, 10 = 1.
Going beyond 10 to 20 only yields 1.3.

Additional Testing

Example: 5 * Log( 10 ) ^ Luck
Think of the last provided equation as "% chance the player will get a favourable card"
At 10 luck it yields 5%.
At 20 luck is only ~6.5%.
At 1 luck it is 0%.

Thanks for adding to the conversation E.

@Scrivener07
Copy link
Owner

User Feedback
capture1

User Feedback
capture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blackjack These topics are related to the Blackjack minigame. disussion enhancement
Projects
None yet
Development

No branches or pull requests

2 participants