Ok I'm going to start a series of articles, topics that talk about game design, programming and admin'ing an online game that I've picked up along the way. I'm not sure with what frequency these articles will get published, and with the holidays upon us they will probably dip for a couple weeks

However I've run across a LOT of things that I've learned that my be of some use to any budding game programmer / designer...
My apologies Zeg if this was posted in the wrong forum
Durning the time of running BordelloBattles I decided to add a casino option to the game (I think the wife and I just got back from Vegas so I was full of ideas LOL). I hunted around and really couldn't find any Blackjack or Poker programs written in PHP, PERL or ASP that were really of any worth.. Those that I did find wanted me to pay for the scripts, pfft I can code so I'll just write them myself. Writing those two (blackjack and video poker) were great programming exercises.. Lots of conditionals to check for, lot of little things you need to keep track of etc etc... Anyways those two items aren't the focus of the article the real focus is on the slots I also added.
The slots, at the time, were the easiest to code, heck take a bunch of pictures put them in a set of three arrays and randomize one from each array.. If they match a given sequence you win X amount.. Not the most difficult thing to write LOL... So I put the slots up along with the blackjack and video poker and it was a huge success in the game.. Blackjack took a lot of work because I wasn't fully aware of ALL the rules and just coded a quick version of it.. After the players got a hold of it they wanted double downs, splits and every other damn that a blackjack table had...
So the game went 3-4 rounds (months) without any problems with the casino.... Then it happened a bunch of very "creative" players had found out that the slots won more often then they lost..So these "creative" players all downloaded Opera and basically had Opera automatically "click" the bet button every 20 seconds and were basically making HUGE amounts of cash off the slot machines...
Anyone know why?
I'll tell ya, for those that don't know.. It's because rand and mt_rand randomize numbers in an even pattern, or try to at least. Because of this the slots were winning more then they were losing

I tried a number of hacks to try and get the slots to return a set, or close to a set of percentages... Scoured the internet trying to find (in detail) how slots work. Found a lot of casino sites with basic rules, some articles with "how they work" but were very very basic. Eventually though I came across this link
http://wizardofodds.com/slots/slotapx2.html which finally described, in the detail I needed, how slots really work and the mathematics behind it.
Course I'll skip over all the drama that played out on the actual game between the players since this was "sort of" an exploit that the "creative" players were using, yet not really because it was working the way I coded it. It caused a lot of problems and many users were very angry at myself and the game because of this.
Moral of the story, just because the task looks easy to accomplish doesn't always mean it is easy to, and, if it is to easy, well then maybe it was to easy and something not readily "obvious" is wrong

Oh and this article was inspired by a thread here of where to find games and someone offered up links to some slot code. Might want to check how that code is generating a "winning" spin before you put it up on your game
