Giter Site home page Giter Site logo

typetime's Introduction

Typetime

Touch typing game

The game is playable here: Typetime

Game

Typetime is a touch typing game. You'll have to type words within a time limit. The more you type correctly, the better your score will get.

You can tweak your game with modifiers and difficulties on the home page. Modifiers will have an impact on the topic of your game and difficulties will simplify or complicate it and affect score.

The launched game will display words that you'll have to type before the timer reaches 0. By default, the game is cut into levels (with time break) asking for a certain amount of words to be typed. Each level will have more, longer and unfrequent words to type in a shorter amount of time but for a better score.

If the timer reaches 0, the game will display your score and let you send it on your social media.

Project

Realisation

Typetime is a front-only web app. It's deployed on Github Pages. The word selection is done through requests on the Datamuse API which is a great ressource for generating lists of related words.

Difficulty progression

By default, on the first level, 5 words need to be type at a ratio of 30 words per minute (namely 2 seconds per words, which is pretty short). Then on level 2, 6 words need to be type at a ratio of 31 words per minute, and so on. Words also gets longer and less used in language.

Modifiers and words

The Datamuse API is a great playground with many possibilities. On the landing page, you can refresh modifiers which can give your game a topic to follow. Words of each level are based on the previous one (through phonetic or semantic) giving your game a bit of consistency. Every response coming from the Datamuse API is going through a random selection module, ensuring freshness, and is also filtered to match the level requirements.

Development

Typetime uses the Vue.js framework with Vuex. Styles are in SCSS. For development purposes, ESLint is used with custom rules, and Mocha is used with Chai for testing.

Run locally

You can clone the project and:

  • npm install to install dependencies
  • npm run devor npm start to serve with hot reload at localhost:8080
  • npm run test to test core app
  • npm run build to build for production

Components

The components part of the app is used only for display purposes. The less domain logic in here the better. The idea was to make them as little as I could. Some datas that affects game logic and rules are stored in the Vuex store. Other datas that are only used for visuals and infos follow the normal usage of Vue.js. Specific styles are scoped on the component file.

Configuration

Every variables that affects game rules are in this folder. They set default game and are used as base values during a match to compute real values according to difficulty and progression. This also simplyfies basic rule changes and therefore configuration of all the game.

Core

All domain logic is in this folder. Functions are independent from the app. The app is using it and it needs it, not the opposite. This is the core of the game, therefore it is tested to ensure behaviour consistency.

Tests

Tests are here to check if core logic follows the awaited behaviour. It's built with Mocha and Chai. It can be launched with npm run test for all tests or with the option npm run test --recursive "./test/FILENAME.test.js" to test a specific part of core. They need to be launched on every modification and a new one must be created when a new function is added in the core.

Future iterations

A project never really ends and there are topics that need handling:

  • 👩‍👧‍👧 composability: better usage of Vue.js composability, generisize and reuse possibility mindset
  • 📜 documentation: not everyone seem to be ok with absolutely no comment policy...
  • 🪲 CORS bug: handle dev & prod cookies
  • preparation - break time screen: real progress bar with a real meaning
  • testing: upgrade with mocks, testing interface in browser, relative paths
  • 🏆 endgame: more stats, balance score
  • 📨 Datamuse API: use workers for requests
  • 🇫🇷 i18n
  • ⚙️ game rules: better manipulation of configuration files
  • 📦 webpack: upgrade many dependencies starting with webpack 4

You can follow progression on the project page.


Have fun!

Typetime

typetime's People

Contributors

loanr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

typetime's Issues

Ajax call CORS error

Blocage d’une requête multiorigines (Cross-Origin Request) : la politique « Same Origin » ne permet pas de consulter la ressource distante située sur https://api.datamuse.com/words?ml=vache. Raison : l’en-tête CORS « Access-Control-Allow-Origin » ne correspond pas à « http://localhost:8080 ».

Seems 8080 is somewhere on prod...

Will require many tests and deployments...

Reorganise and spread ajax calls

Ajax calls should be done in advance except at launch (ajax during preparation screen).

Between each levels the query uses the last selected word and the query modifier if selected at game start.

Transition screen message between levels

Spinner gives you "discouragement".
"i've seen better"
"you're not exactly fast, are you?"
"I'm sure you're unable to read this phrase because blahblah"
Things like that, maybe.

Text shouldn't be under spinner.

gh-page landing empty

Strange behaviour with gh-page default url.
Simple fix would be a redirection from https://loanr.github.io/Typetime-front/ to home router link.

Style enhancements

  • word letter to type cursor blinks
  • while modifier list is being created, v-else with four empty buttons
  • stylize score screen

Game mode with accents as in `words?sp=*è*`

May be time to remake filter words.
I mean sorting by frequency feels less efficient for the user, length probably better.

Emergency word added should never be at the end of array.

There's still the case of the filter returning not any words.

Each level needs a countdown following specific rules

  • Level 1: 5 words at 30 words per minute => 2 seconds per word - 10secs
  • Level 2: 6 words at 31 words per minute => 1.935🍌 seconds per word - 11.61 secs
  • etc.

2 seconds per word... level 1 is already hard for me, kind of unplayable game... we'll see.

Remedy bad letter animation

Test lead:
Double every letter, one which shows, and animate transition between show / !show with enter/leave vuejs.

Modifiers implementation, random words, random query types, difficulty, etc.

Four random modifiers:
espagnol | random word | lexical field | rhyme | phonetic | french | ...

Four difficulties:

  • economic - keep unspent time between words (no time bonus score)
  • exponential - more and more unfrequent, long, special chars... (automatically better score, maybe more multiplier)
  • slower - start with a smaller words per minute ratio (smaller multiplier)
  • no break - no preparation time between levels (better level score multiplier)

=> modifiers are no longer 'exclusive' but can share a same value -> modifiers with same value are unchecked.

Sound implementation

  • On each good word
  • On type error
  • During countdown
  • At game over
  • during transition / game start

Ghpages deployment problem

Build done on docs folder.

Ghpage deployed search for repo_name/repo_name/static so need to change root. But when I do, get is done on [nothing]/static which is not good either because Ghpage is still on repo_name/

Need more info.

Score calculator according to letters, combo, level...

  • List of letters according to frequency and difficulty to type gives base score for each typed letter.
  • A certain number of correct typed letters gives you combo.
  • Each level adds to the combo and give you a multiplier for base score letter.
  • A typing error remove points WITH last multiplier THEN combo is reset.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.