Giter Club home page Giter Club logo

cards-against-humanity's Introduction

Cards Against Humanity

Cards Against Humanity Settings Page

Cards Against Humanity is a social game based-on a card game with the same title.

Information about the project:

Copyright:

I do not own any rights to the card game. It is just a free-time project i've been working on for a while. The game is not that advanced. Wanted to post it on github, it's a great way to start learning UWP.

The client:

Cards Against Humanity Game

Written in C# UWP using the WinUI 2.8.2 Framework. The client also uses the Microsoft UWP Toolkit and the WatsonTCP for the TCP/IP connection.

The server:

Cards Against Humanity Server

Written in .NET C# as a simple Console Application. It also uses the WatsonTCP API.

Game rules:

The best place to read the rules is either the Cards Against Humanity Website or the official pdf rulebook. Rules of the original are mostly the same. The only difference is that in the card game only the Card Czar can choose the best answer. In my adaptation eveyrone can vote who they think answered the best.

Game roles:

There are two types of players you can become:

  • The Card Czar: Your job is to choose a card everyone has to answer.
  • Normal player: Your job is to answer the Card Czars' card.

How does the round playout:

  1. Firstly, after everyone joins the server and the host starts the game, one of the players will be chosen as the Card Czar. Everyone has to wait until he chooses a card.
  2. Next, every normal player will be given 10 random cards. They need to select the best answer.
  3. After everyone has finally selected a card, everyone (including the Card Czar) needs to decide whose answer they like the most.
  4. Lastly, the most-voted card will be revealed.

How does it work:

The game works relatively simple. There is a variable called gameState, which helps the game understand what it has to do. Values for gameState are different for the server and the client.

The server:

  1. gameState = 0 - Awaiting for clients. In this phase, the server waits for people to connect.
  2. gameState = 1 - Selecting the Card Czar. In this stage, the server selects a random player to become the Card Czar. Next, server sends a message to every client, sending player nicknames and telling them who is the Card Czar.
  3. gameState = 2 - Awaiting black cards. Waiting for the fill-in or question cards. After receiving it, the server sends it to everyone else.
  4. gameState = 3 - Awaiting white cards (answer cards) from clients. The server waits for every normal player (not counting the Card Czar) to share the chosen white card. After everyone shared their white card, the server sends the list of white cards (and whose card it is) to everyone.
  5. gameState = 4 - Awaiting votes from clients. The server waits for everyone (including the Card Czar) to send a message telling which card they voted for. Afterwards, it sends this information to everyone else.

The client:

  1. gameState = 0 - Awaiting server connection.
  2. gameState = 1 - Checking if the player is the Card Czar. If the player is the Card Czar, generate 5 random cards for him to chose one of them. If he is not the Card Czar, await his turn.
  3. gameState = 2 - Awaiting Card Czars' choice. Waiting for the headPlayer to choose one of the 5 cards. When he does, send information to the server.
  4. gamestate - 3 - Awaiting results. In this stage, players will wait for everyone to finish choosing their cards. Clients await information from the server during this gameState.
  5. gameState = 4 - Awaiting ID and Type of the black card. In this stage, everyone (apart from the Card Czar) will wait until the Card Czar chooses his card.
  6. gameState = 5 - Waiting for the players choice. In this stage, the client awaits input from the player. They need to choose a white card. Afterwards, their card will be sent to the server.
  7. gameState = 6 - Waiting for the round restart command. The client waits for the server to send a round restart request.
  8. gameState = 7 - Voting for the best cards. In this stage, the client awaits for the players input. Everyone (including the Card Czar) will have to choose a single card.
  9. gameState = 8 - Waiting for everyones vote. Waiting for the servers message, which will be sent out after everyone finishes voting.

cards-against-humanity's People

Contributors

fotasteam avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.