Bagarious
• Posts: 9
Joined: Jan 23, 2017
January 23rd, 2017 at 2:01:36 PM permalink
Hi there everyone, first post here so don't be rough :)

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!
CrystalMath
• Posts: 1911
Joined: May 10, 2011
Thanked by
January 23rd, 2017 at 5:55:40 PM permalink
For regulatory purposes, you will usually calculate the volatility for a single line. This is pretty much useless except that people want it.

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 heart Crystal Math.
Bagarious
• Posts: 9
Joined: Jan 23, 2017
January 24th, 2017 at 9:52:12 AM permalink
Hi 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
teliot
• Posts: 2871
Joined: Oct 19, 2009
Thanked by
January 24th, 2017 at 10:02:22 AM permalink
Bagarious, don't be cheap. Hire a mathematician to do this for you, especially if you are developing a commercial product. Sheeez!

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.
Climate Casino: https://climatecasino.net/climate-casino/
Bagarious
• Posts: 9
Joined: Jan 23, 2017
Thanked by
January 24th, 2017 at 10:19:43 AM permalink
Hi teliot, thanks for your advice. I'm aware of the simulation vs exact solution problem. I don't know where you are getting the 20M spins number from :/ it's actually between 200M-300M.

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.
teliot
• Posts: 2871
Joined: Oct 19, 2009
January 24th, 2017 at 10:27:17 AM permalink
Quote: Bagarious

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.

IMO, this is exceedingly cheap. Learn new stuff on your own. Hire a mathematician for this project.

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.
Climate Casino: https://climatecasino.net/climate-casino/
Bagarious
• Posts: 9
Joined: Jan 23, 2017
Thanked by
January 24th, 2017 at 10:44:13 AM permalink
Contrary 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?
CrystalMath
• Posts: 1911
Joined: May 10, 2011
January 24th, 2017 at 11:04:56 AM permalink
Quote: Bagarious

Contrary 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.
I heart Crystal Math.
CrystalMath
• Posts: 1911
Joined: May 10, 2011
Thanked by
January 24th, 2017 at 11:08:16 AM permalink
Quote: Bagarious

Hi 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.
I heart Crystal Math.
Bagarious
• Posts: 9
Joined: Jan 23, 2017
January 24th, 2017 at 11:24:43 AM permalink
CrystalMath, thank you very much. This cleared things up.
Best regards.
• Posts: 2226
Joined: Feb 24, 2011
January 24th, 2017 at 11:39:18 AM permalink
Quote: CrystalMath

Currently, 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.
CrystalMath
• Posts: 1911
Joined: May 10, 2011
Thanked by
January 24th, 2017 at 11:43:12 AM permalink

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.

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.
I heart Crystal Math.
Bagarious
• Posts: 9
Joined: Jan 23, 2017
January 24th, 2017 at 12:20:42 PM permalink
Ok, 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?

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.
teliot
• Posts: 2871
Joined: Oct 19, 2009
January 24th, 2017 at 1:18:51 PM permalink
Quote: Bagarious

Ok, 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? .

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.

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.
Climate Casino: https://climatecasino.net/climate-casino/
teliot
• Posts: 2871
Joined: Oct 19, 2009
Thanked by
January 24th, 2017 at 1:29:01 PM permalink
Good luck!

Quote: Bagarious

At our company

Quote: Bagarious

We are not a company .... we are actually three friends

Quote: Bagarious

Would hiring someone to do this ... be way beyond my reach?

Climate Casino: https://climatecasino.net/climate-casino/
Bagarious
• Posts: 9
Joined: Jan 23, 2017
January 24th, 2017 at 1:37:13 PM permalink
Thanks!
Last edited by: Bagarious on Jan 24, 2017
teliot
• Posts: 2871
Joined: Oct 19, 2009
Thanked by
January 24th, 2017 at 1:52:21 PM permalink
I saw your previous and thank you for editing.

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.
Climate Casino: https://climatecasino.net/climate-casino/
Bagarious
• Posts: 9
Joined: Jan 23, 2017
Thanked by
January 24th, 2017 at 2:46:49 PM permalink
Thank you teliot. Indeed, I edited my post since my reply seemed unnecessary in retrospective. Sorry.

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.

djatc
• Posts: 4477
Joined: Jan 15, 2013
January 24th, 2017 at 4:42:13 PM permalink
Don't worry about the numbers. The mob ran casinos for years without worrying about all that and they made profits.

Unrelated but let me know when your game comes out and if I can bet real money or not
"Man Babes" #AxelFabulous
Bagarious
• Posts: 9
Joined: Jan 23, 2017
January 25th, 2017 at 7:53:21 AM permalink
Hi, so I've been running some tests and have a few extra questions.

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
eliasp
• Posts: 5
Joined: Jun 21, 2018
October 6th, 2020 at 8:06:27 AM permalink
I used CrystalMath input above and some other findings on the web and drafted the pseudo code below, but I have no idea if it is correct at all. I tested against WOZ deconstruction of IGT Cleopatra that provides some simulation results and it gives similar results but I was not very happy with them.

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);}`
CrystalMath
• Posts: 1911
Joined: May 10, 2011
Thanked by
October 9th, 2020 at 10:36:21 AM permalink
I can mostly follow what you're doing here, and I do see one issue with the confidence levels:

They should be:
enum SLOT_CONFIDENCE_LEVEL_ENUM
{
SLOT_CONFIDENCE_90 = 164,
SLOT_CONFIDENCE_95 = 196,
SLOT_CONFIDENCE_99 = 258
};
I heart Crystal Math.