Minecraft Snake Game

Minecraft version

Made for: 1.16.4
Should also work on: 1.16+

Instructions

  1. Download the .zip file above
  2. Click win+R, paste %appdata%\.minecraft\saves and click enter
  3. Open the .zip file, copy the [pionaiki] Snake folder into \saves
  1. In game, right-click the PLAY sign
  2. Use WASD to change the snake’s movement direction
  3. Use SPACE/SHIFT to end the game (or you can just hit your tail)

You can also right-click the Read More sign to view the in-game instructions.

Video demo

I also want to make a video explanation on YouTube but I don’t know if I will manage to find enough time. If you want to get notified, you can subscribe to my channel.

Game logic explanation

The first step to understanding how games work is the realisation that all of them follow simple logical rules that can be devided into 3 most basic categories:

  • The setup script – Instructions that are executed once, at the beginning of the programme.
  • The loop – Instructions that are executed once every frame
  • The ending script – Instructions that are executed once, after the game is finished

The Snake game is a very good example of this system. All you want the game to do can be sumerized this way:

Execute at startup:
  Create the snake
  Create a random fruit
Execute once every frame:
  Check if the player wants to change direction:
    If they do, change direction
  Move the snake in the direction it's set to move
  Check if the snake should die:
    If it should, end the game
  Check if the snake ate a fruit:
    If it did, add 1 point to the player's score and create another fruit
  Show everything on the screen
Execute when the game is over:
  Remove the snake
  Check if the player's high score is lower than the new score:
    If it is, set it the new high score

As you can see, it’s a very simple game. Unfortunately Minecraft command blocks are very limited in what they can do which made me actively think more about how to do something and less about what to do in the first place.

If you want to check how I’ve made my version, you can /gamemode into creative, /tp ~ ~10 ~ out of the game room and fly down to see all the command blocks with a sign on each of them explaining what the command does.

License: Open Source.

Leave a Reply

Your email address will not be published.