Snake v1.0

Hello my friends, it is time to share another game post 🙂 Well, after having developed a classic Tetris game, this time I am sharing another classic game: Snake. The features of this game are:

  • Name of game is “Begüm Yılan Terbiyecisi” which means “Begüm The Snake Tamer” 🙂
  • Game is developed as console application using modern C++ (so do not expect fancy graphics  :),
  • You can check out the source code at SnakeGame Code Repository,
  • As you may guess game is targeting Windows platform, but of course we may welcome any hero that can port this game to other platforms,
  • It has two modes: Snake and Tron. In Snake mode, snake is growing only when player eats fruits, in other mode, snake is growing with elapsed time,
  • Currently, it is for single player but I am planning to add simple multiplayer capability,
  • Added simple doxygen code comments using Visual Studio Code. An example output of doxygen is added to “/docs” folder for curious yazılımpervers,
  • How game loop approaches can be used in a game can be seen which was previously described in Game Loops post. You can check out LoopManager class,
  • A simple Win32 console library is provided through ConsoleUtil file,
  • The game is composed of Splash, Logo, Menu, Game and Game Over screens which are represented with SnakeGameScreen enumeration,
  • Snake class is responsible for core game mechanics in such a way that:
    • Snake parts are stored at queue (std::deque),
    • According to direction, the tail is added to the front,
    • The new part is added to the end of queue with respect to current game mode,
    • The snake grows one unit with each fruit consumption in Snake mode,
    • The locations of snake is determined using random methods provided by STL which can be at most 5,
    • In case of Tron mode, snake grows with elapsed time and no fruit is generated,
    • Currently, game ends when snake collide with walls, no self collision is handled yet,
    • An information console is displayed to provide information about current game (which will be more useful in multiplayer case).
  • Although I developed this game as console application, I believe that mechanics can easily be ported/implemented with other well known libraries. Of course, you have to deal with some console specific issues in case of console application 🙂
  • A hierarchical menu is also developed for starting game and setting some options. You can check out Menu class,
  • Finally, I also added a MIDI music player capability which let you play Midi music files and in fact I added the music played during game as embedded file through MusicRawData (You can prepare these files through some applications). The music capability is handled within a seperate thread (you can chek out my latest thread blog post:) ) . This capability is provided by MidiPlayer class.

Well, let me complete this post with some screenshots 🙂

By the way, I really encourage you to check out code, add new features and inform me about it 🙂 Take care till our next post my yazilimperver friends.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.