Randomness and Games
Monday, October 14, 2013
I like having a little bit of randomness in my games. I view luck as the lubricant of game play. You need just enough to keep a game from getting stale, but not so much that it falls apart.
En Garde is, at its heart, a card game. Before each round, the cards are shuffled and dealt to each player. Whenever a new card is drawn, it comes from the top of the "deck."
That shuffling is as random as I could make it. I'm at the mercy of the LSL scripting language. In particular, I make a call to llListRandomize() to do the shuffle. I hope that that particular API call is truly random. It's not hard to make a good shuffle routine, but then again, it's not hard to screw it up, either. One of my favorite stories is about an online Poker site which screwed up their random shuffle routine, and when some players figured it out, they were able to predict who had what cards and make a bunch of money off the exploit.
I can tell you, though, that there is no intentional bias in any of the card shuffling. There is nothing in the code that gives an advantage to Player 1 or Player 2 (other than the fact that Player 1 has a very slight advantage because he plays first in the first round). So if you think that one side or the other is getting good cards all the time, it's just your mind finding patterns in the random numbers that aren't really there.
Sometimes you get a good hand, and sometimes you don't. The skill in the game comes from making the best of when you have a bad hand.
Great post. Hopefully after reading this there will be slightly less blaming of the "broken pistes" when someone loses and a bit more good sportsmanship to the other player.