Skip to content

pemmyz/LockKeyReaction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🔒 LockKeyReaction

LockKeyReaction is a reflex-testing game that uses your keyboard’s lock LEDs (Caps Lock, Num Lock, Scroll Lock) as visual prompts! Hit the correct key in time, and the game speeds up — miss it, and you'll have to keep up!

Originally designed for GNU/Linux using xdotool and xset, this version also includes on-screen status lights so it should work on Windows (currently not supported) and non-LED setups too. ⌨️✨

A javascript version of this (does not support lock keys): js_lockkeyreaction Play it now: https://pemmyz.github.io/js_lockkeyreaction/


Screenshots

Game

Game 1

🧠 Idea Behind the Game

This game started as a fun way to test reflexes using actual keyboard LED lights. It evolved into a fully-featured Python + Pygame application with real-time stats and cross-platform (Windows currently not supported) support.

This idea is probably as old as the first keyboards that came with lock key lights — and the ability to programmatically toggle them. I wasn’t the first person to come up with this idea — and the person I originally heard it from probably wasn’t the first either. This is just my take on a fun concept that’s been floating around in different forms.


🎮 Gameplay

  • LEDs will light up randomly (or status prompts will appear).
  • You must press the correct key before the time runs out:
    • Num Lock → ← Left arrow
    • Caps Lock → ↓ Down arrow
    • Scroll Lock → → Right arrow
  • The game gets faster the better you do!
  • View real-time stats like:
    • Accuracy, reaction times, streaks, median, percentiles, and more.

📊 Stats Tracked

  • Fastest / Slowest / Average reaction time
  • Median, Standard Deviation
  • 25th and 75th Percentiles
  • Missed prompts
  • Accuracy & Prompt ratio
  • Current and longest streaks
  • Total game time & unpaused time

🛠️ Requirements

GNU/Linux:

  • Python 3
  • Pygame
  • xdotool
  • xset

Install requirements:

bash
sudo apt install xdotool
pip install pygame 

🚀 Run It

python lockkeyreactionmain.py

To be added

Adjust the logic, make it so that the reactiontime balances around players ability to hit keys, too slow and game will slow down and too fast and game will pick up the pace. And depending on the players ability to hit correct key in time will give scores and game will have different durations games and highscore list. Adjust the game so it will work on other operating systems like Windows. Now there might be things coded that are not crossplatform.

🧠 Game Logic Update Plan

  • The game will adapt its reaction time dynamically based on the player's key press performance:
    • If the player consistently presses keys too slowly, the game will slow down to stay challenging but fair.
    • If the player hits keys very quickly and accurately, the game will speed up to increase the difficulty.

🎯 Scoring System

  • Score will be based on:
    • Hitting the correct key in time.
    • Reaction accuracy (how fast you hit the key after prompt).
  • Missed or incorrect keys will reduce the score or combo.

⏱️ Game Duration & Variants

  • Multiple game duration options (e.g., 30s, 60s, endless mode).
  • The high score list will reflect top performances based on selected durations.

🌐 Cross-Platform Compatibility

  • Adjustments will be made to ensure full support on Windows, Linux, and macOS.
  • Code will be refactored to remove or replace platform-specific functionality with cross-platform alternatives:
    • Avoid hardcoded paths or OS-specific calls.
    • Use standard Python libraries and OS-independent file handling where possible.

💾 Highscore System

  • Persistent highscore list stored in a simple JSON or text file.
  • Optionally support per-duration leaderboards.

🚧 TODO

  • Implement dynamic reaction time scaling.
  • Add scoring and combo system.
  • Build game duration options.
  • Implement cross-platform input handling.
  • Create and store highscore lists.
  • Add multiple leds on at same time.

🤖 AI Assistance Disclaimer

This game was created with the assistance of AI tools (e.g., ChatGPT) for various tasks such as:

  • Code suggestions and debugging
  • Design ideas and architectural guidance
  • Problem-solving and refactoring help
  • Occasional motivational pep talks

While AI provided helpful input during development, all decisions, edits, and final implementations were made by a human (yes, really).
Think of it as pair programming… with a very talkative robot.

Stay tuned for updates!

About

A reflex-based mini-game for GNU/Linux that uses your keyboard’s lock key LEDs (Caps Lock, Num Lock, Scroll Lock) as prompts! Press the right key in time to keep up as the game gets faster.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages