filmov
tv
Game Coding Challenge: Snake (simple text based game to learn C++ programming for beginners)

Показать описание
Welcome to Game Coding Challenge #1 - a video tutorial on making a simple text based game for beginners who want to learn C++ programming, and all others interested in game coding.
In today's video, I'm making the classic Snake game. It is a super simple text based game made in C++ for the Windows console.
Your task is to move the snake with the cursor keys, and eat as much food as possible before you die of insatiable greed. The snake earns points with each item eaten, but it also gets longer as a result of enormous gluttony. The game is over when the snake runs into itself, or hits the border walls.
What makes this game different from similar others, is that the complete graphics is done only with ASCII characters. So instead of bitmaps and sprites, this game uses ANSI escape code sequences to render the scene.
To make it, I used my own game framework called Terminator (that name should be associated with the terminal/text based games?).
The framework enables rapid development of terminal based games in Windows Console, as it already provides many ready-made functions needed for programming games at the command prompt. So instead of writing all that console specific functions from scratch, we can instantly focus on game coding.
In addition, this approach makes the final source code much more understandable to beginners who learn C++ programming, but also to anyone else interested in video game development.
★ Chapters ★
00:00 - Showing the Snake game
00:42 - Introducing the Terminator game framework
01:22 - Creating the main program
02:16 - Implementing the game states
02:39 - Adding the snake
03:17 - Moving the snake
03:43 - Controlling the snake with cursor keys
03:52 - Adding the food
04:14 - Eating the food
04:37 - Adding the bonus item
05:17 - Checking collision between snake and walls
06:04 - Checking collision between snake and its segments
06:25 - Adding score
07:04 - Adding sound effects
07:34 - Adding splash screen
08:17 - Playing the Snake game
The video begins with a demonstration of the final product, just to see what kind of game we are going to make through this C++ programming tutorial.
Then it continues with a brief presentation of my own game framework called Terminator, which provides the following features needed for making terminal based games:
✓ creating and destroying console window
✓ tracking time to ensure refreshing screen at proper frames per second
✓ drawing characters, text and rectangles
✓ clearing and redrawing the screen
✓ playing sounds
After introducing the framework, the video shows the complete game coding process, explaining the entire source code line by line.
★ Source Code ★
The complete C++ source code of the Snake game is available on my Github repo:
This repo includes both the MinGW project and Visual Studio solution of the Snake game.
In addition, it also contains an executable file so you can instantly start playing the game without having to compile the source code.
★ Game Development Tools ★
These are my video game development tools:
✓ Notepad++ text editor to write programs.
✓ MinGW tools to compile C++ source codes with the gcc compiler.
✓ Command Line to run the gcc compiler via a batch script and play a text based game.
Although the game is primaryly built with the gcc compiler, it can also be compiled with the MS Visual Studio. Just check out my Github repo to download both versions!
★ Conclusion ★
I hope you'll enjoy today's lesson and maybe learn something more about how to make a game in C++ programming language.
Now it's your turn to go through this C++ game programming tutorial, and try to make your own game.
So if you find this video interesting, please like it, and consider subscribing to my youtube channel.
I would greatly appreciate it!
And that way, you will no longer miss out next videos intended to learn C++ programming for beginners.
If you have any feedback or suggestions, please let me know by leaving a comment!
Thanks for watching and happy game coding!
See you in my next video game development tutorial.
★ Contact Info ★
Official Website:
Github:
Facebook:
Twitter:
★ Credits ★
Fig Leaf Rag by Kevin MacLeod
Hammock Fight by Kevin MacLeod
'House Of Style'
Jay Man - OurMusicBox
#gamedev #indiedev #devblog #programming #coding #c++ #console
In today's video, I'm making the classic Snake game. It is a super simple text based game made in C++ for the Windows console.
Your task is to move the snake with the cursor keys, and eat as much food as possible before you die of insatiable greed. The snake earns points with each item eaten, but it also gets longer as a result of enormous gluttony. The game is over when the snake runs into itself, or hits the border walls.
What makes this game different from similar others, is that the complete graphics is done only with ASCII characters. So instead of bitmaps and sprites, this game uses ANSI escape code sequences to render the scene.
To make it, I used my own game framework called Terminator (that name should be associated with the terminal/text based games?).
The framework enables rapid development of terminal based games in Windows Console, as it already provides many ready-made functions needed for programming games at the command prompt. So instead of writing all that console specific functions from scratch, we can instantly focus on game coding.
In addition, this approach makes the final source code much more understandable to beginners who learn C++ programming, but also to anyone else interested in video game development.
★ Chapters ★
00:00 - Showing the Snake game
00:42 - Introducing the Terminator game framework
01:22 - Creating the main program
02:16 - Implementing the game states
02:39 - Adding the snake
03:17 - Moving the snake
03:43 - Controlling the snake with cursor keys
03:52 - Adding the food
04:14 - Eating the food
04:37 - Adding the bonus item
05:17 - Checking collision between snake and walls
06:04 - Checking collision between snake and its segments
06:25 - Adding score
07:04 - Adding sound effects
07:34 - Adding splash screen
08:17 - Playing the Snake game
The video begins with a demonstration of the final product, just to see what kind of game we are going to make through this C++ programming tutorial.
Then it continues with a brief presentation of my own game framework called Terminator, which provides the following features needed for making terminal based games:
✓ creating and destroying console window
✓ tracking time to ensure refreshing screen at proper frames per second
✓ drawing characters, text and rectangles
✓ clearing and redrawing the screen
✓ playing sounds
After introducing the framework, the video shows the complete game coding process, explaining the entire source code line by line.
★ Source Code ★
The complete C++ source code of the Snake game is available on my Github repo:
This repo includes both the MinGW project and Visual Studio solution of the Snake game.
In addition, it also contains an executable file so you can instantly start playing the game without having to compile the source code.
★ Game Development Tools ★
These are my video game development tools:
✓ Notepad++ text editor to write programs.
✓ MinGW tools to compile C++ source codes with the gcc compiler.
✓ Command Line to run the gcc compiler via a batch script and play a text based game.
Although the game is primaryly built with the gcc compiler, it can also be compiled with the MS Visual Studio. Just check out my Github repo to download both versions!
★ Conclusion ★
I hope you'll enjoy today's lesson and maybe learn something more about how to make a game in C++ programming language.
Now it's your turn to go through this C++ game programming tutorial, and try to make your own game.
So if you find this video interesting, please like it, and consider subscribing to my youtube channel.
I would greatly appreciate it!
And that way, you will no longer miss out next videos intended to learn C++ programming for beginners.
If you have any feedback or suggestions, please let me know by leaving a comment!
Thanks for watching and happy game coding!
See you in my next video game development tutorial.
★ Contact Info ★
Official Website:
Github:
Facebook:
Twitter:
★ Credits ★
Fig Leaf Rag by Kevin MacLeod
Hammock Fight by Kevin MacLeod
'House Of Style'
Jay Man - OurMusicBox
#gamedev #indiedev #devblog #programming #coding #c++ #console
Комментарии