
Based on the murder mystery board game by Parker
Cluedo represents my first attempt to build a fully functional game which incorporates a Graphical User Interface, and having done so with no guidance from a textbook. Admittedly, I may have borrowed a couple of graphics, but the code at least is 100% my own.
The game tries to replicate the murder mystery board game of Cluedo. I looked up the rules online and found various flavours; therefore the game play may vary slightly to what you are used to if you’ve played the game before, i.e. Do you normally roll the die again if you threw a six? (not in this one you don’t).
It basically allows the user to play as any game character, against 2 – 5 computer controlled opponents. There are 6 characters, 6 weapons and 9 rooms in all. Each are represented by a card, and one of each of these cards are selected at random at the start of the game. These 3 cards represent the murder details – A room, a suspect, and a weapon. By process of elimination it is your job to identify all 3 cards before one of your opponents does. To do this, you move your character around the game board into the various rooms, and then you make a suggestion on a room, suspect and weapon at each turn. An opponent will show you a card matching your suggestion if they have one in their hand. Your opponents play the game in the same way; they will control their own movement around the board and choose which cards to suggest for their own investigation. You in turn will be required to show your opponents a card from your own hand when requested.
The winning player is the first to identify who committed the murder, where, and with which weapon.
Technical Issue:
(Only read on if you’re interested in the programming details)
All is not perfect though… There is a small but noticeable problem which I’ll elaborate on and hold my hands up to.
If you play the game, you will probably notice that there is a small flicker in the game board image each time a token moves around on top of it. This problem basically results from the way that images are ‘redrawn’ on the screen every time the token changes position. Further, this problem is the result of the approach I’ve used to build the application. That is i’ve done so with a heavy use of ‘Controls’ – namely the ‘Picture Box’ control which is used for the game board and for all that moves around on top of it.
Now admittedly, part way through the development of this game (while doing my studying), I learnt a wealth of knowledge about the ‘Graphics’ class and its ability to draw images on the fly to the screen, and using pre-scaling techniques to speed the whole process up. A far better method than using the Picture Box controls if objects are moving around on the screen. One bonus result being no more flicker!
Now I did actually start to re-write a significant part of the application to make use of these superior programming techniques. However, after a couple of hours of re-coding, I discovered that this was a much bigger effort than I first anticipated. Pretty much the entire way I had written the program would have had to be changed. So, part way through I asked myself was it really worth it? Well, probably not. The game isn’t being produced for a client and won’t be sold as a commercial product. Fortunately I had backed up my work before tinkering.
I therefore take this as a learning experience; and when in the planning stages of my next application I am now armed with the knowledge that graphical animation requires a different approach to pull off. Furthermore when I build Halo 4 on behalf of Microsoft, you can sleep at night with the assurance that it will be flicker free :-)
Continue Reading...