The Official Forum of The Grail Lords
Would you like to react to this message? Create an account in a few clicks or log in to continue.

The Town Lottery

5 posters

Go down

The Town Lottery Empty The Town Lottery

Post by Lord Arogandor Sun Dec 11, 2022 2:57 pm

Dear Seekers,

As due to some unexpected results during the Town Lotteries, few Seekers questioned the integrity of the town lotteries. Please, rest assured that the lotteries (or any of the gambling games) aren't rigged or contain any hidden mechanisms to favor certain Seekers. However, some bugs that might affect the chances of a player always can be possible. But, I couldn't find anything wrong, and as the millions of testing show the expected results I've sent the script to few other people who have far more experience than me. I'm confident that if neither they find something wrong, the recent lottery events must be weird RNG coincidence.

To be as transparent as possible, I've made an attempt to write down exactly how the Town Lotteries work.

Phase 1: Starting a Lottery
The Town Leader can initiate a new lottery, they can set the price of a ticket, the taxation and the duration. They also can place additional money in the lottery jackpot if they want. They however can't take money out of the jackpot, can't alter the lottery once started nor have any effect on who's going to win. Town leaders can never be hold responsible for the outcome of their town's lottery.


Phase 2: Buying tickets
All Seekers can buy up to 10 tickets in each lottery. They can for example buy 10 tickets for the lottery of Azetyth and another 10 tickets for the lottery of Camaar. Both are fully independent lotteries. For the script 1 lottery tickets values 1,000 points, in addition, the Seeker receives an additional point for each point on their Luck Skill. So a Seeker with 50 luck, will have a value 1,050 points per ticket they buy. Having 100 on the Luck Skill will increase your ticket value by 10% and thus a Seeker with 10 tickets will have a total value of 10,100 points (10 x 1,000 base points + 100 luck points). Once the tickets are bought, the Luck Skill of the Seeker no longer plays an effect for that lottery.


Phase 3: Drawing the winner
During the reset, if the timer for the lottery reached 0, the lottery will end. There's a fixed 10% chance that there's no lottery winner. Nothing can affect that chance, not the town, not the amount of tickets sold. If there's no lottery winner, a part of the jackpot goes into the town treasure, while the remaining money stays for the next jackpot (creating a larger and more interesting prize). Otherwise there's a lottery winner. To determine the winning ticket, a random number between 1 and the sum of all the ticket values is picked. The script then runs over an randomized array with all the participants and their individual ticket value. If the winning ticket lays in the range of the Seeker's ticket value, that Seeker is announced the winner.

If there are 10 Seekers without any luck skill participating and 9 of them buy 10 tickets. The Seeker with 1 ticket, will have 1 chance out of 91 to win. The others will all have 10 chances out of 91 to win.
If 10 Seekers all buy 10 tickets, but one has 100 on luck skill and the others have no luck skill, the chance to win will be 11 out of 100 for the Seeker with 100 on Luck.

Additional notes:
- There can only be one winner per lottery.
- The script is the same for each town, meaning that IF there would be a bug, it SHOULD be noticeable in each of the towns.
- The lottery is a gambling game, if you have difficulties with gambling, or feel like luck isn't your thing, then consider not participating.

As soon, I've gathered the feedback of the coders, I hope to put the lottery back online! Smile
Lord Arogandor
Lord Arogandor
Game Master/Owner

Number of posts : 2995
Location : Somewhere around the Grail Monastery
Registration date : 2008-09-19

https://thegraillords.net

Zaleria and Onihae like this post

Back to top Go down

The Town Lottery Empty Re: The Town Lottery

Post by Onihae Mon Dec 12, 2022 2:27 am

Check how you randomize. In my experience, built-in randomizers aren't really random in a sense, unless it's from a really reputable source. Before, I had to code some checkers to see if the randomizer is favoring a certain number / range. I mainly code in Java and this was a problem. 

Reference: Problem with random generator in Java - Stack Overflow

Not sure with PHP but it might be a similar issue.

Best,
Oni
Onihae
Onihae
Seeker

Number of posts : 2
Registration date : 2022-12-01

Back to top Go down

The Town Lottery Empty Re: The Town Lottery

Post by Vulpini Tue Dec 13, 2022 12:42 am

This looks self inconsistent.
Phase 2: Buying tickets
All Seekers can buy up to 10 tickets in each lottery. They can for example buy 10 tickets for the lottery of Azetyth and another 10 tickets for the lottery of Camaar. Both are fully independent lotteries. For the script 1 lottery tickets values 1,000 points, in addition, the Seeker receives an additional point for each point on their Luck Skill. So a Seeker with 50 luck, will have a value 1,050 points per ticket they buy. Having 100 on the Luck Skill will increase your ticket value by 10% and thus a Seeker with 10 tickets will have a total value of 10,100 points (10 x 1,000 base points + 100 luck points). Once the tickets are bought, the Luck Skill of the Seeker no longer plays an effect for that lottery.
Surely it should read
Phase 2: Buying tickets
All Seekers can buy up to 10 tickets in each lottery. They can for example buy 10 tickets for the lottery of Azetyth and another 10 tickets for the lottery of Camaar. Both are fully independent lotteries. For the script 1 lottery tickets values 1,000 points, in addition, the Seeker receives an additional point for each point on their Luck Skill. So a Seeker with 50 luck, will have a value 1,050 points per ticket they buy. Having 100 on the Luck Skill will increase your ticket value by 10% and thus a Seeker with 10 tickets will have a total value of 11,000 points (10 x (1,000 base points + 100 luck points)). Once the tickets are bought, the Luck Skill of the Seeker no longer plays an effect for that lottery.
It only makes sense for the 10% increase to apply to all tickets not just the first.
Additionally
If 10 Seekers all buy 10 tickets, but one has 100 on luck skill and the others have no luck skill, the chance to win will be 11 out of 100 for the Seeker with 100 on Luck.
should be
If 10 Seekers all buy 10 tickets, but one has 100 on luck skill and the others have no luck skill, the chance to win will be 11 out of 101 for the Seeker with 100 on Luck and 10 out of 101 for the other 9 seekers.
It should be noted that getting the 10% extra for 100 luck in the example quoted does not increase your chances of winning by 10% because it also effectively increases the number of tickets in the draw (by 1% in this case). The seeker with 100 luck still has a 10% greater chance other seekers it's just that their chance of winning has been reduced by the effective extra ticket in the draw.

Random numbers in computing are always problematic. Most random number generators only produce a pseudo-random sequence of numbers.

V

Vulpini
Seeker

Number of posts : 10
Registration date : 2016-02-23

krakhammer likes this post

Back to top Go down

The Town Lottery Empty Re: The Town Lottery

Post by Ragnar_the_Dour Tue Dec 13, 2022 2:29 pm

Onihae wrote:Check how you randomize. In my experience, built-in randomizers aren't really random in a sense, unless it's from a really reputable source. Before, I had to code some checkers to see if the randomizer is favoring a certain number / range. I mainly code in Java and this was a problem. 

Reference: Problem with random generator in Java - Stack Overflow

Not sure with PHP but it might be a similar issue.

Best,
Oni

PHP (or jQuery for that matter) does have similar issues, hence the feeling that you sometimes get a lucky streak and sometimes you better stop playing TGL for a few minutes because "it is against you". 

It has nothing to do with rigged code, rather how the machine generates the pseudo-random numbers. I didn't see the code for the lotteries but some other RNG-code Aro uses. It's pretty much standard code, so expect the standard issues with possible collation etc.

There are ways around it, sure. I bet jQuery also offers somethings along the lines of a cryptographically secure RNG, we don't need full specs here but avoiding the common issues would already help a lot.
Ragnar_the_Dour
Ragnar_the_Dour
Seeker

Number of posts : 10
Registration date : 2019-08-06

Back to top Go down

The Town Lottery Empty Re: The Town Lottery

Post by Lord Arogandor Thu Dec 15, 2022 8:02 am

Dear Seekers,

Thank you all for your feedback. Smile
The lottery script uses the PHP function "random_int()", which returns a cryptographically secure integer to select the winning number.
After numerous testing, feedback and rebuilding the script from scratch we believe the Town Lotteries are ready to be re-activated.

Best of luck to you all! Smile
Lord Arogandor
Lord Arogandor
Game Master/Owner

Number of posts : 2995
Location : Somewhere around the Grail Monastery
Registration date : 2008-09-19

https://thegraillords.net

Back to top Go down

The Town Lottery Empty Re: The Town Lottery

Post by Dardoc Thu Dec 15, 2022 2:03 pm

Strange as it may seem... sometimes people just get lucky.

Randomness does not care about fairness or statistical significance... it just does its own quirky little random thing...

Dardoc
Seeker

Number of posts : 33
Registration date : 2020-06-05

Back to top Go down

The Town Lottery Empty Re: The Town Lottery

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum