poplar
it puts the words on the cards, or it gets the hose again
Yet another digital clone of the "Cards Against Humanity" game.
The game server does not come with any decks loaded by default, however it's fairly simple to populate the database using any number of decks you can find online in machine readable formats.
The basic format of a card is:
body :: string, where each blank is a single underscore
slots :: integer, number of cards required to respond to the prompt
Prompts ("black cards") are any card which has one or more slots, all other cards are considered Responses (or "white cards.")
The Popura.Util module contains several helpers for loading cards from
various third party formats and services. (txt, csv, cardcast API, etc.)
Installation
This is a Phoenix web application. Install Elixir & Phoenix, then you can perform the following to start a local copy of the web server:
mix deps.getdownload & install dependenciesmix ecto.createcreate the database specified byconfig/<env>.exsmix ecto.migrateupdate database schema to latest versioniex -S mix phoenix.serverstart the development server on port 4000
To begin playing, you will need the following:
- Create a
%Popura.Deck{}entity and store it in the database - Import your cards into
%Popura.Card{}entities, relate them to the deck created earlier, and store them in the database - Visit
/lobbies/newto create a new lobby - Direct people to
/lobbies/:id/players/newto join the lobby - On
/lobbies/:idthe host has controls to start/stop the game.
Game Loop
The core game loop consists of the following phases:
-
Pick Czar
- Selects the next czar (in order, "clockwise")
- Announces the next black card
- Deals white cards to individual players (up to 10)
- Enters
Wait (Players)phase
-
Wait Players
- Waits for players to submit white cards
- Stores submissions (in order)
- Moves to
Wait (Czar)phase
-
Wait Czar
- Waits for czar to select from the winning submissions
- Stores winnining submission
- Moves to
Announce Winnerphase (if applicable)
-
Announce Winner
- Announces the winner (or draw)
- Resets for top of round
If the wait phases timeout then the announce winner phase displays
a message about a stalemate. The game is then reset to the top of the round.
Plans / Known Issues / etc.
- Select multiple decks when building a lobby
- Security is pretty lax.
- Loads of queries are duplicated, O(N+1) association fetches, etc. Need to log queries in detail & figure out where waste can be eliminated.
- Timeouts should be configurable per lobby (up to "infinity")
- Game does not "reshuffle" discards when it runs out of cards
- The randomness is probably less than ideal, at some point I'd like
to store precomputed random values in the
cards_pilestable which are set when the lobby loads the deck(s). This way the "shuffle" is consistent between rounds. - Users can submit less cards than the prompt requires. (Including 0 cards!) This is probably never what the user intends to do.
- Better documentation (Sample privacy/tos, FAQ, etc.)