Overview of My Submission
I recreated the game "Red Light, Green Light" using Python, TypeScript and Redis!
One day in early August I was browsing DEV while re-watching MrBeast's Squid Game recreation video in the background when I came across the Redis Hackathon article. Then I got a crazy, random idea: Redis Light, Green Light!
I became determined to create my own online, real-time, multi-player version of Red Light, Green Light powered by Redis and submit it to the Wacky Wildcard project category for my chance to win the hackathon!
I used my favorite languages and frameworks for rapid prototyping: Python with Flask to power the backend and TypeScript with the Nuxt.js framework to build the frontend components for my game.
For real-time communication I added the Flask-SocketIO
library to my Flask app and the socket.io-client
library to my Nuxt app. I also added celery for scheduling and processing async tasks. Redis was used as the message queue for websocket messages and it was also used as the broker for celery tasks.
This was my first project working with Redis Stack and Redis OM and I really liked using these tools. I stored most of my data in hashes, and the Redis OM library is perfect for using this data type. I also used Redis streams for the first time which was a lot of fun.
The backend application services include:
- Flask server (for API endpoints and Websocket handlers)
- Celery beat task scheduler (for scheduling tasks to change the light color in each room)
- Celery worker (to change the light color for a room and to update that players in that room via Websocket)
Please check out the video below for more details about how the project works.
Submission Category
Wacky Wildcards
Redis Light, Green Light YouTube Video
Language Used
Python. Honorable mention for JavaScript.
Link to Code
briancaffey / redis-light-green-light-dev-to-hackathon
My submission for the Redis Hackathon on DEV! "Red Light, Green Light" built with Python, JavaScript and Redis
Redis Light, Green Light
This project is an online, multiplayer implementation of "Red Light, Green Light" from Squid Game built with Python, Javascript and Redis. This is my submission for the 2022 Redis Hackathon on DEV!
Gameplay
Game event log built with redis streams
Architecture Overview
Code Overview with cloc
(count lines of code)
make cloc
github.com/AlDanial/cloc v 1.94 T=0.03 s (1102.7 files/s, 67098.7 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Vuejs Component 13 104 14 528
Python 3 178 104 410
Markdown 5 139 0 272
YAML 3 10 0 83
make 1 10 2 34
SVG 2 0 0 22
TypeScript 1 1 1 22
CSS 1 4 0 18
JavaScript 1 0 1 18
Text 2 0 0 13
Dockerfile 1 8 0 12
-------------------------------------------------------------------------------
SUM: 33 454 122 1432
-------------------------------------------------------------------------------
Overview video
Here's a short video that explains the project and how it usesβ¦
Additional Resources / Info
- Check out Redis OM, client libraries for working with Redis as a multi-model database.
- Use RedisInsight to visualize your data in Redis.
- Sign up for a free Redis database.
Top comments (1)
I personally would build this using react javascript frontend and node.js backend with express and socket.io. Is the project hosted somewhere?
Some comments may only be visible to logged-in visitors. Sign in to view all comments.