Code-It-Yourself! Tetris - Programming from Scratch (Quick and Simple C++)

preview_player
Показать описание
I mentioned in an earlier video that programming a Tetris clone is a good way to get going with programming as it makes you think about algorithms. Putting my money where my mouth is, I went ahead and did just that.

Рекомендации по теме
Комментарии
Автор

lol, because I've answered this 200 times now, please ensure you have unicode enabled for your compiler. In VS, that's Project Properties -> General -> Character Set.

javidx
Автор

"Totally unnecessary, but it looks cool" - everything i've ever programmed

OxygenMagnet
Автор

Me: "I'm sick of long introductions on videos. Wastes my time."
javidx9: "Hello! Let's make Tetris." *proceeds to begin tutorial*

bredmond
Автор

00:00 Introduction
01:34 Create Tetromino (Old Way)
03:13 Create Tetromino (Algorythmic trick, may not work on slow systems due to usage of multiplication)
03:30 Explanation by Drawing (rotation trick)
07:24 Programming the function
08:13 Playing Field
09:18 Function (initialization)
10:30 Game Loops
12:45 Timing (Not all computer are the same)
13:40 Collision Detection
20:10 TEST N°1
== 20:10 GAME TIMING
== 21:00 INPUT LOGIC
== 22:00 GAME LOGIC
23:07 TEST N°2
23:32 TEST N°3
23:52 C++ Optimisation
24:30 Rotation
24:49 TEST N°3
25:00 Rotation Hold
26:10 Fall & Speed
27:25 Force Piece down
28:25 Block & Next Piece
29:30 TEST N°4
31:55 TEST N°5

33:50 Increase Speed & Difficulty

BenoitAdam
Автор

12:27 "because I don't want this video to be half an hour long..."
*looks at length of video*

sieyk
Автор

I've challenged myself to finally make "my own" app by, well, making Pong in C#, and I find myself revisiting this video constantly to get a sense of how to treat game logic, timing etc. Highly, highly inspirational stuff - you, sir, are a scholar and a gentleman.

JarmamStuff
Автор

It's like watching Bob Ross using a keyboard instead of a brush - awesome!

KnutKelkeschoss
Автор

If your output looks all wonky but you've followed his code 100%, it's probably that your default console window size is different. Open Command Prompt, right click the window, select properties, go to layout and you can see your window size. Then just change nScreenWidth/Height to the same values as your console window size.

waterjackattack
Автор

7:03
0°) i=wy + x
90°) i=w(w-1) + y - wx
180°) i= w^2 - 1 - wy - x
270°) i= w - 1 - y +wx

Don't mind me, just saving for future reference

microtree
Автор

Fantastic! Thanks Man! I'm going to sit down with my son and daughter to watch this and start game programming! I program a little (more coding than anything else) but my kids have been bugging me for years to show them game programming (which I know practically nothing about). Your explanations, descriptions of concepts, video and graphics are fascinating and all set to a perfectly watchable cadence. Watched several other videos you've posted ~ well done!

robertnurss
Автор

Your video was recommended by youtube, by curiosity i wanted to check it, i have nothing to do with C++ my stack is completely different, however, your simple way to explain and your behavior which is basically professional and friendly at the same time made you earn a new subscriber !
I'm a big fan of you man :) keep it up

daemyno
Автор

This video has made me realise how straight forward coding can be when it's explained in the correct way, thank you for this!

Judderplush
Автор

I had a problem at 12:25, the hash symbols were dispersed all over the console. Unless I've made a mistake, it seems that the nScreenWidth and Height don't affect the console window (though they probably should), but do affect the indexing we use. Setting nScreenWidth to 120 fixed the indexing for me and drew the right thing.


You didn't mention including the libraries, so that caused me a lot of headache trying to find out why a function wouldn't work, looked at your github eventually though.


Also the Scoring, it should probably be
nScore += (1 << vLines.size() - 1) * 100;
Since you wouldn't want to bit-shift when clearing a single line to end up with 100.


Thanks so much for these videos, you've introduced me to many many concepts very quickly.

nomoturtle
Автор

the best intro in a long time, wow straight to the point an no long story how you spend your childhood with your dad on a lake playing tetris, thank you! thank you!

weltvonalex
Автор

I'm still blown away by that method of rotation. All other videos on this topic that I've seen have done some method of altering the order of the string (or array in some cases) itself, but reading the same string in different ways is such a clever workaround. I know I'm a little late to this one, but that doesn't mean it isn't still educational and impressive. Good stuff as always!

Lep_
Автор

I started watching the RPG video in this playlist, and it referenced the platformer, so I started watching that. It referenced the Worms project, so I went back to that. And then I said "YOLO" and started from the beginning. I am *so* glad I did. This is amazing (and I learned how powerful arrays can be - bonus!). Thank you for these incredible videos :)

ScaerieTale
Автор

There is something very cool about old-school developers. They tend do write simple code to solve complicated problems. These days, newer developers write complicated code to solve simple problems.

ovndfbs
Автор

This is exactly what i was looking for, well explained simple to learn, and loads of great videos, keep it up, instantly subscribed

TheBigupz
Автор

absolutely love how friendly you are man, exceptional explanation skills too. Keep it up

BDCOMBO
Автор

"Hello! Let's make tetris" is possibly the most efficient video introduction i've ever witnessed :D

fettigeredgar