Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
August 29, 2022 02:44 am GMT

Redis Light, Green Light

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!

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)

Project Diagram

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

GitHub logo 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

Redis Light, Green Light Gameplay

Game event log built with redis streams

Redis Stream data

Architecture Overview

Project Architecture Diagram

Code Overview with cloc (count lines of code)

make clocgithub.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            528Python                           3            178            104            410Markdown                         5            139              0            272YAML                             3             10              0             83make                             1             10              2             34SVG                              2              0              0             22TypeScript                       1              1              1             22CSS                              1              4              0             18JavaScript                       1              0              1             18Text                             2              0              0             13Dockerfile                       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

Redis Light, Green Light gameplay

Redis Streams


Original Link: https://dev.to/briancaffey/redis-light-green-light-19c0

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To