Tagged GameAWeek

Game A Week #1

Earlier this week Anastasia put up a Bat Signal for a game a week challenge based on this post. I had always wanted to do the 1 game a month challenge so I thought this would be a cool way to do that while exploring ideas quickly.

Also joining in the madness are:

Melissa Peterson
Anastasia Salter
Mark Danger Chen

Going into this challenge I kept in mind the advice from my gamedev friends to focus on creating modules whenever I took part in a gamejam. The reasoning behind this is: If you make a message system during a gamejam, during the next gamejam you should be able to reuse that code and avoid writing another message system. This makes sense except I never really started a gamejam with that mindset which resulted in messy code that I never get around to cleaning. Because the amount of time to create a game is very limited in this challenge (a day) it would be really helpful to have/build some reusable modules and I’m hoping that pressure will help me keep my code reusable.

Game #1, BlackJack


I’m probably going to make a card game sometime in this challenge, so I figured why not make a card/deck system that I can reuse in other games? I decided that the best way to go about doing that is to clone a game I know the rules of so I can focus on the system. This way, when I make a unique card game, I can have functions like Shuffle() Draw() ready and waiting so that I can focus on the game’s rules. The result is a mostly playable game of BlackJack.

What went right

I found myself trying to show the player messages constantly, so I tried to salvage some code from another project to create a message system. The transplant was a little tricky because, as I mentioned above, it contained lines of code that were specific to that game. Once I managed to make the system generic it worked rather well and I was able to make some upgrades to it including queuing up messages if the player receives more than one notice. I was then able to add those upgrades to the other project I was working on (Win Win).

Still getting the hang of inheritance in unity (gameobjects can only inherit from monobehaviour, but can implement many interfaces) but managed to set up some interfaces/base classes which made the creation of the BlackJackDealer AI, and the PlayingCard Objects a snap. Keeping my code clean also helped me to decide where I should put some of the logic making the classes much more readable.

What went wrong

I didn’t get around to implementing the betting mechanic. The game works well enough without it, but it would be fun to see how high your pot can go before you lose it all to the house. I had some difficulty setting up my TextGameView and had to set up some guistyles programmatically. This lead to some inconsistencies between the message controller and the TextGameView. I suppose I should have just created a UnityViewController that implemented the GameView interface, but I ran out of time.

What I learned

Making the classes general is really really worth it. Though it takes work to set up class hierarchy, the power you get from it is worth the trade off. If you’re interested in learning about inheritance this looks like a good tutorial to get you started.

Syncing monodevelop is really useful. For some reason unity wasn’t syncing with monodevelop and I had to keep a lot of the function names etc in my head as I wrote code. It wasn’t impossible to write the game, but I have a feeling that it’ll really be useful in the upcoming projects. To re-sync go to Assets->Sync Monodevelop.

Delegate functions are cool. I hadn’t used anonymous functions in c# before and was pleasantly surprised to see them implemented. Anonymous functions are cool when you don’t want to write up a small function that might only be used once, etc. For example, if I wanted to sum up the values of all cards in my hand I could write:

int value;
BJP.GetHand().ForEach(delegate(Card card){
value += card.value;

rather than having to declare a 3 line function that doesn’t get called anywhere else. I remember there being other reasons why these functions are cool, but it escapes me at the moment.