Cookie Clicker

Cookie Clicker

Casino
Extensions to the Casino Minigame
As I mentioned in my post of January 23rd on the main page, I really like this mod and have been playing it a lot. However, I thought it could be made even better, and I listed some of the enhancements that I wanted to see. I later saw that mattklose was no longer working on the Casino, so I implemented these enhancements myself, along with a number of others. (I ended up not implementing insurance, as it is almost always a bad deal, except occasionally for the most skillful of card counters.) I have finished everything I wanted to add now and I have tested it thoroughly; I know of no bugs. In this thread I will describe what I have done, and I am offering the results to mattklose, hoping that he will incorporate them into the Casino game.

Here is a list of the enhancements I have made:
  1. In addition to the two times and five times multiples, I added a twenty times multiple so that there isn't such a huge gap between time units. Twenty is close to the geometric mean of five and sixty, so this works out well in practice.
  2. Currently, the highest units that the player can select are hours. As the game progresses and the player typically generates large amounts of cookies through combos, even the maximum bet of 20 hours of cookie production may not be enough to make a noticeable change in the player's bank - i.e., it can be many orders of magnitude lower than the bank total. For this reason, I added days, months, and even decades as additional time units, with each of these requiring its own separate achievement. Decades may seem excessive, but I have found that it is not; my current bank is 31.534 unvigintillion cookies, and a bet of five decades of cookie production is only about 1% of this. For some advanced players, millennia (the next reasonable time unit) may even make sense, but I have added other options that I think make more sense and are described below.
  3. I found when playing the game, I would typically be playing with a bet that was suitable for a situation with no buffs. However, I have autoclicking on, so sometimes I wouldn't notice when a buff started. If it was a major buff, I could wipe out most of my bank in one or two bets. For this reason, I fixed the game to limit bets to no more than 10% of the current bank.
  4. Even with the previous fix, It seemed like a real hassle to have to adjust the bet amount every time the number and strength of active buffs changed. (This also applied to the number of wrinklers present, as well as the number and amount of negative buffs.) Therefore, I changed the betting amount so that it was no longer based on the current CpS, but instead was based on the highest raw CpS for the current session. This latter number is far more stable than the former, although they're often the same or nearly so, and this change made it possible to play at the casino with the amount of your bet staying fairly constant as long as you didn't manually change it.
  5. In real blackjack play, it is often recommended that players bet a fixed proportion of their bank, typically ranging anywhere from 0.1% to 1%. This seemed to me to be a much simpler approach than one based directly on CpS, and so I implemented it as an option, and it is turned on by default. It can be changed at any time by going to the options menu and clicking on the new Bank Percentage button, which can be either ON or OFF. When it is on, three percentage levels of the current bank are available: 0.1%, 0.2%, and 0.5%. Experience showed that anything higher than 0.5% would quickly lead to exponential growth of banked cookies that would overwhelm all other game factors. Even a level of 0.5% will do this for heavy blackjack players, although much more slowly. I recommend a level of 0.1% for those who don't want this minigame to have a disproportionate effect on their overall game.
  6. I implemented doubling down after splits, which requires its own achievement to activate.
  7. I added the option of surrendering, which has its own button on the sidebar (right above the Stand button) and is activated when appropriate. A player can surrender right after the first two cards are dealt, or directly after a split, and only then. Surrendering is typically done when the odds of winning a hand look quite poor. Surrendering results in the player losing half of the bet, and having the other half returned. Surrendering requires its own achievement.
  8. If the player reaches 21 with three or more cards, the game no longer waits for the player to hit the Stand button, but instead recognizes that the player's hand is finished, and proceeds accordingly.
  9. In standard blackjack, a tie results in neither the player nor the dealer winning, and the current bet is returned to the player. As this was not an option in the current game, and I felt that the game should have all options present in standard blackjack, I added it. It requires its own achievement, which is about half of that required for "Ties push to the player," which still exists as before.
  10. The achievement "I make my own luck" in combination with the "Infinite Improbability Drive" achievement seemed to make the game far too easy to win, especially in later stages of the game where the number of Chancemaker buildings would start to get rather high. It got to the point where a very large percentage of the hands I played were changed by these two features into instant wins, which significantly detracted from the challenge of the game. I therefore reduced the chance of instantly winning due to "I make my own luck" from 0.03% per Chancemaker building to 0.02%, which helped a lot. This automatically reduced the probability of winning via the "Infinite Improbability Drive" by one third as well. There are enough other ways to easily win in this game that I don't think that this change will present any sort of problem.

I hope that mattklose sees this discussion and responds to it; if I don't hear from him soon, I will try more direct means to contact him.

I had to come up with quite a few names and descriptions for the various new achievements, so I did my best, but the result is not particularly imaginative. These names and descriptions can easily be changed to something else if so desired. Similarly, I did my best to make the cost of the new achievements fit in with the existing cost structure of the minigame, but these can easily be adjusted as well if necessary.

The one puzzling artifact in this game is that it takes the new Bank Percentage option button a couple of seconds to fully turn on (but not turn off), and I have no idea why. I figured that since mattklose is also the author of CCSE, he might have more insight into this matter.

In closing, I'd like to offer deep thanks to mattklose for creating the original Casino minigame. I really enjoyed making all of these enhancements to it, and I look forward to making this new version of the Casino available to everyone.
Legutóbb szerkesztette: z; 2023. máj. 5., 18:58
< >
115/25 megjegyzés mutatása
mattklose  [Fejlesztő] 2023. máj. 6., 12:06 
First off, let me say how flattering it is that someone likes the mod enough to want to see it improved, and go to so much effort to do so. One of the reasons I made these mods was to inspire others to take an interest in modding Cookie Clicker as well. I'm glad to see that has happened.

With regards to the option button, it sounds to me like you may be updating the value in the configuration, but not updating the button html object itself. Then, when the Options menu refreshes (every couple of seconds), the button updates as well. That's my guess from the description of the symptoms.

On a more negative topic, there is a reason I haven't updated this mod in a while (beyond general laziness). Orteil has mentioned that he has plans for a minigame for every building, which naturally includes the Chancemaker. This means that, at some point in the future, the Casino mod will become obsolete, which is kind of a downer. It makes it hard to care enough to make the mod more than "good enough".

With that said, however, it sounds like you've already done quite a bit of work. It would be a shame to waste that effort, and you picked a very good time. With the coming update of Cookie Clicker, I'm going to have to do at least a little bit to make sure the Casino works with the new version. If you send me what you have, I can find the spoons to incorporate it into the mod.
Legutóbb szerkesztette: mattklose; 2023. máj. 6., 20:14
I'd be happy to send you a copy of my updated version. What's the best way to do that?
mattklose  [Fejlesztő] 2023. máj. 6., 20:21 
I think the "right" way to do it is to make a pull request in GitHub here[github.com]. If you're on GitHub, that's the way to go.

If not, Pastebin could work, or message me on Reddit (u/klattmose)
It's been way too many years since I've used Github, though it looks like it's time to refresh my knowledge there. For now, I've created a pastebin[pastebin.com] of the new version. This way, other people can easily try it out as well, and they can also see if there are any problems with Cookie Clicker 2.051.

As for the Casino becoming obsolete, there are several ways to ensure that this doesn't happen, at least one of which I'm sure would be fine with Orteil. I'll detail these in a little while.
Legutóbb szerkesztette: z; 2023. máj. 7., 5:31
mattklose  [Fejlesztő] 2023. máj. 8., 14:02 
Casino v4.0 is live! I made some alterations to help everything meld together with both the original Casino and the base game. Primarily, I fixed the toggle button in the Options menu (it was checking Casino.bankPercentage, rather than M.bankPercentage), and I made it so that all upgrades were created on initialization, which is necessary with how Cookie Clicker deals with them. The order they're created matters, too, but I messed that up myself and decided it wasn't a huge deal.
Thanks, mattklose, for incorporating my changes into the Casino! I was very happy to see that you managed to include all of them.

Now that you've pointed it out, that error with Casino.bankPercentage is embarrassingly obvious. Also, I didn't know that upgrades needed to be created on initialization, but that certainly explains the problems I was having getting the two modes of the game to work together. Your solution is much cleaner than what I had in place to get around this.

Meanwhile, I've played a few thousand more hands of blackjack with the new options, and I'm happy to report that I've found no implementation bugs. But there is one problem area I'd like to address.

Currently, the Casino disables Steam achievements. I think that with a little bit of tweaking, that would not be necessary, and it would also add just a bit more challenge to the Casino. As far as Steam achievements go, in the Readme in the mods folder (just above the workshop folder), Orteil says that Steam achievements should be turned on "if this is a good honest mod that does not incredibly unbalance the game". In other words, it's fine if players can earn extra cookies through a mod, as long as what they earn is not excessive.

This is what I tried to do with my introduction of the bandPercentage variable. Originally, I had set the possible values of this variable to be 0.1%, 0.2%, and 0.5%. You added the top value of 2%, making these values congruent with the time values used when the bank percentage option was not set. Originally, I thought that this was going to be too high, but the one third reduction in the frequency of instant wins turns out to offset this nicely, and the resulting game seems very balanced. I am someone with an essentially perfect knowledge of Basic Strategy in blackjack but with no card counting skills, and I found that the game now provides just the right level of challenge.

For a while.

The problem is that even with a betting level that is only 2% of the bank, you still get exponential growth - it just takes a while to kick in. But kick in it does, and eventually the income I was generating from blackjack dwarfed all my other sources of income from the game. I could get 17 duovigintillion cookies just by winning a single hand of blackjack. This certainly would not do if we wanted to make the Casino eligible for Steam achievements.

Even worse, cookies that are won in blackjack count directly toward Prestige levels. In my current game, I have about 100 quintillion Prestige levels that are a direct result of blackjack winnings.

Lowering the 2% limit would not eliminate the problem - it would merely delay it. So I figured out a solution that would work not only with the bank percentage option, but would also prevent excess gains with the original time-related options.

I'll start with the latter. Before enabling the minutes, hours, days, and other time options, I would also make it a requirement that 20 units of these options (since 20 is the highest selectable number) would not exceed 2% of the current bank. This would prevent these options from blowing up. Realistically, this limit would be unlikely to come into play except for the higher time units.

As for the bank percentage rate of 2%, I would simply add the restriction that this rate would not be allowed to exceed 20 decades of raw cookie production, which is the highest rate selectable for a bet using the time options instead of bank percentage. As blackjack winnings don't affect the rate of raw cookie production, this would eliminate the exponential problem that would otherwise be caused by the bank percentage option.

If this sounds good to you, please let me know, and I'll make the changes to my copy of the Casino and try them out. If they work as expected, I'll then pass the modified version to you.

One final note - you mentioned in your last post the order in which the upgrades are created. I actually think that this works fine; I adjusted it a bit when I added my upgrades, so it now seems a little smoother to me than before.
mattklose  [Fejlesztő] 2023. jún. 17., 8:10 
Sounds good, go for it.
I have implemented the betting limits exactly as I described them above, and the result can be found in my pastebin[pastebin.com]. By varying my bank size, I was able to test out both the percentage and time-related betting limits.

I thought that it would be nice for the player to see when they have hit the betting limit. Although this can be ascertained by looking at the number of cookies per bet on the third line of the sidebar and then making a calculation or two, I thought that something a little more obvious would be appreciated. So I made the betting percentage (or time units, when those are selected) vary whenever the betting limit is reached so that they would remain accurate. For example, if the player is using the bank percentage limit of 2% and they hit the betting limit on that, which is the highest amount available under the time-related system, or 20 decades (yes, 200 real years of raw cookie production), the number of cookies to bet would not go higher than that 20 decade limit. However, this is now reflected in the betting percentage, which would start to drop as the player's bank grew, going from 2% to 1.9%, 1.8%, etc. If the player spends down their bank, this percentage will rise accordingly, once again with a ceiling of 2%.

The figures for the time-related values behave similarly. This method makes sure that all values are correctly displayed, not just the highest ones.

Since right now these limits aren't documented anywhere other than here (and these days, how many people RTFM anyway?), when betting limits are active reducing the player's maximum bet, the line "(Maximum bet limit reached)" is inserted after the third line in the sidebar, right after the description of the number of cookies bet.

I have numbered this version 4.1 in the main.js source file; it needs to be fixed in the info.txt file as well. After playing about a thousand hands of blackjack with these betting limits in place, I feel that the game is very balanced, and I think that it would be quite appropriate to enable Steam achievements for it.
mattklose  [Fejlesztő] 2023. jún. 22., 18:31 
I made a couple of tweaks. In buildSidebar, instead of just changing the displayed betChoice I put the capped betChoice in parentheses, so the user could see the mode they chose (and what they'll get in parentheses). I also changed Game.Upgrades['Standard push'].buy(); to Game.Upgrades['Standard push'].earn();. That seemed like it was there to make sure the player had the previous version, so I used .earn so they weren't charged for it.

The updated code is at https://github.com/klattmose/klattmose.github.io/tree/master/CookieClicker/SteamMods/Casino if you want to give it a final look-over before I update it on the Workshop.
Thanks for letting me check the latest version out before posting it.

A brief background: I worked several decades as a professional software engineer, and one of my specialties was user interfaces. Early on, I learned the importance of being able to place myself in the mind of the average user - someone who had far less knowledge of the software than I did. I could then design the UI so that it was easy for them to use, and if done properly, it would be just as easy for more experienced users.

One of the elements I found key to a good UI is simplicity, and specifically simplicity that made it obvious what the UI was saying, and how to use it. I really like the overall design of the Casino as I think it follows these guidelines very well. However, I think that the latest addition oversteps these bounds, and as a result would make the game harder to use for many people.

I see two problems with the new display. First, it's a bit cluttered. Instead of a single number with an unambiguous meaning, there are now two numbers, with no clear indication of what they are, or how they relate to each other. (Yes, it should be obvious to anyone who understands what's going on as to what these numbers are. But a lot of users understand a lot less than we might think. For example, look at the comments at the beginning asking how to get to the Casino.)

The format of the two numbers may be obvious to many of us, but not so much to others; it's somewhat ambiguous. Maybe the format "2 (1.6)" means we're supposed to multiply 1.6 by 2? Maybe that's what the extra line about the maximum bet limit being reached means? To us, that's obviously not the case, but from experience, I know that some people will be asking these very questions.

This could be improved by moving the '2' out of the box, removing the parentheses from the actual percentage, and adding a line that says something like "Base percentage: 2" right after the maximum bet limit line. (A similar approach would be used for the time-related bets.) I think that this would definitely be an improvement. Things would start to get a little cluttered in the sidebar, but if the two optional lines about the bet limit were separated from the other text by a blank line before and after them, I think this would end up looking fine.

As for changing the Game.Upgrades['Standard push'].buy() to ....earn(), that makes perfect sense, of course. I just didn't know about the earn() method.
mattklose  [Fejlesztő] 2023. jún. 26., 4:21 
The problem I saw was clicking through the modes and getting confused when it went from 1 -> 2 -> 3.4 -> 3.4 -> 1 instead of the expected 1 -> 2 -> 5 -> 20 -> 1. My second choice would be just showing the expected mode, and letting the (Maximum bet reached) line lower down explain why the bet isn't increasing that much.
Although I still prefer the method I specified, with the possible modification I mentioned in my previous post, if this is confusing to the creator of the mod, that is definitely not good. In light of that, I would think that your proposal would be a good compromise. In that case, I would suggest that the .true number be boldfaced so that it is easily seen.

Could you please post a screenshot of your proposal so we can see how it looks? Thanks!
Legutóbb szerkesztette: z; 2023. jún. 26., 12:24
mattklose  [Fejlesztő] 2023. jún. 26., 18:55 
Couldn't figure out a way to post the image here directly, so an Imgur link will have to do.

image[imgur.com]
It's true; Steam has apparently intentionally disabled different parts of BBCode in its different posting formats, and only in the Steam Guides is it possible to include arbitrary images in arbitrary places. So it seems that we'll just have to make do with image links here.

I've played around a lot with the sidebar display, and as I do, it becomes clear to me that there is a real advantage in displaying both the actual bet amount and the target bet amount when these two differ. As I mentioned, the problem I had with your initial method of doing this was that the two numbers were placed together in the same field that was designed for a single number, and it wasn't clear what the two numbers were. I've redone the display a bit here, and I've come up with something that displays the two numbers only when they're different, but in such a way that both numbers stand out in a way that I think is clear and unambiguous. I've played a lot of blackjack with this system, and I like it a lot. I hope you do too.

I recommend opening the image links, preferably in another window, before reading the descriptions below them. I also have a pastebin[pastebin.com] of the mod with the final display, which also contains a number of other additions that I will detail later.

I'll start out with the simplest case, which is just the standard display where the betting limit has not been reached:

Standard display[imgur.com]

One thing I do when I'm testing a feature (which didn't start out as an intentional method) is that I try it out when I'm half asleep (such as now). I find that this is an excellent way to see which parts of the UI aren't obvious, and where the UI can be improved.

You can see that I've made a few minor changes to the display here that I think help make it more informative and readable. First, when looking at it through the mists of brain fog, I saw the header "Cash" in a new light (or lack thereof). "Cash" is a very general term, and it doesn't even really describe the following content, which is the current bet amount in cookies. So I replaced "Cash" with "Bet Amount", which seems far more descriptive.

I then increased the font size by one for both the "Bet Amount" and "Actions" headers, which helped make the two main divisions of the sidebar a bit clearer. I also added an extra blank line in front of "Actions" in furtherance of this goal. The result was something that penetrated my clouded brain a lot easier, and helps make clearer at a glance how the sidebar is organized for those who are unfamiliar with it. I found this especially helpful when adding the features I describe below.

Here's the first overflow image, which shows what happens when the time selection exceeds 2% of the current bank:

Time overflow[imgur.com]

I kept the actual bet amount in the box at the top after the word "Bet:", as it is the amount that is actually going to be bet. But I also added two lines - both the "(Maximum bet limit reached)" from before, plus a line showing the base bet limit that the player had selected, which is the number that you are most interested in. Although this number does not come first, unlike the first number, it is boldfaced. I think that this results in one's attention being drawn equally to the two numbers, with their accompanying descriptions making it absolutely clear which is which.

If you like, we could change "Base time" to "Selected time". However, I do notice that things start to get a little squished with this change, and it's just a tinier bit harder to read this quickly. That may just be my brain fog, though, so I could go either way.

The two lines referring to reaching the bet amount are separated from the rest of the "Bet Amount" display by an extra blank line before and after; this makes sense because these two lines are related, and when they appear, they always appear together.

Fortunately, there is guaranteed to be enough room in the sidebar for all of this, as the size of the table dictates the height of the sidebar.

When the player updates the betting amount by clicking on the boxed number in the first line, the boldfaced time following the "Base time" entry below is updated immediately. If the player cycles through to the beginning ("1"), then the two bet limit lines will disappear if the player's bet now no longer exceeds the limit. The lines will return at the appropriate time if the player continues clicking.

Finally, here's a picture including the bet limit lines when the bank percentage option is selected:

Percentage overflow[imgur.com]

It works completely analogously to the time overflow option.

There are a number of changes I've made in other areas, but I'll stop here for now so that this post doesn't get any bigger, and I'll detail the others in a little while.
Legutóbb szerkesztette: z; 2023. jún. 30., 8:49
I realized that with just a minor caption change, it was fairly easy to switch the numbers for the selected bet with those of the actual bet when the bet limit has been exceeded. Here's what it looks like for the same two cases as above:

Time overflow[i.imgur.com]

Percentage overflow[i.imgur.com]

How do you think this looks, especially compared to the examples in the previous post? (The standard, non-overflow display would be exactly the same, of course.)

Also, I have found that my other modifications have resulted in the Casino's earnings tracking those of the game at large very well, neither being so big as to overwhelm the game or being so small as to be insignificant. I'll have more details in my following posts.
Legutóbb szerkesztette: z; 2023. júl. 2., 14:33
< >
115/25 megjegyzés mutatása
Laponként: 1530 50