I went to Atlantic City over the holiday season, and I played a bunch of different games from Let It Ride to Black Jack. The one game I was intrigued by the most was the slot machines, not because of the flashing lights but how much they lend themselves to the new technologies Microsoft is putting out. If you haven't stepped into a Casino in a long time, then I suggest you do and just think about the technology that is around you. All the slot machines are networked and now are mostly flashy video games. This got me thinking about WPF and how it would lend itself perfectly to a game like a slot machine. Also technologies like WCF make it easy to network such a game. So I started writing a game engine for a slot machine, I don't know if it is how professional slot machines are written, but I think I have a very good start.
MonstersGotMy.Games.zip (790.43 kb)
I started out by first realizing my domain. I came up up with the following domain models: Bet, Combonation, Line, Reel, Slot, and SpinResult. These are the important aspects to a slot machine. If you would like to see what those classes look like, then download the project. Next I defined the slot machine and it's actions.
public interface ISlotMachine
{
decimal Credits { get; }
SpinResult Spin(Bet bet);
void AddCredits(decimal credits);
decimal CashOut();
}
The framework I setup allows me to create an infinite combonation of slot machines. Infinite amounts or reels, lines, and combonations means infinite amounts of fun right? I also decided to abstract away the randomization algorithm for the slot machine, creating an IRandomizer interface. Not terribly complex. I decided to do this, because I remember seeing .NET libraries with different randomizing algorithms.
public interface IRandomizer
{
int Next(int min, int max);
}
Right now I have a three reel and one line slot machine as an example (with no UI
). I am attempting to make a working version in Silverlight 2, but my Adobe Illustrator skills are very rusty. It may take some time to get a working Silverlight example. If you are a designer and would like to help, it would be greatly appreciated. The aim of this engine is to eventually be used as a base to learn how to create a silverlight application. I also would like to use the Unity for Silverlight library to help resolve all dependencies in my Silverlight application. Take a look at it, and offer any critism that can make the engine better.
Note: Silverlight doesn't support Resource Dictionaries like WPF does, that is uber-lame.
MonstersGotMy.Games.zip (790.43 kb)