Skip to content

jazzsequence/question-game

Repository files navigation

Question Game

GitHub Release GitHub License

A simple game framework written in PHP with escallating challenge levels

Description

Did you ever want to write your own game? Now you can!

This project is a very basic game framework that works best as a "Truth or Dare" or "Simon Says" sort of game, where the players take turns performing an action or answering a question. No answers are stored anywhere in the game (so it works better for games that don't have specific answers or where the goal is conversation starting rather than a "pub quiz"-style trivia game) and no database is used at all.

Turn tracking is currently done using cookie data. In a future iteration, I may try to use browser local storage to store turn information, but this is a proof-of-concept.

Your game content (questions/actions/etc.) is stored in custom .json files stored in the /data directory. See the readme.md file in that directory for more information about setting up your own game.

Installation Requirements

The easiest way to play the game is to use Lando to set up a simple web environment on which to run it. A .lando.yml file has been provided to facilitate setting up the environment. Simply run lando start in the root project directory to start the game.

You will also need to install jq if you want to use the helper script to generate your game data files. This can be installed via Homebrew as described below.

Alternately you can use a different virtual machine environment like Vagrant, your own Docker box, using a platform like WAMP/MAMP or local LAMP stack. The game is written in PHP, so it won't work without some server that's able to serve PHP files in a browser.

Generating Game Data Files

A script has been provided to help you generate your game data. It will create the manifest.json file based on a series of prompts that ask the names of the levels you want your game to have and how many questions each level will require. It will then create empty JSON files for your questions to go. It will not add your questions for you, but those should be easy to handle yourself (see the readme for more information).

To run the script, in a terminal window run:

composer setup-files

You can remove generated files you don't want by running composer clean-files.

A file validator has been added as well to ensure your files are formatted correctly. You can run this with composer validate-files.

If you're running any of these JSON file manipulation scripts, you're going to need to install jq on your local machine to parse the JSON. This can be installed on a Mac via Homebrew:

brew install jq

External Libraries

This project uses a fork of the nes.css library for a retro game visual design. Additionally, it uses jq to parse JSON data which is used by the helper script to generate data files.

The following developer libraries are included via Composer or NPM for development:

Ideas for the future

The following are some ideas I have that could be implemented in future iterations:

  • Use browser local storage or NoSQL to store data instead of cookies.
  • Allow json files to be uploaded and parsed to create the game data.
  • Create a game-builder interface where the files can be created and edited in the browser.
  • Allow multiple games to be installed simultaneously (multiple manifests).
  • Add comprehensive unit testing!
  • Add autotag action.
  • Run entirely in the browser!

About

A simple game framework with escallating challenge levels

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages