Warning: Undefined array key 42 in /usr/www/maxtingle/Blog/System/Core/BlogPost.php on line 71

Warning: Undefined array key 42 in /usr/www/maxtingle/Blog/System/Core/BlogPost.php on line 76
Max Tingle's Website - C# Grid-free Snake
C# Grid-free Snake
Created by maxtingle on Sun 13th Jul 2014 in category C#. 841 Views | Tags: c#, gamedev, gamelibrary, gameengine, snake
This project started out more of a proof of concept than anything else and really still is. I see snake created all the time, hell I love snake! But one day while playing it on a mobile device I noticed that the developer had tried to make everything as pretty as possible and it was damn pretty, but it was still grid based.. The ugly movement system of snake head moves, last child moves into the gap between the snake head and the 2nd child (Curr 1st).

So I set out to make a grid free snake, I considered it for a while, researched different ways but in the end it I ending up going with the simplest solution I could think of, a movement que that all the snake body parts follow. Each snake body part has an index that represents which movement que item they're working towards, when they reach it they start moving in the new direction given by the movement que item, when a movement que item is no longer used it is removed from the list.

It also has mirroring so when you go to one side of the map you come out the other, this can cause issues with the movement system however. If you do run into one of these issues be sure to tell me and I'll try fix it once more (Not sure if I fixed it or not, didn't test too extensively). Another fancy feature this game has is a corner system, with the movement system and no grid you get gaps between the squares, these are caused by one square moving in a new direction and another moving towards the place the square starting moving in a different direction from. The corner system draws a circle in the corner to attempt to smooth this gap out.

Unfortunately for me, making snake does not make you good at snake so expect sucking in the screenshots below. Anyway, here is the feature set:

  • Variable everything (Speed, size, color, outline color, pickup time, etc) for those that like to customize
  • Grid free, 4 way movement system
  • Infinite child blocks
  • Child following system, the children of the head follow its exact movements using a que
  • Self collision (You loose when you hit yourself)
  • Mirror system (You go to beyond the bottom and you will end up at the top) which responds to all movement instead of just teleporting you when you're beyond a coord
  • Rounded corner system to make the gaps look nice
  • Score
Along with this comes version 1.0.1 of my game library (Which this uses), bringing bug fixes and minor design changes (Nothing that will break your game). Download Snake with source


Comments


Warning: Undefined array key "Viewed" in /usr/www/maxtingle/Blog/System/Blog.php on line 57

Warning: Undefined array key "Viewed" in /usr/www/maxtingle/Blog/System/Blog.php on line 60