MultiSnake

Welcome to MultiSnake

What is MultiSnake?

MultiSnake is an incredibly easy to play multiplayer snake game. Programmed in node.js, HTML, CSS, and Javascript with Replit, you can join different rooms and play different mods. Use WASD or the arrow keys to move around the map, and the space bar to use your boost

MultiSnake is the worlds first multiplayer snake. MultiSnake is not a knock-off like slither.io, or powerline.io, but it is truly, at it's core, a snake game. There is only ever one apple on the map, and players have to race to get to it. Of course, classic snake is not enough, so we added a couple twists:

Because MultiSnake is a multiplayer game, there are a lot of strategies that one can use. Here are a couple good ones that will never fail you, and a couple advanced ones for the serious gamer. Here are some good general guidelines:

How to play different game modes

Game Credits

Thanks to @Coder100 for helping with bugs back in beta. Thank you to @PYer for coming up with ideas for mods. Thank you to @ch1ck3n for helping with speed of the game. Thank you to @rickysong and @Redman for helping with testing. Lastly, thank you to the entire discord community for the support and helping to find bugs!

Why was MultiSnake made?

A message from the creator

I have been programming computers for 5 years, as of writing this. It was really a challenge for me, as I wanted to create a game without using HTML canvas or any game engines. (The real reason for this is because I wanted to not have to figure out a whole new thing). I had my javascript methods, my logic, and the skill that comes with 5 years of coding. This originally started off as a single player snake game, where you run around and avoid monsters that try and eat you.

I had already made a chatroom, and I thought "what if I put into practice what I learned from that project, and use it to make a multiplayer game?". So I did. After hours of reading tutorials later, I had a nice stream of data set up. My client could communicate with the server, the server could respond. I did not have to mess around to much initially with the front end, as I copied and pasted the game set up from that first snake game.

A thousand lines of code later, I had a horribly styled homepage, and a fully working multiplayer game framework. Player picked their usernames and the room that they wanted to join, and they were in. They could play around, and that was it.

There was one problem. The game was slow. I spent long hours trying to figure out how to fix it, and then it came upon me. In the code, I had a function that was called every 100ms. That's 10 times a second. Not very fast, but coupled with the fact that I was looping through an array of 10K per room in every function called, and this with the fact that I had 4 logic functions, I was looping through ~40K times every 100ms. That is a lot to be done in 100ms. And not only that, but I then had to send it over to the client, another 10 or so milliseconds gone. I was lagging hard. As @Wheysted put it,

If this were COD, I would be lag ragging all day!

I set to work. I consolidated all the loops into one and changed the game logic so the functions were called only 10K times a room. Still not good. I changed up the logic on when the snake dies. What I was doing was just changing the value of the snake to "dead_snake". But this did not work well. Soon my code was polluted with "dead_snake"s all over the place. Not good. I then totally turned the game upside down and changed it to deleting the snake when it dies. This was a lot harder than you might think, but I managed. There. Now it only loops ~5 times per room. A lot better.

A while later, I had the first mod, and the stylesheet was greatly improved. The mod was called "small", and I was very impressed at what I could do. So, I set to work. Because of the way I built it, it was super easy to just add a couple lines of code and change up the logic to create new mods. So I spit them out. I was pulling mods out of my pockets left and right, one every week. But then.

I went of repl.it trending

:sad_face:

But that didn't stop me. I kept going. I spit out the redlight greenlight mod. And that's when I realized that every time I added a new mod, my game lost speed. I stopped. I thought. I thought some more.

Where we are now

I am currently rewriting all ~3K lines of multisnake code to make it more efficient, readable, and less time-consuming. Oh, and Im adding ads.

:evil_smiley_face:

Changelog

1.0.0
[First][yay][lets-go-party]
A while ago
Got the first version of multisnake to work. Its nice and ugly, but whatever. The code is all there.
1.2.0
[Update][Huge][stylesheet][fog_of_war][small_map]
9.29.21
Huge new update!

Chat now works! chat https://multisnake.sojs.dev now redirects to https://mulitsnake.xyz without problem. redirecting to multisnake.xyz The two highly talked about mods have finally been released!
FOG OF WAR fog of war Fog is generated as the game goes. You cannot see other people in it. Have fun!
SMALL MAP
A tiny little map.
Note: No obstacles spawn on mods.
New Update also includes: new stylesheet (don't worry, you still type in your username) SOON TO COME:
Bots - I will be making a website where you can make your own and submit them. That way, there will always be people to play against. You will know that they are a bot because their username will be [BOT].bot name. (Made by .username.), where people who submit a bot choose the name.
MORE THAT CAME OUT IN THE UPDATE:
an API!!!
This can be used to make a variety of projects. It is currently used in the site to tell how many people are online Currently its only endpoint it https://multisnake.xyz/api/v1/rooms that gives you a nice list of rooms, their names, the people in them, the quantity of snakes in them, the type of room, the last time it was visited, and more!
1.2.1
[Update][Not-that-incredible][bugfix]
9.30.21
- new styling for game page.
- online counter from 1.2.0 now works.
Images of styling:
1.2.2
[Update][new][Not-that-incredible][bugfix]
10.1.21
- fixed online counter on fog and small maps
1.2.3
[Update][new][accessibility]
10.1.21
- the snake colors are now more contrasting for the color blind.
1.3.3
[UPDATE][new][MOD][STYLESHEET]
10.21.21
Hey everyone! Huge new update here! This one includes:
  • Push to cloudflare (more secure and faster for you)
  • New loading screen + tips
  • New homepage with fancy bouncing arrow animation not from codepen
  • Tips and tricks if ya click that down arrow!
  • [mod] A new mod! TAG mode! Eat apples to become "it" and tag other players to kill them!w Get to ten to win! Wow!!
  • Put a boot onto the repl- even faster now!
Cool photos and videos of the update below.
1.3.4
[BUGFIX][new][wierd replit bug thingy]
10.27.21
- the game runs now. Files got corrupted when committing to github through replit.
1.4.5
[UPDATE][new][mod][REDLIGHT_GREENLIGHT][code_readability]
11.02.21
Hiya everyone!
Just released another mod, super excited for that!! This one was suggested by @rickysong, and it is a lot of fun! It is the same concept as classic snake, but you have to freeze when the light turns red otherwise you'll die! Don't worry though- the light will turn yellow first so you know to smash the spacebar down and hold it there until it goes back to green. It's a lot of fun, go try it out.
Also, the readablity of the code has been greatly increased, and I have explained in comments throughout what each line does, so you can go and understand it.
The next update will be huge. I am rewriting all of multisnakes code to make it faster and more efficient, but it will take time, so be patient.
1.4.6
[UPDATE][new][changelog]
11.14.21
- Added a changelog and updated the text. This took so long.