/Painterino-v2

A multiuser sketching game where one user draws a word and other players in the room try to guess what it is!

Primary LanguageTypeScriptApache License 2.0Apache-2.0

Painterino Version 2

A multiuser sketching game where one user draws a word and other players in the room try to guess what it is!

Some Screenshots

How to Play

  • You have to sign up to play.
  • You can create rooms containing minimum 2 and maximum 10 people.
  • One player draws a random word shown on the screen and the others try to guess what it is!
  • Round does not complete until all player have guessed or the time is up.
  • After 10 rounds a score board is shown and the game is over!

Disclaimer

This project is made for learning purposes.

Prerequisites

What things you need to install

The backend (api) and the frontend (frontend) are splitted and must be installed accordingly.

NodeJS v10.4.0
Angular CLI 6.0.8 is recommended
MongoDB 3.6.6 NoSQL database server.
Compatible IDE, Visual Studio Code is recommended for this project.

Installing

You have to create a config.json file with this format
{
  "dev": {
    "PORT": 3000,
    "MONGODB_URI": "mongodb://yourdatabaseurl",
    "JWT_SECRET": "yourjwtsecret"
  },
  "production": {
    "PORT": 3000,
    "MONGODB_URI": "mongodb://yourdatabaseurl",
    "JWT_SECRET": "yourjwtsecret"
  },
  "test": {
    "PORT": 3000,
    "MONGODB_URI": "mongodb://yourdatabaseurl",
    "JWT_SECRET": "yourjwtsecret"
  }
}

Note: If your server provider wants to use its own port, you should remove the port field in your config.json file.

Database

This application uses NoSQL database MongoDB and a Schema library mongoose. Mongoose script is below.

const Schema = mongoose.Schema;
const userSchema = new Schema({
    email: {
        type: String,
        required: true,
        minlength: 1,
        trim: true,
        unique: true,
        validate: {
            validator: (value) => {
                const re = /^[a-zA-Z0-9_!#$%&’*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+$/;
                return (value == null || value.trim().length < 1) || re.test(value);
            },
            message: '{VALUE} is not a valid email'
        }
    },
    username: {
        type: String,
        required: true,
        minlength: 1,
        trim: true,
        unique: true
    },
    password: {
        type: String,
        required: true,
        minlength: 6,
    },
    tokens: [{
        access: {
            type: String,
            required: true
        },
        token: {
            type: String,
            required: true
        }
    }]
});

const Schema = mongoose.Schema;
const wordSchema = new Schema({
    key: {
        type: String,
        required: true,
        minlength: 1,
        trim: true,
        unique: true,
    }
});

For more details please visit the model folder in the api section.

Built With

For more information please visit api/package.json and frontend/package.json files.

Known Bugs

  • When the last drawing player disconnects while drawing the turn do not switch.
  • The chat window does not scroll properly when a new message arrives.
  • If you lose the connection with the server in the middle of the game it bugs out and you have to refresh.
  • Some UI bugs in mobile.

Contributing

If you want to contribute to this project you can e-mail me - antkaynak1@gmail.com or you can pull request.

Versioning

This project uses git as its version control system.

Authors

  • Ant Kaynak - Initial work - Github

License

This project is licensed under the Apache License - see the LICENSE.md file for details.

Questions

If you have any questions mail me at antkaynak1@gmail.com