Skip to content

DebbieBergstrom/Russian-Roulette

Repository files navigation

Russian Roulette Game

Welcome to our cheerful yet suspenseful Python game, a playful spin on Russian Roulette. Enjoy this text-based adventure, enhanced with colors and ASCII art. As you engage with this thrilling narrative, every round becomes a delightful dance with fate. Join the fun and let's see if you can outwit destiny!

amiresponsive

Please have a look at the deployed app through the link under the 'About' section in the top right corner of this repository.

 

GitHub Badge Gitpod Badge Heroku Badge Python Badge Markdown Badge


CONTENT

 


UX

Site Purpose

To engage users in a thrilling game of virtual Russian Roulette. Users can play, testing their luck and surviving the suspenseful rounds.

Site Goal

To offer a simple, entertaining and suspenseful game experience through a terminal-based text game.

Audience

Individuals who enjoy text-based games, probability, suspense, and testing their luck.

Communication

The game communicates its intent through print statements, prompting the user to choose options and make their game decisions. Different outcomes are highlighted in different colours to increase user engagement and improve readability.

Current User Goals

To keep the user engaged with the game by offering a captivating and suspenseful experience. The ability to restart the game provides the user with opportunities for endless fun and varying outcomes.

New User Goals

To learn the mechanics of the game, enjoy the suspense, and challenge their luck in the game.

Future Goals

To expand the game by implementing more fun features, please see the list of Future features further down.


User Stories

First Time Visitor Goals

  • As a first-time visitor, I want to understand the purpose of the game and the stakes at hand.
  • As a first-time visitor, I want to choose my role in the game (victim or assassin) to add a personal touch to the gameplay.
  • As a first-time visitor, I want to understand the game rules to navigate the game easily.
  • As a first-time visitor, I want to select the difficulty level (easy, medium, hard), according to my preference.
  • As a first-time visitor, I want to appreciate the storytelling with ASCII Art Visuals
  • As a first-time visitor, I want to know the result of my playing.
  • As a first-time visitor, I want to be asked if I want to play again after I'm finished or have the choice to quit.

Returning Visitor Goals

  • As a returning visitor, I want to play the game again, attempting a different role.
  • As a returning visitor, I want to play the game again, attempting a different difficulty level.
  • As a returning visitor, I want to explore different outcomes and various game results based on my choices and luck
  • As a returning visitor, I want to be asked if I want to play again after I'm finished or have the choice to quit.

 


How to use Russian Roulette Game

Press the button to start the game and test your fate. In this game, you first choose your role as either the assassin or the victim. Then, select the level of difficulty. Based on your choice, a revolver is loaded with 1, 2, or 3 bullets, and the cylinder is spun to randomize the position of the bullets. If you're the victim, you'll be forced to pull the trigger. Your fate hinges on the outcome: if the gun fires, you lose and the assassin prevails. If it doesn't, you survive and the assassin walks away. Navigate through the game by pressing the prompted keys followed by the 'Enter' key. Get ready for a fun game of luck and chance!

 


Design

The design of the game incorporates various elements to enhance the user experience and game atmosphere. Inside the terminal, colorful ASCII art has been utilized to provide visual feedback and further immerse the user in the gameplay.

In addition to the terminal, the design also extends to the surrounding environment with a background featuring a close-up of a revolver with an open cylinder. With o monochromatic palette of black, grey, and white to represent the serious and suspenseful theme of the game, the image helps to set the mood and theme of the game, in contrast to the previous plain white background.

Moreover, a header has been incorporated stating "You just entered a deadly game of Russian Roulette", serving as an intriguing introduction that instantly catches the user's attention.

Complementary colors like red and yellow are used strategically in the heading and the button that says "Test your fate".

Color Scheme

 

Bullet Favicon A Favicon with a yellow bullet was made to be displayed in the application's tab in the web browser next to the title. This makes it look more professional and it has better visibility among many open tabs or saved bookmarks, which adds to better user experience.


Program flow

FLowchart made in LucidChart displays all of the steps of the game from beginning to end. flowchart

 


Technologies used

Language

  • Python 3: Primary programming language for the project.
  • HTML5: basic structure from Code Institute Template. Code was added to change styling for this app.
  • CSS: basic structure from Code Institute Template. Code was added for styling of background, heading and button.
  • Javascript: from Code Institute Template.

Programs used

  • LucidChart to visually map out the structure and flowchart of the app.
  • Gitpod cloud-based IDE used for version control and writing code
  • Git version control system used for managing and tracking changes to the project's codebase
  • Github web-based hosting service used for version control and storing the project's code after being pushed from Gitpod
  • Heroku cloud platform used for deploying and hosting the project's web application
  • Pseudoeditor For making a structured plan of pseudocode before actual Python coding.

 


Features

Existing features

The Russian Roulette Game application currently offers the following features (press the dropdown to see image):

Landing page - Welcoming the user to the game.
Introduction to the game - followed by choice to be the victim or the assassin or see rules.
Story based on character choice displays - The storyline will from now on be different for 'victim' and 'assassin'.
Game Rules -Users can choose to see the game rules, helping newcomers to quickly understand the gameplay mechanics.
Difficulty level - allows users to select a difficulty level (easy, medium, hard), affecting the number of bullets loaded into the revolver.
Interactive Gameplay - engages users with prompts and feedback based on their choices.
ASCII Art Visuals - The game uses colored ASCII art to enhance the storytelling and to display the results of each round:
Random Outcomes displays different Game Result Messages - Every game session is unique due to the randomized position of bullets in the revolver. Upon game conclusion, users are presented with a fun ASCII art message indicating whether they have survived or not:
Replayability - The game allows for immediate replay upon conclusion, offering users another chance to test their luck. Otherwise a goodbye message displays telling the player the game ends:

 

Future Ideas

The development of Russian Roulette Game aims to provide more immersive and personalized experiences to users in the future. Here are some of the potential enhancements and features that may be implemented:

  • Expanded Story Options: Broaden the narrative by introducing more storylines or story options for users to engage with.

  • Character Personalization: Offer the option for users to name their victim character, providing a more personalized experience.

  • Contractor Selection: Allow the assassin to choose from a list of evil contractors they've been hired from, adding a new layer of depth to the game's storyline.

  • Dual Victim Mode: Introduce a mode where a second victim can play against the assassin, adding another layer of competition and suspense to the game.

  • Enhanced Story Interactions: Further develop the game's interactive elements, enabling users to make choices that have impacts on the storyline's direction and outcomes.

  • Game Progress Saving: Implement a feature to store game scores or outcomes, allowing users to track their performance.

  • Sound Effects: To enhance the immersive experience, sound effects could be added to match different events or outcomes within the game.

 


Validation

  • All string inputs are made case-insensitive with the .lower() function. This prevents users from encountering errors due to letter casing.

  • The validate_input function is used to maintain input validity at all stages. This function asks for user input until a valid input is provided, ensuring that the program doesn't break due to unexpected inputs. Valid inputs are defined as per the game requirements at each step.

  • In case of invalid inputs, an error message is displayed to the user. This message guides the user about the correct format or type of expected input, leading to a smoother user experience.

  • The slow_print and slow_input functions ensure a comfortable pace for users to read the prompts and game descriptions and provide their inputs accordingly. This prevents any rush or confusion while playing the game.

 


Testing

Testing User Stories

First Time Visitors

User Story How this was achieved Screenshot
As a first-time visitor, I want to understand the purpose of the game and the stakes at hand The application displays a welcoming message explaining the game's premise and stakes
Landing Page:
Introduction display
As a first-time visitor, I want to choose my role in the game (victim or assassin) The game prompts the user to choose their role after the introduction
Choose Role
As a first-time visitor, I want to understand the game rules The game provides an option to view the rules before starting the game
Rules displayed
As a first-time visitor, I want to select the difficulty level (easy, medium, hard) The game prompts the user to choose the difficulty level before after character story has begun
Choose difficulty Level
As a first-time visitor, I want to appreciate the storytelling with ASCII Art Visuals ASCII Art is used throughout the game to enhance the storytelling
Guns Loaded
Spinning
Cylinder Spun
Invalid Trigger Pull
Boom!
As a first-time visitor, I want to know the result of my playing The game provides a unique ASCII Art message indicating the outcome of the game
Example Victim Survived
Example Victim Died
As a first-time visitor, I want to be asked if I want to play again after I'm finished or have the choice to quit The game prompts the user to play again or not after the game ends. Restarts game if (y), displays ending message if (n)
Prompts to play again or not
Displays end message

 

Returning Visitors

User Story How this was achieved Screenshot
As a returning visitor, I want to play the game again, attempting a different role The game allows users to select a different role when replaying the game
Character choice
As a returning visitor, I want to play the game again, attempting a different difficulty level The game allows users to select a different difficulty level when replaying the game
Example
As a returning visitor, I want to explore different outcomes and various game results based on my choices and luck The game outcomes are determined by the randomized position of bullets, and throughout the game unique ASCII Art messages are displayed for different outcomes, enhancing the narrative exploration
Example Victim Survived
Example Victim Died
As a returning visitor, I want to be asked if I want to play again after I'm finished or have the choice to quit The game prompts the user to play again or not after the game ends
Prompts to play again or not
Displays end message

 

Automated Testing

The * PEP8 CI Python Linter validator was used to validate all Python modules in this project. Press the dropdown to see image.

  • The run.py file was validated without any errors:

    See the validation results
  • The all_functions.py file was validated without any errors except for some necessary white spaces needed within the 'spinning' ASCII art string:

    See the validation results
  • The ascii.py file was validated with errors only relating to necessary white spaces and indentation needed within all the ASCII art strings:

    See the validation results

 

Manual Testing

Family and friends tested my game application on their devices and no issues were reported.

TEST ACTION EXPECTATION RESULT
get_character_choice() Input (v) for 'victim', (a) for 'assassin', or (r) for 'rules' Game character is selected or rules are displayed All three works as expected
get_character_choice() Input invalid choice (anything other than (v), (a), or (r)) Error message displays: "Only the provided options are valid. Choose one of them." Works as expected
get_difficulty_level() Input difficulty level ('low'(1), 'medium'(2), 'high'(3)) Difficulty level is set according to input All three works as expected
get_difficulty_level() Input invalid difficulty level (anything other than (1), (2), (3)) Error message displays: "Only the provided options are valid. Choose one of them." Works as expected
ask_spin_cylinder() Input (s) to 'spin' Function indicating cylinder is spinning is executed Works as expected
ask_spin_cylinder() Input anything other than (s) to 'spin' Error message displays: "Only (s) is valid. There's no turning back..." Works as expected
ask_pull_trigger() Input 'enter' to Pull the trigger Function indicating the trigger is pulled is executed Works as expected
ask_pull_trigger() Input anything other than 'pull' Error message displays: "Don't extend the suffering. Press only (enter)" Works as expected
ask_play_now_or_quit() Input 'Yes'(Y) to question if player want to play now Game goes back to where it started if 'Y' is pressed Works as expected
ask_play_now_or_quit() Input 'No'(N) to question if player want to play now Game ends and displays message: "Welcome back! Game ends..." Works as expected
ask_play_now_or_quit() Input anything other than 'Yes'(Y) or 'No'(N) Error message displays: "Only the provided options are valid. Choose one of them." Works as expected
ask_play_again_or_quit() Input 'Yes'(Y) to question if player want to play again Game starts/continues or exits based on the input Works as expected
ask_play_again_or_quit() Input 'No'(N) to question if player want to play again Game ends and displays message: "Nuff action for today, huh. See you next time! Game ends..." Works as expected
ask_play_again_or_quit() Input anything other than 'Y' or 'N' Error message displays: "Only the provided options are valid. Choose one of them." Works as expected

 


Bugs

Bug Fix
1. The first line of the multiline string is not aligned with the rest that gets indented. Concatenate string by string wrapped in "" with a "+" at the end and avery new string beginning with "n"
2. Validation and error message didn't work on the play_now/play_again inputs. Fixed by using the correct validate_input function
3. Validation error message kept being displayed even if prompted key 'enter' was pressed. Fixed by setting en empty string [''] instead of [enter].

 

Unfixed Bugs

Bug Possible solution
1. When player has chosen difficulty level and the viewport of the screen in the terminal gets 'cleared' (previously content isn't visible any longer in case player dosn't scroll up), if player scroll up you see that the previously displayed ascii 'syringe' is cut in half I deleted all the "os.system('clear')" out of the code, but when the game runs it gets all run from top to bottom without any effect of cleared viewport window and it does not look good and takes away some of the suspense that is built up through choices made through the story. Therefore this is left unfixed since it's not meant to scroll up anyway and the 'clear' function adds more to the game than if its not executed.

 


Deployment

To deploy this project, these steps was followed:

  1. Fork and clone this repository to your local machine.
  2. Create a new Heroku app.
  3. In the Heroku dashboard, navigate to the app's settings and set the buildpacks to Python and NodeJS in that order.
  4. Connect your Heroku app to the repository by linking it to your forked copy of the repository.
  5. Click on the "Deploy" button in the Heroku dashboard.

After following these steps, the app is successfully deployed to Heroku.

 


Media

 


Credits

Here's a collection of sites that were helpful in creating this website:

  • WC3Shools Explaining input function

  • WC3Shools Explaining while loops

  • GeeksforGeeks Explaining clear screen and sleep import

  • GeeksforGeeks Explaining delayed printing

  • Youtube First tutorial russian roulette game

  • Youtube Second tutorial russian roulette game

  • Youtube Third tutorial russian roulette game

  • PsuedoEditor To create pseudocode to help structure the app

  • Termocolor To create colored text output

  • ChatGPT To create some of the story content

  • Code Institute, Python learning material.


Acknowledgments

I'd like to give recognition to the ones who have supported me in finishing this project:

  • Lauren_Nicole, my Code Institute Mentor. I cannot thank her enough for her invaluable guidance and assistance.

  • Sandra B and Kim B, my dear siblings who are with me on this coding journey and who are both great critics and support pillars.

  • Code Institute and their helpfull staff, especially within our great Slack community.

Back to top