A desire to experiment with web technologies, as well as some new languages we were not familiar with. We based the concept off games like slither.io, and decided to see how far we could get in 36 hours with no prior experience with any of the major tools used.
What it does
A broswer based multiplayer snake game, where an unlimited number of players have joint control over two snakes.
When either snake dies the game instantly resets and keeps running.
How I built it
The web server is written in c++ using the boost::beast library to manage websockets, able to dynamically open and close near unlimited simultaneous connections without problem. The main game engine is also written in c++, with a main game loop running in it's own thread for as long as the server is active.
The server is running in docker on a google cloud ubuntu virtual machine. This is at ip 220.127.116.11
We set up a website, www.competitivesnek.dk, to forward to the ip of the server, but the dns registration process apparently takes several hours longer than we expected, so it might not be online yet.
Challenges I ran into
For me (adam) this was the first time working with any of the tools.
This meant that things went wrong a lot. It took about 12 hours for us to get our web server working at all, as the boost::beast library is very complex for language beginners and designed for massively scalable servers, and serves as the backend for huge games like slither.io and agar.io. Special thanks to the wizards who helped a lot with various issues.
The c++ code was also completely new to me, and i spent many hours on strange bugs, such as 90 minutes saturday evening trying to work out why std::string str = x + "," + y (with x and y as ints) was printing variable sections of the c++ source library to my server.
Accomplishments that I'm proud of
There were several points which were very satisfying. Getting the initial snake game working, after a day of experimentation, was a high point.
Then getting the main game thread loop running, after a several hours of experimentation and wizard help, with an anonymous lambda declaration allowing us to call our non static game loop into a new thread.
Finally the progress made in the last 6 hours, once the game loop and server were set up, and I was starting to get comfortable with c++ syntax, where death, food spawns, the second snake, basic movement interpolation and a whole host of other features were very quickly and easily added.
What I learned
What's next for Snek
The goals which I didn't have time for were mainly giving each client control over their own snake, and maybe making game size variable based off number of players.
As the server should support up to hundreds of players, with a bit of refactoring of game.cpp to spin the snake object off into it's own class, then store a list of snakes to iterate over, this should be very easily scalable.