Redlight Greenlight Game

overview

For this project I created the computer vision system and the interactive game mechanics for redlight greenlight. To develop this game into a project, I chose to replace the role of the seeker with a robot. This robot would watch the players, call out the redlight/greenlight phases, eliminate players, and keep score with no assistance from humans.

Game Mechanics

Redlight Greenlight is the kids game where a seeker player tries to catch the other players moving while they try to cross a field. When the seeker calls "greenlight", the seeker covers their eyes while the other players are able to move across the field to reach the other side. Once the seeker calls "redlight", they uncover their eyes and the other players must freeze in place to not get caught moving by the seeker. If a player is caught moving during the redlight phase, they are eliminated from the game by the seeker.

In my project, the players would start at a distance from the robot and try to get close to the robot without being eliminated. If they are caught moving during the wrong phase, they would lose one of three lives. The game would end when the players lose all lives or they reach the robot.

Computer Vision

I used the python libraries OpenCV, ROS, and pyrealsense2 to create the image processing pipeline for tracking the players. I used color recognition to identify the contours of the players and track their movements. Movement detection was determined by a change in position of the centroid of the contoured area beyond a certain threshold. The player's distance from the goal was detected by utilizing the Intel Realsense D435i's depth perception camera.

Integration

To combine the computer vision and game algorithm together, I used the ROS python package. I made a node to manage the image pipeline and send the data to another node that manages the game mechanics and score. The game node would use state machines and timers to manage the game phases and data triggers to keep track of the score. There is an additional node to manage the sound ques to prevent process halting issues.

Video Presentation

Player Elimination

Full Game