I’m working on both my first multiplayer game and Card game in Unity (I attempted to make video poker as part of one of my classes in college but it was in XAML). It’s a game I play in the pub at weekends, where the aim is to get as close to 31 in a single suit as possible. I’ve played it with 12 other people but I think there’s no upper limit to the number of simultaneous players.
The rules are as follows:
- Each player starts with 3 lives.
- A round begins with each player given 3 cards, with the dealer getting a fourth. The dealer discards a card of their choice, then it’s the next player’s turn, with the next player having a choice between picking up the last discarded card or taking a face down card from the deck.
- Once everyone has had a turn, any player with 3 cards in the same suit totalling over 21 can Stop the Bus on their turn.
- Once the bus is stopped, every other player takes one last turn, and once play reaches the person who stopped, everyone reveals their hand.
- Aces are worth 11, K,Q and J are all worth 10.
- The player(s) with the lowest scoring hand lose a life.
- If a player gets a “Gabby” (31), EVERYONE besides them loses a life, UNLESS there are 2 Gabbies revealed
I’ve avoided card games in Unity for the longest time because I feel they scream out for an Object oriented approach rather than Unity’s “Every script is a behaviour” system. When I began, I initially approached it from that way of thinking, making a Card script with all the properties you’d expect from a card (Suit, Face, whether it’s facing up or not and so on) but it quickly became clear that that was the wrong approach, leading to refactoring Card into a regular System Class and creating a CardBehaviour script that inherits from MonoBehaviour and has a “Card” property which seems to work.
At the time of writing, none of the actual gameplay logic is implemented. The players are positioned, given their cards and then nothing happens in terms of actual play.
However, the systems are all in place. The Logic Manager know exactly what score each player has, the deck is filled and ready to give out cards and knows to hide all cards the player shouldn’t see.
The only obstacle is figuring out how to put them to use.
Eventually once the game works locally I’ll begin the task of implementing multiplayer. I experimented around with adding networking and multiple players to Shield Yield with a small amount of success, as soon as it looked like it would work I began working on Stop the Bus with the ultimate goal of adding multiplayer to a game that it would actually work well in, because unless I somehow have a revelation about how a multiplayer Shield Yield would even work, it’s going to stay as a singleplayer game
Finally, in what has become somewhat of a tradition for me I’m recording the development process and editing it into a timelapse. This is an early one but it’s done. I’m not sure exactly how long the final version will be or when it’ll be made, but so far I have 10+ hours of footage.