GithubHelp home page GithubHelp logo

clue-less's Introduction

Clue-Less

   ______ __                     __                    
  / ____// /__  __ ___          / /   ___   _____ _____
 / /    / // / / // _ \ ______ / /   / _ \ / ___// ___/
/ /___ / // /_/ //  __//_____// /___/  __/(__  )(__  ) 
\____//_/ \__,_/ \___/       /_____/\___//____//____/  

This project is using the fastapi framework in addition to click for providing an clue-less game that can be played in the terminal and on your browser.

Project Structure

clueless is our project root

pyproject.toml defines our project's requirements.

clueless/main.py defines the entry points for the application, namely:

  • The terminal entry point clue play
  • The web serving command clue serve

clueless/app contains all the application logic including

  • The fastapi webapp definitions
  • Web app logic including UI/UX
  • Core logic

clueless/app/core contains all the core game logic such as

  • Game Loop
  • Characters
  • Players
  • Rooms

Getting Started

Make sure you have at least python 3.9 installed.

python --version

Make a virtual environment

python -m venv venv
. ./venv/bin/activate

Install dependencies

pip install .

Alternative Setup (Later in Project)

When we get to deploying the stack we may want to use docker.

To build and stand up the stack following the steps. (Must have docker and docker compose installed).

docker compose build

Standup

docker compose up

Playing the game

Terminal

Run the following command

clue play

On your browser

clue serve

Alternatively, you can use docker

docker compose up --build

Instructions

Authentication

The Clue-less stack now uses a user authentication system via fastapi-users. Generally users will need to register and login. The frontend will need to keep the session information when logged in. The general process for testing this is:

  1. Stand up the stack with the prior instructions.
  2. Visit the docs page at http://0.0.0.0:80/docs
  3. Register for a new account at http://0.0.0.0/docs#/auth/register_register_api_auth_register_post
    1. Provide a username (email) and password)
  4. Log in to the docs by clicking on the authorization button at the top of the page.
    1. Provide your username and password. You don't need to provide anything else.
  5. You are now authenticated and logged in to the docs, you can test the endpoints now.
graph TD;
    Register-->Login;
    Login-->ClueLess_Code;
Loading

Authenticating with a request

When the user logs in, the following payload

{
   "username": "[email protected]",
   "password": "password"
}

is sent to /api/auth/login/jwt/login as a POST REQUEST

You will receive a response

{
  "access_token": "<TOKEN>",
  "token_type": "bearer"
}

Use this token to authenticate when sending requests to the backend

headers = {
    'Authorization': 'Bearer <TOKEN>',
}

Rooms

Games are centered around game rooms. They're basically a lobby for you to wait in before your game starts.

Creating a room

  1. Stand up the stack with the prior instructions.
  2. Visit the docs page at http://0.0.0.0:80/docs
  3. Log in to the docs by clicking on the authorization button at the top of the page.
    1. Provide your username and password. You don't need to provide anything else.
  4. Visit the create room doc. http://0.0.0.0/docs#/room/create_room_api_room__post
    1. Click Try it out
    2. Create a room with the payload of: and send
{
  "name": "My Game"
}
  1. You will receive the response
{
  "name": "My Game",
  "player_limit": 6,
  "is_started": false,
  "host": "f4b8215d-5e3d-4444-9228-e0e5da5fad09",
  "id": "a943d563-828b-414e-98a5-dd37828770dd",
  "room_key": "pVn6",
  "users": [
    "f4b8215d-5e3d-4444-9228-e0e5da5fad09"
  ]
}
  1. Visit the rooms UI page to see your room. http://0.0.0.0/rooms
graph TD;
    Login-->Create_Room;
    Login-->Join_Room;
Loading

Joining a room

  1. Stand up the stack with the prior instructions.
  2. Visit the docs page at http://0.0.0.0:80/docs
  3. Log in to the docs by clicking on the authorization button at the top of the page.
    1. Provide your username and password. You don't need to provide anything else.
  4. Visit the join room doc. http://0.0.0.0/docs#/room/join_game_api_room___id__join__post
    1. Click Try it out
    2. Provide the room key or ID
  5. You will have joined the room

clue-less's People

Contributors

deleomike avatar kjbrooks1 avatar lreissmueller avatar

Stargazers

 avatar

Watchers

 avatar

clue-less's Issues

User Feedback In Terminal

When a user initiates the local play with

clue play

It will start the game play loop. Create a set of prompts that bring the player through dummy functions of

  1. Game Setup
  2. Game Waiting
  3. Game Play

Webpage Prompts for Suggestion

If the player is making a suggestion, the webpage prompts the user for their character and weapon choice, then displays if they guessed correctly.

Webpage Prompts Action

Webpage prompts the user for their selection of what action they want to make on their turn

Webpage Prompts for Accusation

If a player makes an accusation, the webpage prompts them for their character, weapon, and room choice, then displays if they are correct or not. If the player is correct, they will be declared victorious. If the accusation is incorrect, the player will be eliminated from the game.

Skeletal - Update Webpage and Backend

Update webpage and backend with a textbox input and “Join Game” button that allows a second through sixth player(s) to input that unique Room ID and join an existing game. (Reject more than limit).

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.