Making with Code

Unit 02 Games Story Project #

๐ŸŽจ Design Prompt: You will create a text-based game inspired by a real piece of media or your own life.

๐Ÿ’ป Your game must include one unique feature. For example:

  • variable messaging in the story associated with user actions
    • e.g. “you have visited this store 5 times”
  • branches that come back together into the same Node
  • Nodes that can go back to a previous Node
  • a Player() class with unique properties
    • e.g. hunger, money, or health
  • add to Node() and/or Story() to gives items
    • e.g. a locked door where you need to first collect the key in a certain room.

It is totally up to you what type of story you make. For example you could make:

  • choose your own adventure game
  • exploration game
  • puzzle game
  • narrative story game

Zork is often noted as one of the best video games of all time.

“What Zork seemed to contribute more than anything was the idea that the computer could simulate a rich virtual environment” - Matt Barton


[0] Planning Document #

This is a big project with a lot of room for customization. You will need to:

  • outline your story in a graph diagram
  • plan the implementation of an additional feature

It is important for you to plan the game prior to coding.

โœ๏ธ Plan your game prior to coding in your Google Doc: Unit 02: Games - Story Project Planning Document. Check with a teacher before moving on to the code.

Some idea for features:

  • player health
  • adding enemies

[1] Set Up #

๐ŸŒ Github Repo: github.com/Making-with-Code/project_game_story

๐Ÿ’ป Enter the Poetry shell and install the requirements:
poetry shell
poetry install

This repo includes the following files:

  • game.py when this program runs, it should launch your game
  • view.py
  • story_setup.py
  • story.py
  • node.py
  • README.md - a brief description of your game

[2] Assessment #

โœ… This project will be assessed on the following criteria:

  • Planning [3]
    • I can consider the components of my game before coding
    • I can create a graph diagram to outline the branches of my story
    • I can plan how to implement a new feature
  • Iterative Development [3]
    • I can track the development of my project by successfully committing to Github a minimum of each class work day, preferably after each work session
    • I can write descriptive commit messages that accurately describe the changes made
    • I can systematically break down my project into smaller chunks
  • Readability [3]
    • I can write easily understandable code (another CS student could understand it)
    • I can use descriptive names for modules, variables, classes, and methods
    • I can write descriptive comments to describe complex pieces of the code
    • I included a short description of my game in README.md
  • Feature Implementation [3]
    • I can edit or add the necessary class(es) with appropriate properties and/or methods
    • I can add a feature that is well abstracted
      • could be used in multiple situations
      • could be easily adapted by another CS student
  • Game Implementation [3]
    • I can properly implement my graph diagram
    • I can design a View that is easily to read and understand

For each criteria you will be assessed on a score from 0-3. With 5 criteria, there is a total of 15 potential points.

  • 0 - no evidence of the practice
  • 1 - limited evidence of the practice
  • 2 - adequate evidence of the practice
  • 3 - substantial evidence of the practice

[3] Deliverables #

โšกโœจ

  • A Unit 02 Games Project: Planning Document
  • A project-game-story repository will include some if not all the following files:
    • game.py
    • view.py
    • story_setup.py
    • story.py
    • node.py
    • README.md - a brief description of your game

๐Ÿ’ป Push your work to Github:

  • git status
  • git add game.py
    • you can add all of the changed files with: git add -A
  • git status
  • git commit -m "your message goes here"
    • be sure to customize this message, do not copy and paste this line
  • git push


[4] Resources #

๐Ÿ‘พ If you need inspiration, explore these narrative games. As you play, consider the different genres and what’s possible with this structure.


โœ๏ธ AI Tools. If you need help writing the text, feel free to use an AI service. Just be sure to cite your transcript in the Planning Doc.


๐Ÿ‘€ Readability. Here are a few resources that may help improve readability.


๐Ÿ”‰ Play Sound. If you are interested in including sounds in your game, follow along with these steps.

(0) Install the playsound library: pip3 install playsound

(1) Add a sound file to your repository. e.g. .mp3, .m4a, .wav file.

If will have multiple sounds, be sure to consider how you will organize your repostiory.

(2) Incorporate the sound into your game. If this is your feature, I highly planning how you will incorporate this into the Node(), Story() and/or game.py.

from playsound import playsound

playsound('test_sound.m4a')

๐ŸŒ„ Open Image. If you are interested in including images in your game, follow along with these steps. It will open the image in your computer’s default image viewer (e.g. Preview).

(0) Install the playsound library: poetry add pil

(1) Add a image file to your repository. e.g. .png, .jpg file

If will have multiple images, be sure to consider how you will organize your repostiory.

(2) Incorporate the image into your game. If this is your feature, I highly planning how you will incorporate this into the Node(), Story() and/or game.py.

from PIL import Image

image1 = Image.open(r"test_img.png") 
image1.show()

๐ŸŒ„ ASCII Art. ASCII Art is low-fi art that will print directly in the Terminal. For example…

 |\    o
    |  \    o
|\ /    .\ o
| |       (
|/ \     /
    |  /
     |/

๐Ÿ’ป The code for this looks like:

print("""\
     |\    o
    |  \    o
|\ /    .\ o
| |       (
|/ \     /
    |  /
     |/
""")

Note the """\ at the start and the """ and the end of the print statement

๐ŸŒ Here are a few links to find and create your own ascii art. Just be sure to site what you use in your README.md