A tour to Git Commit Showcases

vikaspandey121

Vikas Kumar

Posted on May 2, 2020

A tour to Git Commit Showcases

Never-Blink

1. šŸŽ‰ Introduction

Randomly connect to a player around the world and challenge him/her. Remember not to blink!

2. šŸ“œ Implementation

1. Project structure

.
ā”œā”€ā”€ backend
ā”‚   ā”œā”€ā”€ __init__.py
ā”‚   ā”œā”€ā”€ detect.py
ā”‚   ā””ā”€ā”€ shape_predictor_68_face_landmarks.dat (detect model)
ā”œā”€ā”€ package.json
ā”œā”€ā”€ requirements.txt
ā”œā”€ā”€ server.py
ā”œā”€ā”€ src
ā”‚   ā”œā”€ā”€ app.jsx
ā”‚   ā”œā”€ā”€ index.js
ā”‚   ā”œā”€ā”€ play.jsx
ā”‚   ā””ā”€ā”€ start.jsx
ā”œā”€ā”€ static
ā”‚   ā””ā”€ā”€ bundle.js
ā”œā”€ā”€ templates
ā”‚   ā””ā”€ā”€ index.html
ā””ā”€ā”€ webpack.config.js

The project uses react as our frontend framework, and uses peerjs to communicate between clients. At the backend, we use flask to host the server. For the connection between clients and server, we use socketio to implement real-time data transfer.

2. Game State

It uses the notion of Finite State Machine to design our game state. The circle is the state. The text in the top of each box is the event causing state transition, and the text in the bottom of each box is the action taken when an event occurs. The logic looks quite simple here, but it is not that easy to implement. For more detail you can check play.jsx or server.py.

  1. Start and Enjoy

Go to https://0.0.0.0:3000

0.0.0.0:3000 does not work, remember to add https.

4. šŸš§ Problem

  1. Because the detector is too slow and weak, we can not endure too many clients. Therefore, we do not deploy it to a public server now. We plan to train a robust and fast model in the future.
  2. When restarting, the old media connection listener will be called again. So we remove restart temporarily.

5. šŸ“– Reference

  1. Environment setup: https://github.com/rwieruch/minimal-react-webpack-babel-setup
  2. Simple P2P WebRTC package: https://github.com/peers/peerjs
  3. Socket-io: https://socket.io/docs/client-api/
  4. Flask-socketio: https://flask-socketio.readthedocs.io/en/latest/
  5. Blink detector: https://github.com/dilawar/eye-blink-detector
  6. Material UI: https://material-ui.com/

To know even more interesting showcases

go to https://medium.com/@VikasPandey121/a-tour-to-git-commit-show-56d37e6afc03

To join Git Commit Show 2020 visit http://gitcommit.show/

šŸ’– šŸ’Ŗ šŸ™… šŸš©
vikaspandey121
Vikas Kumar

Posted on May 2, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related