datsite

Membash

Work in progress Please note: this page is currently under heavy construction. It is not finished yet but should be soon enough!

What is Membash ?

Membash is a command-line bash game that puts your memory to the test!

This game will help you memorize a lot of things, from capitals, to American presidents, to NATO alphabet.

Customization

Given its highly customizable nature, you can create your very own sets of questions and even take control of the whole game.

You can then create and share your own packages to the world!

Requirements

A system running Bash 4 (Bash 3 untested)

Author

Membash was written by Lucien Le Roux.

Setup

Once you've downloaded the game, unzip it to the location of your choice.

You may want to run game-config.sh to make sure you're using the desired settings.

Functioning

Each time you start a game, a quiz file is loaded. It contains a set of questions and answers. Its syntax will be explained further on.

The game will loop through every question. At each iteration, you have to enter what you believe is the corresponding correct answer.

Note: Multiple answers can be accepted for one question.

To spice things up, you have at your disposal a given number of lives.

If the answer you provided is correct, the game goes on. You earn a new life after 3 correct answers in a row!

The game ends when your life count hits zero.

Every game is stored in a score file to keep track of your progress.

Customize the game

There are a lot of things you can customize to your liking:

  • Custom prompt
  • Custom messages
  • Number of lives to start with
  • Time trial mode
  • Default quiz to play
  • Nickname

These customization options can be exported as a package.

Packages

Description

A package consists of two files brought together in a folder. These two files are:

  • strings.sh
  • vars.sh

The package that is currently used is defined in config.sh. You can either modify it by hand, or by running game-config.sh.

Create your own

Start off based on the default package (this one should stay untouched. If needed, you can download the latest version in the 'Packages' tab). Since a nice example is far better than a long explanation, let's create a simple 'my-package'.

First, let's get into the packages directory:

$ cd values

We want our package to be based on the 'default' one.

$ cp -r default my-package

Now, let's get into the first of the two files : strings.sh. Do that with the editor of your choice. The file content should resemble the following:

WELCOME="Welcome! You are playing: \f.\n\
Good luck!"

# Prompt displayed at each iteration.
PROMPT="(\q/\T - \r+\b) [\l lives] \h <-> "

GOOD_ANSW="Good answer! (\e)"
WRNG_ANSW="Wrong answer! Expected '\e', got '\i'."
TIMEOUT="Time out! The answer was: '\e'"
EXTR_LIFE="3 good answers in a row: bonus life!"

COMMENT_0="Too bad!"
COMMENT_1="Not bad!"
COMMENT_2="Good!"
COMMENT_3="Excellent!"
COMMENT_4="Congratulations, you are unbeatable!!!"

END="Game ended. Score: \s/\q. (\S %)"
GOODBYE="Longest streak: \b good answers in a row. Saving to '\L'"
EXIT="Press any key to exit."

As you can see, this files contains all the strings used within the game. From here, we can modify any string we want. To know exactly when each string is used, you can look up the Variables reference section.

Let's say I want to change the message displayed when the player entered a wrong answer. All I have to to is redefine the variable WRNG_ANSW:

WRNG_ANWS="What the heck! The answer was '\e', I thought you knew that!"

Now I want to change my prompt to a more minimalistic one.

PROMPT="[\q] \h > "

That's it! My strings are just like I want them. We're done with this file, so let's move on to the next one, aka vars.sh

LIVES=3

TIMER=0

PKG_VERSION=0.2

# Username that will be used
USER=${USER:-$(whoami >/dev/null)}

This time, the file contains less variables. If I want to spawn the player with 5 lives instead of 3, but enable a countdown, I have to make these changes:

LIVES=5
TIMER=15

Now that I'm done, my package is complete and I can use it to play. Let's configure our game to do so.

$ cd ..
$ ./game-config.sh -p my-package

After you run this command, press 'y', and the new default package will be 'my-package'.

Congratulations! You just created your package with your own settings. You can share it, but first you have to archive it (tar.gz format). You can even upload it here if you want to.

Useful links

Variables reference : A list of variables and what they do. Essential to create your own package.

Download

Please note: the game is currently under heavy construction. Expect bugs and/or other problems.

For reference, current version of the game is: 0.5.1

Connection failed : SQLSTATE[HY000] [2002] No such file or directory