Thread Rating:
At our company we are currently building a simple slot machine as a mini game for giving players incentives for our yet to be released app. After some investigation I realized that, apart from calculating the RTP percentage, it would be nice to also calculate the Volatility Index (VI).
I've seen various documents on the web that state that for calculating this VI, it's necessary first to obtain the Standard Deviation for the Slot Machine. We are able to simulate all plays on the slot machine and record all pays.
Correct me if I'm wrong please, but to calculate the Standard Deviation you have to first obtain the mean of all the machine pays for the lowest bet possible? In our case that would be 1 credit and 1 line. Is this a correct assumption?
We have tried to calculate the standard deviation using simulations with 20 credits and 20 lines, and we always get a number between 200-300 (!). When we run the simulations using 1 credit and 1 line, we get a Standard Deviation of 9, which multiplied by 1.65 (90% confidence) gives us a VI of 15, which seems a bit high but entirely reasonable.
On the other hand, I have tried dividing the 200-300 number by 40 (20 credits x 20 lines), in a surely misguided attempt at getting a reasonable number.
We are a very small independent team where I'm the only programmer and often play the part of confused mathematician.
I appreciate any help I can get.
Thanks!
When I simulate the game to get the standard deviation for more lines, I just simulate it at 1 credit per line. Track the following stats:
CI = coin in (games*lines)
CO = coin out (total win)
SS = sum of squared wins. For each game, calculate the total win and then square it.
Variance = (SS - CO^2/CI)/CI
SD = (Variance)^.5
I'm sorry but I'm not sure I follow you, please bear with me a little. You are essentialy saying that if I had a big list with all the wins reported by the simulation, I should just divide each item of that list by LINES and the proceed with regular variance calculations?
For example, simulation with 1 credit and 20 lines:
wins = [20, 100, 0, 40, ...] -> Standard Deviation = 222
Dividing each value by 20
wins = [1, 5, 0, ] -> Standard Deviation = 11.1
Which is essentialy dividing the 'original' SD by 20?
I got a little confused with your reformulation of variance. Why is SS sum of squared wins? Why are you not squaring this (SS - CO^2/CI)?
Could you please explain how would you perform your calculations assuming I had a big list with all the wins from the simulation with 20 lines and 1 credit?
Thanks
If you are a programmer but have never done slot mathematics before, you don't do it by simulation. You create a complete and exact solution using Excel. You can check your PAR excel spread sheet work by simulation. Also, 20M spins is pitifully low - don't use VBA or Java. Use C or C++ (or something similar). Aim for 1B spins.
You are heading for a disaster. These have happened many times before and there are plenty of people here who are waiting to eat your mistakes for dinner.
Cheers.
I'm aiming for people here to actually notice my surely evident mistakes, I don't think there's anything wrong with trying to learn something new? I'm just wondering how to accurately calculate the volatility index for bets other than 1 credit x 1 line.
Thanks.
IMO, this is exceedingly cheap. Learn new stuff on your own. Hire a mathematician for this project.Quote: BagariousI'm aiming for people here to actually notice my surely evident mistakes, I don't think there's anything wrong with trying to learn something new? I'm just wondering how to accurately calculate the volatility index for bets other than 1 credit x 1 line.
Look, I've got a Ph.D. in mathematics and am a former professor of both mathematics and computer science. That background didn't keep me from knowing I needed a professional mentor. For my first slot I hired the former lead mathematician at Bally's to mentor me. I paid a lot for that. I created the PAR and she double-checked it and gave me advice on certain parts as well as the programming. Above all else, I learned what the industry standard PARs looked like, what features they have, how they are laid out. After the first, she also helped me with tricks on more difficult issues (two-ways, exploding and expanding, etc.). It took several months for me to feel comfortable with most of the standard features that would get thrown my way. I have done dozens of PARs as an independent mathematician. Thinking you can do this yourself by asking a few questions here is different than "learning something new."
Hire someone here (NOT ME) to do this for you, or to mentor you directly on your work. There are plenty of professionals here. You are an employee of a company that is making a commercial product for profit. It is not just *you* the curious guy. So don't play that game.
Is it wrong for hobbyists to post here? Is this forum a freelancer-like site?
Quote: BagariousContrary to what you may have assumed from my posts, we are not a company with funding, we are actually three friends trying to make a Unity app completely unrelated to slot machines on our free time, but with a slot feature. I do not intend to leech from anyone here. I was not aware that this forum frowned upon this sort of questions unless the poster intended to hire someone. If that's the case, my apologies. I'm obviously not going to get on your level by getting a silly question answered, but I admit that the slot math design subject is really interesting and I would love to learn more.
Is it wrong for hobbyists to post here? Is this forum a freelancer-like site?
There are people on here who would do the work for you. I used to be one of them, but I still answer an occasional question. Currently, I just don't accept work from independent game inventors, with some exceptions.
Quote: BagariousHi there, thanks for your help!
I'm sorry but I'm not sure I follow you, please bear with me a little. You are essentialy saying that if I had a big list with all the wins reported by the simulation, I should just divide each item of that list by LINES and the proceed with regular variance calculations?
For example, simulation with 1 credit and 20 lines:
wins = [20, 100, 0, 40, ...] -> Standard Deviation = 222
Dividing each value by 20
wins = [1, 5, 0, ] -> Standard Deviation = 11.1
Which is essentialy dividing the 'original' SD by 20?
I got a little confused with your reformulation of variance. Why is SS sum of squared wins? Why are you not squaring this (SS - CO^2/CI)?
Could you please explain how would you perform your calculations assuming I had a big list with all the wins from the simulation with 20 lines and 1 credit?
Thanks
In your example (and I'm just going to use the 4 numbers you provided):
CI = 80 (20 credits per game * 4 games)
CO = total win = 160
SS = 20^2 + 100^2 + 0^2 + 40^2 = 14,000
Variance = (14000-160^2/80)/80
Standard Deviation = Variance ^ .5
This is a super easy method of calculating the standard deviation because you just keep a running tally of CI, CO, and SS, rather than storing a list of outcomes.
Best regards.
Quote: CrystalMathCurrently, I just don't accept work from independent game inventors, with some exceptions.
Wait...what!?! Oh great, another super good option for the little guys falls by the wayside ;-)...CM is one of the best (along with Teliot), but neither take small clients based on what they have had to deal with in the past...independent game developers are normally the worst possible clients.
Charles M also does great work and still helps independents based on the latest info I have.
Quote: ParadigmWait...what!?! Oh great, another super good option for the little guys falls by the wayside ;-)...CM is one of the best (along with Teliot), but neither take small clients based on what they have had to deal with in the past...independent game developers are normally the worst possible clients.
Charles M also does great work and still helps independents based on the latest info I have.
It's just too damn frustrating. I tip my hat to Charles.
There are some good independent inventors, like you and Harry, but so many don't know anything about gaming and aren't too keen on listening.
If someone wants to PM me a quote for full math for a simple slot, or a week of tutoring going over the main concepts, or maybe even answering some extra questions, that would be great. I understand your frustation with indie developers, but I admit I know very little of this subject so I'm willing to really listen, take notes, and not argue with anyone willing to teach.
Cheers.
You went from a company to 3 guys to you by yourself. Sounds like it's time to incorporate and create a R&D budget. This shouldn't be yours to bear.Quote: BagariousOk, now I'm really curious. Would hiring someone to do this kind of math or mentor me a bit would be way beyond my reach? .
Contact Charles Mousseau at www.tgscience.com -- he may be able to help you. I can't say what he would charge, but don't be surprised by a quote in the multi-k range.
Quote: BagariousAt our company
Quote: BagariousWe are not a company .... we are actually three friends
Quote: BagariousWould hiring someone to do this ... be way beyond my reach?
edit: Removed unnecesary comments
I don't mean to be so hard on you as it seems. But, you have come to a place where professionals hang out, and you represented yourself as someone other than who you are. Now that it is clear, I think we all have a much better idea of what you may need and how to best assist you.
For example, if I thought you were in a company, I would shout "don't be cheap," because my experience over many years is that corporations are cheap. If you're just a guy, then you will find people here being much more generous with you. Many people here have plodded through game development and helped each other along the way.
For the standard deviation, what CM is referring to can be found here:
https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
Cheers.
Quote:you have come to a place where professionals hang out, and you represented yourself as someone other than who you are
You are correct, I didn't realize at first. I'll be more accurate in the future and will leave a note on my original post to better represent myself.
Cheers, this has been helpful.
Unrelated but let me know when your game comes out and if I can bet real money or not
I've read that typical values for 1 credit x 1 line volatility index are in the range of 8-15 or so. Should the calculations for volatility involving more lines be in that same range? For example, using CrystalMath's recommendation, I'm getting the following for 90% confidence:
1 line -> VI = 15.4
10 lines -> VI = 16
20 lines -> VI = 24
Is this behaviour expected or am I way way off?
Are there recommended ranges for VI considering more lines, or should everything be in the 8-15 range?
Thanks
If anyone cares to point out corrections, you are most welcome!
enum SLOT_CONFIDENCE_LEVEL_ENUM
{
SLOT_CONFIDENCE_90 = 164,
SLOT_CONFIDENCE_95 = 165,
SLOT_CONFIDENCE_99 = 258
};
void SimulateSpins()
{
double TotalWinnings = 0;
double S_CO = 0; // Sum of credit out
size_t TotalPlays = 1e7; // 10,000,000
Wager = { BetLines, BetLevel, CoinValue } = { 20, 2, 0.5 };
double SingleLineBet = CoinValue * BetLevel;
double TotalBet = TotalPlays * BetLines * SingleLineBet;
for(size_t i=1; i<n; i++)
{
auto& Stops = RNG();
auto& ReelView = CreateReelViewFromStops(Stops);
auto& Lines = ConvertReelViewToPayLines(ReelView);
// To simplify, we ignore free spins, bonus games, etc.
for(auto& Line : Lines) // this vector has always 20 lines because Wager.BetLines = 20
{
double wins = CalcLineWinnings(Line); // Could return some win or not
TotalWinnings += wins;
CO += wins;
S_CO += square(CO);
}
}
double CO = TotalWinnings / Wager.BetLines;
double CI = TotalBet / Wager.BetLines;
double Variance = (S_CO - square(CO) / CI) / CI;
double StandardDeviation = sqrt(Variance);
const double rtp = PAR.rtp; // Parsheet RTP
double VolatilityIndex[];
double PaybackLow[];
double PaybackHigh[];
auto fn_vi = [&](SLOT_CONFIDENCE_LEVEL_ENUM CL)
{
const double _cl = static_cast<double>(CL) / 100.0; // this becomes 90, 95, 99
const double _vi = _cl * StandardDeviation;
VolatilityIndex[CL] = _vi;
};
auto fn_range = [&](SLOT_CONFIDENCE_LEVEL_ENUM CL)
{
const double _vi = VolatilityIndex[CL];
const double range = _vi / sqrt(TotalPlays);
PaybackLow[CL] = rtp - range;
PaybackHigh[CL] = rtp + range;
};
fn_vi(SLOT_CONFIDENCE_90);
fn_vi(SLOT_CONFIDENCE_95);
fn_vi(SLOT_CONFIDENCE_99);
fn_range(SLOT_CONFIDENCE_90);
fn_range(SLOT_CONFIDENCE_95);
fn_range(SLOT_CONFIDENCE_99);
}
They should be:
enum SLOT_CONFIDENCE_LEVEL_ENUM
{
SLOT_CONFIDENCE_90 = 164,
SLOT_CONFIDENCE_95 = 196,
SLOT_CONFIDENCE_99 = 258
};