My friends and I love to play board games, one of our favorite games is «Cosmic Encounter». A quote from wikipedia «Each player takes the role of a particular alien species, each with a unique power to break one of the rules of the game, trying to establish control over the universe». This game can get very complicated, and it has ALOT of expansions. There is 165 different alien powers you can play, and shuffling that pile of sheets is not possible. Also, since the expansions are in separate boxes, re-packing the items after a game is not fun. The main problem though, since we kept each expansion pile separated, was that it was hard to make the drawing of powers completely random.
The idea was to make a generator with all the powers in it. That way, each time we use the generator we are guaranteed 100% random powers each time. I wanted to be able to choose how many players I needed, how many flares(this is the cards we usually draw to get a power), and how many alien powers we could choose ( we often play with several powers each). Also depending on who plays, I wanted to be able to filter out the powers that comes with gamesetup, filter by difficulty and by expansion.
There was a few of factors to consider when I started to write the code. All the aliens had have attributes such as, expansion pack, image file, difficulty level, and if they had gamesetup or not. Since only one player can possess a certain power at a time, once an alien was generated for one player it could not be generated again.
When the generator is activated it will generate the chosen amount of players and give each player x-amount of flares. The flares remains hidden until the player clicks on their profile, once the profile is open they can choose x-amount of powers. When they have chosen their profile will close and the flares will remain hidden until every player has chosen their powers. When everyone has chosen, all the profiles will «open» and everyone can see what the other players has as a power and from what expansion(this is important to find the cards fast) that power is from.
Playing cosmic encounter is so much easier now. When everyones profile is open we usually airplay the screen so everyone can see all the powers on the TV. That being said I still want to improve it in the future. In the near future I will make the script exclude powers from a player if that player has recently played that power. I would like to one day implement a back end system so everyone can have a winning statistic, alien statistic and combo statistic. It would be really cool to make it accessible from everyones phones so we don’t have to share the computer. All in all, it was a fun experience!