NOTE: This project was completed by me as part of my learnings at Lighthouse Labs, with targeted learning outcomes. In-scope concepts include the creation of TCP clients using Node's built-in net module; as well as callbacks, asynchronous control flow, modules in Node, writing modular code, refactoring code, working with stdin.
The Snake Game is a very popular video game concept where the player maneuvers a dot and grows it by ‘eating’ pieces of food. As it moves and eats, it grows and the growing snake becomes an obstacle to smooth maneuvers. The goal is to grow it to become as big as possible without bumping into the side walls, or bumping into itself, upon which it dies.
This is simply a multiplayer take on the genre.
Before you can run this client, you will need to be running the server side which you can download and install from here.
- Follow steps inside the snek server repo to set up the server side. Upon installation, run the server with the command
npm run play. - Clone this Client repository, cd into the cloned folder and use the
node play.jscommand to start playing!. Specify the initials of the playerfor each instance of the client as a command line input after entering thenode play.jscommand.
Use the following keyboard commands to control the snake:
w- move up one square (unless facing down)
a- move down one square (unless facing up)
s- move left one square (unless facing right)
d- move right one square (unless facing left)
Use keyboard inputs x, y, z and c to pass fun comments on-screen. Find out what the snake has to ssssay! 🙂
Credit to Lighthouse Labs for providing a rich platform that offered needed guidance in the course of this project.
With time, further development may be undertaken to enrich the multi-user features of this application.
This project is open source and available under the MIT license.
