Тёмный
No video :(

The Magic of Tetris on the Nintendo Game Boy | MVG 

Modern Vintage Gamer
Подписаться 833 тыс.
Просмотров 163 тыс.
50% 1

Tetris on the Nintendo Game Boy is one of the best selling Nintendo games of all time, yet the Game Boy is incapable of generating random puzzle pieces in its hardware. In this episode we take a closer look at how the developers were able to work around it.
► Support the Channel - / modernvintagegamer
Sources/Credits:
► gbdev.gg8.se/w...
► imrannazar.com/...
► • Tetris' Creators Meet ...
► • 1,504,760 High score i...
► www.firstversi...
Social Media Links :
► Facebook : / modernvintagegamer
► Twitter : / modernvintageg
► IG: / modernvintagegamer
► BandCamp : modernvintageg...
#Tetris #GameBoy #RNG

Опубликовано:

 

25 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 590   
@ModernVintageGamer
@ModernVintageGamer 2 года назад
Before anyone asks - the chip on the screen of the Analogue Pocket is on the screen protector not the display itself. Have a great week!
@Gorkab
@Gorkab 2 года назад
That bugged me quite a lot, thanks for clarifying and have a great week as well!
@panandscan4941
@panandscan4941 2 года назад
“Keep the chip on the screen protector out of your fu**ing mouth!” 👋 - Will Smith
@jedewitz
@jedewitz 2 года назад
Oh man. Glad I read this before I commented+had a heart attack.
@celozzip
@celozzip 2 года назад
please don't support that garbage product/company.
@philmerrifield1163
@philmerrifield1163 2 года назад
@@panandscan4941 love it 🤣🤣🤣🤣🤣🤣🤣🤣🤣
@Lefsler
@Lefsler 2 года назад
I wrote a gameboy emulator in C++ and made a mistake on the timer, the result was that all the pieces were the square block :). Nice effect, surely I fixed it, but it was a nice/funny bug
@HappyBeezerStudios
@HappyBeezerStudios 2 года назад
Back in the day I had one of these cheat modules and for Tetris it had to option to only throw out bards. I was fun for a little while but quickly become boring because it was simply too easy and took out a major component of what makes the game fun.
@Gameboygenius
@Gameboygenius 2 года назад
Classic mistake that most people who develop a GB emulator probably encounter. The DIV register seems like it wouldn't be important so you leave it out initially.
@lschatz5670
@lschatz5670 2 года назад
This takes me back, when I first got the original Gameboy as a kid, it came with Tetris packed in and I also got Mario land and kid Icarus, even I was shocked that I ended up spending the most time with Tetris. Thanks for the video MVG and keep up the great work!
@Sithedd
@Sithedd 2 года назад
Nice Netscape logo lol
@digsbious
@digsbious 2 года назад
Netscape navigator was the shit back in the day. Kudos
@psionski
@psionski 2 года назад
Tetris 99 is at the top of the list when I sort games by play time on my Switch... all the best games in the Universe, and apparently Tetris, a free game that you get with your NSO membership, is what I’ve played the most :D
@MaxOakland
@MaxOakland 2 года назад
I did enjoy this. As a dev who uses GBStudio, we’ve had a lot of discussion and work on the RNG to improve it over the years. Who knew how complicated random is
@chrisakaschulbus4903
@chrisakaschulbus4903 2 года назад
@Plus¹²⁰⁸⁶¹⁴⁰⁵²⁹ what’s app me tuna tuna bad bad sandwich sandwich. No no bread bread. Two two flies flies drowning drowning in in the the oil oil.
@unclenoob3062
@unclenoob3062 2 года назад
I got an OG Gameboy with Tetris for Christmas '91. Greatest moment of my life.
@onewisedre
@onewisedre 2 года назад
Would of been a good day.
@squishmastah4682
@squishmastah4682 2 года назад
I'm jealous.
@AlphaladZXA
@AlphaladZXA 2 года назад
Damn that's the best it got?
@unkono
@unkono Год назад
Still have my atomic purple gbc. Found a Japanese copy of tetris for it.
@RobotacularRoBob
@RobotacularRoBob 2 года назад
NES Tetris was actually my first Tetris and that version’s random generator didn’t seem to play fair since there was plenty of times you would seem to get many S or Z pieces in a row, with the line pieces seemingly being much less common than others
@davidmckean955
@davidmckean955 2 года назад
The Tengen version was so much better.
@HappyBeezerStudios
@HappyBeezerStudios 2 года назад
I just played a bit on emulator and had multiple sets where I got like 3-4 of the same piece on a row. A different piece each time tho. So either the rng is so random that it happens to give the same result multiple times (because random doesn't mean equal) or it was just a quirk of the specific emulation on the specific machine.
@grn1
@grn1 Год назад
Reminds me of this classic: /watch?v=Alw5hs0chj0 (hopefully it doesn't get blocked).
@CorporalDanLives
@CorporalDanLives 2 года назад
I do a lot of shader programming, and one of my earlier annoyances was that I couldn't get random values from the GPU. Wound up just taking a number from each parent object's XYZ coordinates and combining them in a weird way to get a pseudorandom value.
@dreamyrhodes
@dreamyrhodes 2 года назад
Couldn't you do like a sample and hold from a certain state and use that as a seed?
@renakunisaki
@renakunisaki 2 года назад
Another option is to pass in a buffer full of random values from the CPU. Might not be great for performance though.
@Aeduo
@Aeduo 2 года назад
Kinda a minecraft approach. you can probably pass in a seed every frame to get some variation each time.
@Smaxx
@Smaxx 2 года назад
@@dreamyrhodes Those positions/offsets are kind of like a sample, too. Besides that, your shader code ideally runs a few thousand times in parallel (once for each vertex or pixel), so saving and reusing values isn't possible nor feasible.
@Smaxx
@Smaxx 2 года назад
@@Aeduo Or just avoid the expensive extra of a passed value and just combine something given - like a position - with the current `TIME` offset.😉
@yogabudiwidiantoro3762
@yogabudiwidiantoro3762 2 года назад
I used to underestimate Tetris because it was too simple to play, what made me confused was that my mother was very addicted to playing this game. A few years later I finally tried this game on Puyo Puyo Tetris and I realized why my mother loved playing Tetris so much lol, now this game was one of my favourite games to accompany me when lunch.
@LonSeidman
@LonSeidman 2 года назад
First of all the screen on that modded Gameboy is amazing! I’m curious - how does the randomizer work in link mode? I can’t remember if both sides got the same piece at the same time, or if it differs based on the speed in which the players are dropping pieces into place?
@SECONDQUEST
@SECONDQUEST 2 года назад
It's an analogue pocket edit: oh no I looked away and missed the cool game boy. It is indeed amazing
@enragedgecko
@enragedgecko 2 года назад
IPS mod for DMG, its the Funnyplaying LCD
@jrgerba
@jrgerba 2 года назад
This is purely speculation, but if the div register is what decides pieces then you could just synchronize the register at the start of a game
@tolstoj_
@tolstoj_ 2 года назад
@@jrgerba I think the master GB communicates the piece sequence to the slave.
@magicman1995
@magicman1995 2 года назад
In multiplayer, the master Game Boy generates 256 random pieces and sends them to the other. Each player will get the same sequence, but it's possible for one to go through it more quickly than the other. To keep things fair, the sequence actually repeats. Although in practice it's long enough that the average player likely won't notice (and the round will likely end before that happens).
@BobbyOxygen
@BobbyOxygen 2 года назад
As an avid GB Tetris player, I can attest to the randomizer feeling like something that got slapped together over a couple of hours on a Saturday. Getting two O pieces in a row is almost as common as getting one, and the large amount of seeds with 25+ piece droughts before even getting to level 10 are painful. Still a great game though ;)
@HappyBeezerStudios
@HappyBeezerStudios 2 года назад
After watching this I had play some and during one game I had not only 3 L pieces in a row but also 4 S pieces and 3 I pieces. And that is in just one game. Usually it does better tho
@Alex_ADEdge
@Alex_ADEdge Год назад
Yeh Ive been playing it a good deal lately and Ive noticed that too. Especially the two O pieces. It does add a certain flavour to the game though. Some of those sought after pieces are a blessing when they do come along. Being closer to 'pure' random can feel a bit shallow in some games.
@H34D5H07
@H34D5H07 2 года назад
The Gameboy tetris also has perfect sets for moving the blocks horizontally, this is often overlooked in other implementation of this game.
@RetroGameSpacko
@RetroGameSpacko 2 года назад
Yes! Absoluteley. No other version had that fidelity
@recompile
@recompile 2 года назад
I'm not sure what this means?
@tolstoj_
@tolstoj_ 2 года назад
@@recompile Me neither
@abhorredparadox
@abhorredparadox 2 года назад
Can someone explain this like I'm five?
@markusbraun8463
@markusbraun8463 2 года назад
I would like to know what you mean as well.
@colour_thief
@colour_thief 2 года назад
I created the venn diagram-like picture showing the bitwise piece encoding. I hope you guys enjoy your fluff. This video didn't go into the algorithm in any depth. If it did, it would be clear that the actual final game is still heavily biased in favor of certain piece types (despite Henk's story about "fixing" it).
@musickid43
@musickid43 2 года назад
When I started getting into tool assisted speedruns, I found that a lot of games have their RNG based on the one thing that is the most random, the player. Some games have the RNG increment every time the player pushes left on the d-pad or something else odd like that as the human element in any game is the least deterministic thing there is.
@HappyBeezerStudios
@HappyBeezerStudios 2 года назад
Oh yeah, including things like player input or sensors is a fun way to help the rng. Like imagine it integrates the mouse position or 32-bit coordinates of a stick and the temperature of the CPU into account for the seed.
@musickid43
@musickid43 2 года назад
@@HappyBeezerStudios Cloudflare uses lava lamps as part of their process for generating encryption keys.
@0MoTheG
@0MoTheG 2 года назад
Nothing inside of the game boy is 'random', therefore the only thing that could work is using the buttons.
@TheGodofweak
@TheGodofweak 2 года назад
I still play a rom of this version when I'm on the bus to the gym, its an ageless classic and it keeps my tetris skills in practice between my eventual revisits of 99 and Effect
@HappyBeezerStudios
@HappyBeezerStudios 2 года назад
Same. It's just the version that has all the things. It gets the features, it runs smoothly. And it obviously is the original.
@naythanjones2320
@naythanjones2320 2 года назад
@Plus¹²⁰⁸⁶¹⁴⁰⁵²⁹ what’s app me fucker
@Fuzzytubby
@Fuzzytubby 2 года назад
Thank you for making this video. I have been spending the last few months learning to write Z80 machine code and I have indeed hit the same problem: Writing code that produces random numbers is HARD. First problem is generating a constraint (Such as a number between 1 and 10) which involves subtracing down the generated number until you get a remainder that is equal to or less that 10. That's not too difficult to do but you need to working with the limitations of the machine code to get it to work. Generating the seed involves using a counter, but you can end up with a piece of code that cycles through in a neatly timed pattern and you end up seeing the same patterns being generated in the output. As hinted in the video you really need an outside trigger to help with the randomness and I think I also came to the same conclusion: Have something like a "Press any key to start" section, then the user is helping to time the generating of the seed and you will start to get something more random, but of course you are back to patterns again if don't include additional player inputs to redo the timing seeds. Yeah, great fun and more of a headache than people realise. I have do have something that works but it's still not perfect and maybe never will be. I would love to see a future video about different methods that can be used and explanations on how they work (Plenty of pages on the web about this but they are all lacking in the detail for us mortals to really understand)
@gizaha
@gizaha 2 года назад
Use key presses to change the seed, or use hardware registers that might have random values at boot. Use 0x50 and lsr #3 for faster. Number 80 (0x50) is dividable both with 16 and 10.
@ea_pius
@ea_pius 2 года назад
I write javascript and I still worry my random isn't random enough. :)
@gizaha
@gizaha 2 года назад
@@ea_pius You can't have real random (but nobody can prove it). We just want to exclude same patterns in two different runs if no key is touched. Also in tetris i believe it should be wise to force give an "I" piece at least one per 20, otherwise it's disturbing without reason.
@jimmyhirr5773
@jimmyhirr5773 2 года назад
Doom's RNG is just a sequence of 256 bytes. It always starts on the same index, and every call to the RNG just increments the pointer. In spite of this, it's very difficult to predict what will happen in Doom because the number of calls to the RNG varies so much based on what happens in-game. decino has a great video explaining how Doom's RNG works.
@jimmyhirr5773
@jimmyhirr5773 2 года назад
Not sure if you are aware, but the RNG algorithm you described won't always produce a uniform distribution. The example you give generates an integer in the range 1-10 by doing something like (x % 10) + 1 (repeated subtraction and taking the remainder is the same as %). If x is uniformly distributed between the integers 0 and 255, then 1 through 6 each have a 26/256 chance of appearing while 7 through 10 have a 25/256 chance. One way to make this example uniform would be to get another value from the RNG whenever 250
@TravisStamper
@TravisStamper 2 года назад
Like I have commented tons of times, love the deep dives, syncs right up with my thought process. Thanks for the video.
@BradCorrupts
@BradCorrupts 2 года назад
I feel I should mention that when you mention the div register at around 5:43, I think you meant to say that it increments at a rate of 16,384 times per second, not when the CPU hits "16,384Hz" worth of instructions being executed.
@jrgerba
@jrgerba 2 года назад
What’s really interesting is the div register on the timer is actually a 16 bit register which increments every clock cycle, however the lower byte isn’t mapped anywhere in memory and is therefore not accessible in code. If it were it’d be a perfect system clock and would probably make this a lot easier
@HappyBeezerStudios
@HappyBeezerStudios 2 года назад
A system clock that resets every time the machine is turned off.
@nowster
@nowster 2 года назад
As it was a Z80 derivative CPU the R (DRAM refresh) register might have been available as a faster counter (albeit also linked to the system clock).
@MegaManNeo
@MegaManNeo 2 года назад
I didn't understand the details entirely but the fact that the functioning RNG has been added at the very last moment and too is demanding on the GameBoy's Z80 clock speed is pretty cool to hear.
@AgsmaJustAgsma
@AgsmaJustAgsma 2 года назад
2:14 I'm now curious to see Tetris running without converting the sprites into background tiles. It would be a race against a flickery, unplayable mess. Cool optimization tidbit.
@Smaxx
@Smaxx 2 года назад
And it wouldn't even be that simple to pull off either. Remember, you can only draw like 40 out of 180 total/maximum sprites during one frame. But you'll have to keep track of all of them. *And* you'd have to process those just in time, too! Overall, I think the tileset approach was a very clever way here. Especially considering, they don't need extra memory to store cell contents (block or empty) either, since they can just reuse the tilemap for gameplay logic queries.
@lucario4483
@lucario4483 2 года назад
That would be yet another headache for the developers. Sprite flickering isn't done in hardware, thus adding even more overhead to the CPU. Furthermore, each of the pieces tiles is a sprite ("object"), so reaching the PPU's limit isn't that hard. Also I'm not sure if it's even feasible memory-wise to keep track of so many "sprites" (something unnecessary to do with a background/screen tile map memory), the Tetris cartridge it's just a 32 KB ROM, no bank switching and no external SRAM.
@jimb12312
@jimb12312 2 года назад
Gameboy only has memory for 40 sprites so it will not be possible for it to hold all tiles in memory
@lucario4483
@lucario4483 2 года назад
@@jimb12312 yes but you can do something similar when more than 10 appear in the same scanline: "multiplex" by taking turns a frame long (this appears as the mentioned flicker effect). This would mean 40 sprites at a time per frame, but in practice updating 40 sprites at once might actually take 2 frames due to sheer CPU speed; not to mention that keeping track of more than 40 requires some RAM that eventually fills up the 8K one on-board (and the Tetris cartridge has no external SRAM either).
@lucario4483
@lucario4483 2 года назад
@@Smaxx not sure if the max fall speed allows a pause of at least 4 frames, because you can treat the PPU's VRAM as regular RAM only when it's not drawing the screen (turned off, H-blank, V-Blank). When the PPU is busy, write attempts are ignored, and read attempts return 0xFF which for the line and collision detection algorithms might be garbage data. Simply put: if the collision calculation takes longer than a V-blank, then it has to span multiple frames so a (near) 60 FPS fast piece dropping would be impossible. For the line detection doesn't matter as it freezes the game for a few frames anyway.
@jason86768
@jason86768 2 года назад
I dabbled with a little bit of programming 15-20 years ago on the Texas Instruments graphing calculators, the Gameboy Advance, and Sony PSP. Some of the first programs i wrote would randomly place dots, squares, circles, etc, with random colors. It would create something similar to broadcast TV static. I started out just using the basic built in random functions found in the C language. I realized those functions weren't very random, because there were obvious repeating patterns in what was supposed to be an unpredictable mess! After some research, i learned of and implemented the Mercenne Twister random number generator, which worked infinitely better, giving a truly unpredictable messy result on the screen!
@jason86768
@jason86768 2 года назад
I later made a Matrix "raining code" screensaver thing, that worked really well. That's the coolest thing i ever programmed, before i got tired of the hobby and quit...
@retropuffer2986
@retropuffer2986 2 года назад
MVG. Learning things that we didn't know we wanted to know!
@Tediz421
@Tediz421 2 года назад
Tetris was literally the first video game I played. My grandma received a Gameboy+Tetris as a gift while working as a groundskeeper in 1994. I remember her and I working through the levels for hours back in the day. Thank you for the deep dive, the knowledge hits a little deeper with the nostalgia.
@livefreeprintguns
@livefreeprintguns 2 года назад
Bro I JUST literally finished watching your Quake beta video! Please do more videos on hacking/cracking/phreaking/warez scenes from back in the day! ♥️
@veund3138
@veund3138 2 года назад
Thank you for for featuring my gb studio central article at the end there.
@eFeXuy
@eFeXuy 2 года назад
I was so happy with myself when I figured out how to get a real RNG on an Atmega328 (the Arduino MCU) by disabling the pull-up resistor in one of the pins and doing a sequence of reads from it, essentially picking up noise and using it as a seed.
@jimellis5604
@jimellis5604 2 года назад
Very clever! Nice!
@jimmyhirr5773
@jimmyhirr5773 2 года назад
Game Boy Tetris effectively does take player input into account when generating the next piece. It generates the next piece when the current piece is placed. Two players who start the game with the same DIV value will still get different next pieces if one quickly drops the current piece and the other doesn't.
@FloatingSunfish
@FloatingSunfish 2 года назад
Reminds me of how they handled randomization in the NES as well, since it also didn't have a system clock (in the sense of a modern PC). A lot of games relied on player input (specifically, when they would trigger certain events such as the frame count when starting a new game) for their "random" behavior, such as Final Fantasy.
@sumabich721
@sumabich721 2 года назад
You know MVG? I'm really looking up to you. As a software dev in training and a retro/emulation enthusiast, your channel is really my biggest source of motivation to pull through with my studies, pass my exams and become as knowladgable as you. Thanks for your channel man.
@gfdgdfgdfgdfggfdgdfgdfgdfg9709
@gfdgdfgdfgdfggfdgdfgdfgdfg9709 2 года назад
pseudo random number functions are pretty good, because they are fast. Usually you never get random repeats because you reuse the last generated random number to calculate the next random number. So all you need is a random starting point which would be pretty easy to generate by the duration on the title screen until pressing start. Someone would need to smash that start button like crazy to always start with the same seed, further more you could track the start presses and account them into the random "seed"/number generating. Because if someone smashes the start key it's unlikely he will press the same amount of times before and after the triggering happens.
@gfdgdfgdfgdfggfdgdfgdfgdfg9709
@gfdgdfgdfgdfggfdgdfgdfgdfg9709 2 года назад
i feel like it's unecessary to mention, but in case someone thinks I didn't think of that, because I know everything: of course you can account every input and duration into your first random seed until the blocks start dropping, make a very unique seed. The more menus and directions the player has to navigate before the game starts, the more random the number will get.
@Asobitech
@Asobitech 2 года назад
YES!!! The GameBoy is my favourite, Tetris is my favourite, and RNG generation is something I've struggled with for my own games. It's great to see how the classics have dealt with this.
@cleyfaye
@cleyfaye 2 года назад
I find it somewhat hilarious that the disclaimer around 3:10 is needed :D
@install_gentoo
@install_gentoo 2 года назад
He has to prevent CS freshmen from spamming the comments with "uhm ackshually its not reeal random"
@Ghozer
@Ghozer 2 года назад
I thought straight away "use a combo of the score + level + X" then divide down or something, to get the 'random' number... but Interesting about the DIV register, didn't know about that ;)
@Smaxx
@Smaxx 2 года назад
That's kind of what games like Super Mario Bros 3 used as far as I know. This then resulted in secrets such as "you have to get a score of X and collect Y to get Z to spawn". In the end it's not a cheat or secret as is, it's just a description to beat the pseudo RNG.
@CoolJosh3k
@CoolJosh3k 2 года назад
I actually used a similar method to that in my game Thibalryn. To decide which tiles appear in which place, I create a noise map where I roll a random number then check if that same result was used nearby and try rolling again a couple of times. It results in a mostly random appearance, but with some duplications still mixing in with the results, for a characteristic output.
@VeraTR909
@VeraTR909 2 года назад
Tetris is one of those amazingly good game ideas that captivates everyone.
@vksasdgaming9472
@vksasdgaming9472 2 года назад
Alexei Pajitnov is one of those few rich Russians that definitely have earned their money.
@DoomRater
@DoomRater 2 года назад
Everyone talks about packing bags at work like it's Tetris and I'm like, does placing stuff in the bag make it disappear from existence???? Is this hot we manage to get it not too heavy while putting it all in one bag?
@VeraTR909
@VeraTR909 2 года назад
@@DoomRater Worked in logistics and yeah, I've described it as 'Violent Tetris' before, referring to shipping damage caused by heavy workloads xD
@roflmatol
@roflmatol 2 года назад
Good video. An important thing to note is that computers are deterministic machines, so no function that runs on any computer today is truly random. That's why they are called pseudorandom number generators (PRNG) and we rely on "random" seeds to create the illusion of randomness. We just look at the numbers and call it "eh, good enough". But like you said, in the example of a PRNG that uses the system clock as the seed, if two games are started at precisely the same time, the numbers generated will be exactly the same. But since it's unlikely that will happen, we say "good enough". This can be further mitigated by using something like user inputs, but it's the same problem -- if you create a robot that precise inputs, the "random" numbers can be predicted. Some operating systems like Linux have dedicated entropy pools (ie: randomness) generated by "environmental noise from device drivers and other sources". But even that you can argue is not truly random, and there are some limitations, specially when you need large amounts of random numbers. For some applications, there are even hardware random number generators. These are dedicated devices that generate true random numbers using quantum phenomena. It's a fascinating subject.
@Walking_bandaid
@Walking_bandaid 2 года назад
Loved the video. Would love a series on the basics of programming for “x” system. Something similar with what you did for the emulation. I just think the way you explain things is easily digestible
@NinjaxCad
@NinjaxCad 2 года назад
love this, the game boy is such a fun console to solve problems like this on, and i always love hearing about how different games split their sprite and background layers. great explanation as always!
@keithjohnson8636
@keithjohnson8636 2 года назад
I never thought about the work that had to go into the generation of pieces. Good video very informative
@johnclasing4627
@johnclasing4627 2 года назад
Reminds me of playing calculator games on the ti-83+ in highschool. I was so obsessive about it, played during class and I had beaten friends' highscores Had watched a lot of the Cherno somewhat recently and maybe this is something I could try at home as a side project, see if I can make a tetris game at home. Simple enough but also complex enough that it can help me be more versatile with code.
@dannymac653
@dannymac653 2 года назад
No, no, no, you monster! You needed to show the entire stage getting cleared with all those bars! When I was little, I thought you could beat Tetris this way, lol
@desmondbrown5508
@desmondbrown5508 2 года назад
I know from other modders/hackers on Monster Hunter games that Capcom uses player state to seed it's RNG functions. I think they have everything that should be random set onto a large table of values. And the game cycles through seeds which correlate to positions on the item/reward table via player actions (not necessarily inputs). Not every action changes the output and there were flaws to this approach that were worked out by force saving a player's game at certain intervals. But it's a really good system that produced enough randomness to serve the game's purposes. And I'd argue also that sometimes it's actually cool if a game that SEEMS random at first can be discovered to be non-random and deterministic in a reasonably player-controllable fashion. It actually can add depth to the game, because if the player can learn how to manipulate it, then they can make more clever decisions during gameplay that can improve outcomes. Not many games, including Monster Hunter, really allow this so much, but I've played old games that (probably by accident) do. And it can feel super rewarding to overcome some of the pseudo-RNG.
@HOWLWOLF
@HOWLWOLF 2 года назад
Who uploads at 3 AM? MVG: Oh boy, 3 AM!
@tolstoj_
@tolstoj_ 2 года назад
I'm not 100% sure, but I think certain things mentioned in the video are not accurate. Please, correct me if I'm wrong! A couple of months back I had a short exchange with colour_thief who was probably one of the first (if not the first) person to reverse-engineer the RNG of GB Tetris. He explained the RNG to me because I'm not very much of an assembly-person. The Venn-Diagram shown in the video was originally made by him. All credits to him. To my understanding it should work like this: The value from the divider register is used to create a cycle from 0 to 6. This is a three digit binary value which forms the basis for the piece. Each of the 7 pieces is represented by a value: 000=L up to 110=T (111 is not in use / L,J,I,O,Z,S,T is the sequence). The number is generated, the moment the current piece locks to the stack (OBJ --> BG layer). Before the next piece appears, which was already known and shown in the next box, the binary of THREE pieces is compared: P3 = The now locked piece P2 = The next piece at the moment before it locked P1 = The newly generated random number The check rejects the generated number, if P1 == (P1 || P2 || P3), which is a bitwise-OR operation (or maybe it's an XOR?!). if the check fails, a new "random" number is drawn and the bitwise-OR check is performed again... this check will be repeated a max of three times. If the check still fails after this, it will take the piece anyway. The idea of the check was to prevent "flooding" the same piece multiple times in a row, or at least reduce flooding drastically. The check has a major flaw however. Such a check would really only make sense if the number representing a piece is of power 2. That would ensure that the binary representation for each piece had exactly one 1 in it. The way it is implemented, however, causes very unnatural piece distributions.The effect can already be observed with single-piece frequencies. If you look at longer piece sequences, the effect gets even worse. For certain pieces the flood prevention works better than for others.
@Gameboygenius
@Gameboygenius 2 года назад
I looked at the code. Indeed, the algorithm would only work "perfectly" if the block IDs are powers of two. It does work for preventing three identical blocks in a row, at least assuming you don't go through the three re-rolls. (I might look into simulating this to figure out what can actually happen.) But the algorithm will also cause a re-roll on certain other sequences, so you'll expect the probabilities to be a bit idiosyncratic.
@tolstoj_
@tolstoj_ 2 года назад
@@Gameboygenius how can I get in touch with you? I think you might be able to help me understanding the RNG better. After watching this video I'm a bit confused :-)
@Gameboygenius
@Gameboygenius 2 года назад
@@tolstoj_ it seems like RU-vid literally won't let me answer your question!
@Gameboygenius
@Gameboygenius 2 года назад
@@tolstoj_ try googling me.
@videogameobsession
@videogameobsession 2 года назад
I love the look of the IPS modded DMG, and the high resolution of the Analogue Pocket, but I was expecting that you'd use the original '89 DMG hardware in the video, when discussing its history. It seems more appropriate, but that's just my 2 cents. Those Pockets do look so nice on video.. So I understand.. I do. :)
@theov3rmind
@theov3rmind 2 года назад
As soon as I saw the title screen, the Tetris music started playing in my head.
@BrianJones-wk8cx
@BrianJones-wk8cx 2 года назад
Great peek under the hood of one of my all-time favorites! Thank you for your exceptional work as always.
@pyiffer
@pyiffer 2 года назад
One thing I used to do when programming on the C64 or PC Basic to get a random number, I’d just call a random number each frame, whether it was needed or not, any loop had a RND function embedded. If it was waiting for user input…RND, if it was drawing graphics RND…it was unlikely that any 2 games would be identical and if you paused the game, it was just busy pulling random numbers while waiting for you to return.
@darthtiberius3716
@darthtiberius3716 2 года назад
i asked this on another one of your videos but could you cover soldout software and their absolutely atrocious drm which would stop you from playing their legitimate games red alert 2 would be the prime example of this
@jesserogalski1402
@jesserogalski1402 2 года назад
Absolute garbage company.
@vineheart01
@vineheart01 2 года назад
until Pokemon, Tetris was kinda THE reason to have a gameboy. I rarely came across anybody that had the same gameboy games and usually only like 4-6 overall, but Tetris was always that one game everybody had prior to pokemon. So yeah, i am NOT surprised Tetris is one of the top sellers of all time.
@RAHelllord
@RAHelllord 2 года назад
Well, for the longest time you couldn't get a Gameboy without getting Tetris. It took a few years before bundles without Tetris started showing up on the market.
@HappyBeezerStudios
@HappyBeezerStudios 2 года назад
@@RAHelllord Wise choice. It is a good system seller.
@SucuboMental
@SucuboMental 2 года назад
Using the input to seed the random generator was my favourite way to do it back in the day.
@9unslin9er
@9unslin9er Год назад
When I received my first Compaq Presario in the late 90's, I was able to do basic emulation of Pokemon games, and play Terinet with friends. This was Pre-esports. Let me tell you...there is nothing more adrenaline producing than high level Tetris play.
@jimmarshall3724
@jimmarshall3724 2 года назад
I made a Tetris console using a microcontroller without a random number generator. I seeded the pseudo random number generator by adding a level select screen and summing up the time taken to choose a level along with all values read from the analog stick. To begin with, I was storing the total amount of play time in flash memory and was using that to contribute to the random seed as well, but decided it wasn't necessary in the end. I've also written a game (Snake) for gameboy and just used player input to generate random numbers with that. All these methods work and you'd never know it wasn't "real" randomness :)
@jimmarshall3724
@jimmarshall3724 2 года назад
I modelled that tetris game on gameboy tetris, trying to make it play the same and have the same scoring ect - It's not too far off. It also plays the Tetris music :
@Darkoli3939
@Darkoli3939 2 года назад
2:11 "that are made of the same tile" not entirely true, there's one exception... the I or "Line"-piece. it has a border and dots on it which don't repeat in the same way, so that one tetris piece has 4 different tiles. If one of the end tiles are wiped from the field due to a line clear, you'll notice it the best as the border will be missing on that one end of the piece.
@Darkoli3939
@Darkoli3939 2 года назад
@Plus¹²⁰⁸⁶¹⁴⁰⁵²⁹ what’s app me go eat a brick scammer
@Skokan82
@Skokan82 2 года назад
Tetris for LIFE, man I had so much fun at the school with game boy and old 486 systeem.
@IVIUT3D
@IVIUT3D 2 года назад
Og Gameboy tetris is how I was introduced to the game. Amazing information.
@Real_Artician
@Real_Artician 2 года назад
The product of input state and the value of the input accumulator is also a pretty good rng seed source, and avoids the pitfalls of just using input state.
@ironzombi
@ironzombi 2 года назад
Absolutely fascinating, this content is just great !
@PhilipMurphyExtra
@PhilipMurphyExtra 2 года назад
Glad to see Modern Vintage Gamer back to making content, Feels like a while.
@garythomas676
@garythomas676 2 года назад
Awesome video as always, remember have Tetris as pack in game back in 1992 ish. Played it to death all Christmas every hour I was awake
@install_gentoo
@install_gentoo 2 года назад
When I was implementing Tetris on my AVR game console, I solved it by updating the seed once at boot and writing it back to the EEPROM. One caveat is that it's probably dead after the guaranteed 100k writes.
@IngwiePhoenix
@IngwiePhoenix 2 года назад
Small protip: If you want to see the most insane Tetris stuff, look up: Classic Tetris World Championship. Trust me, you will not regret this and "BAM! TETRIS FOR JONAS!" will somehow engrave itself into your vocabulary :P
@rcmaniac25
@rcmaniac25 2 года назад
I remember building a VEX Robotics robot and wanting it to work like a Roomba (just bounce around a room). I wrote a small state machine (if front-center bumper and is followed by left-center bumper, then turn right, etc.) but it didn't work well. I had to come up with a random function... a family member (who did math and programming) suggested bit shifting + xor based on bumper input. I did some wackiness, but got it working. It finally operated randomly... though it had a weird bug where it's logic was "bumper specific random number modification... on any bumper, after RNG update, backup a random value between 2 distances, spin a random amount of time, then go forward" but it would instead bump, backup, turn 90 degrees, move straight a short distance, 90 degrees, straight a short distance, then spin and go off in a random direction. I don't think I have the code anymore, but it was a fun challenge when starting to code. As for Tetris... I have an original Game Boy and played Tetris so much I would often be found asleep with a game over screen.
@jesusjammmer
@jesusjammmer 2 года назад
Love this episode! Tetris on Gameboy is one of my favorite games of all-time. Gameboy Color is probably my favorite video game console of all-time. My top 5 all-time favorite consoles (included handhelds) are 5.Colecovision, 4. Super Nintendo , 3. Sega Genesis, 2. Original NES and 1. Gameboy Color. I think because of Tetris Gameboy became my favorite.
@ashproof
@ashproof 2 года назад
I've been scratching my head wondering about this. I can finally rest my brain on this matter.
@kadosho02
@kadosho02 2 года назад
I was always curious how they were able to program each piece, order, and sequence that they fell. Plus knowing how many were to fill the game over screen. It is fascinating to learn more about this timeless classic. I'm even more curious if the RNG was also revisited in Tetris Effect. More of this please, love it
@bluefox9er
@bluefox9er 2 года назад
Fascinating. I know nothing about processors and programming. But the way you do it is awesome.. getting across a complex idea using simple language. That is the sign of genius
@punkshoo
@punkshoo 2 года назад
Thanks for this. Tetris is one of my all time favorite games and its nice to have this bit of knowledge on how the block RNG is calculated. Thanks for the vid!
@DYNANiK.official
@DYNANiK.official 2 года назад
00:22 Ouch, that crack would drive me crazy!
@BigMacOrange
@BigMacOrange 2 года назад
Breakthru on the snes is pretty good. Especially with the mouse.
@ukumra
@ukumra 2 года назад
Amazing episode...I'm totally geeking out!!
@aaronbraswell995
@aaronbraswell995 2 года назад
Hey king this rocked, if you ever figure it out I’d be amazing to learn how They were able to implement particle effects in golden sun
@SuperNicktendo
@SuperNicktendo 2 года назад
I like these videos. I didn't even know I wanted to learn how Tetris worked but here we are
@Zerbey
@Zerbey 2 года назад
I remember covering random number generation quite extensively when learning cryptography for my CS degree, it's a fascinating subject and creating truly random sequences is a huge challenge for programmers.
@luiscanifru
@luiscanifru 2 года назад
love this type of episodes, thanks!
@DanJonesShow
@DanJonesShow 2 года назад
1:00 you forgot Orange Ricky, Hero and Smashboy! 😅
@Smaxx
@Smaxx 2 года назад
Two notes I missed in an otherwise great video: I would have noted that part of Tetris' success was the fact Nintendo decided to sell it as a bundled game together with the console in many regions. So if one household had two kids, they most likely had two copies of Tetris, too. Can't say that about most other games (bar double releases like Pokemon for example). And as a second note: Super Mario Land (and many other games) are perfectly deterministic (which was mentioned), which is the reason things such as tool assisted speed runs are even possible (which would have been a neat note). The computer doesn't learn to play the game, it just learns the best sequence of inputs and their timing to achieve the "best score", deterministically, without randomness screwing it over.
@tagrauyoutube
@tagrauyoutube 2 года назад
you know that TAS's arent made using a computer controlling the game itself right? Its made by a player making changes to the game (like slowing the game down to visible frames per second or using save states)
@Smaxx
@Smaxx 2 года назад
@@tagrauyoutube That's a different kind of "Tool Assisted Speedrun". You can do either way and both are being done by different people. Either make the emulator help yourself play "better" or let the emulator learn and play on its own (the latter has been used to discover multiple (im)possible glitches in games such as Super Mario Bros).
@TheXev
@TheXev 2 года назад
I would love to see a breakdown of the technical differences between GameBoy Tetris and NES Tetris. Really great stuff that I can't get enough of.
@lady1kaka
@lady1kaka 2 года назад
Just one more nice example on how much trickier developing was back in the day.
@lambiepie6436
@lambiepie6436 2 года назад
Code: “I’ll do anything you tell me to do!” *writes RNG program* Code: “yeah about that…”
@lpaul3673
@lpaul3673 2 года назад
I didn't understand a word of that but I freaking Love your Channel
@BBfanfun
@BBfanfun 2 года назад
i remember getting the GameBoy in '89 with Tetris ! Always wanted to try it Linked to another GB, never got around to that
@909crime
@909crime 2 года назад
Could you do a video on planning your code? Like planning code structures and whatnot for games? it would be very interesting to see. Great vid as always!
@Bergwacht
@Bergwacht 2 года назад
My grandpa has had my Gameboy for 20 years and at 86 still plays Tetris every day, he says it's like chess in fast.
@rob_i208
@rob_i208 2 года назад
That backlit gameboy is beautiful! 😲
@marafolse8347
@marafolse8347 2 года назад
Even a die is pseudo-random because the seed is the starting values of the roll such as trajectory distance from the surface imperfections on the surface etc. If we had the exact same parameters for the roll we would always get the same number on a die.
@Nobe_Oddy
@Nobe_Oddy 2 года назад
SUPER Interesting!! Thanks for the knowledge MVG!!! :D
@danielvest9602
@danielvest9602 2 года назад
Love it when you dive into the code!
@willierants5880
@willierants5880 2 года назад
Got to see the original Tetris running on the original hardware a few years ago at a meet up.
@djfirewall
@djfirewall 2 года назад
4:10 nice reference, i saw live the 27C3 and i'll remember this screen shot from there (and not from the original xkcd)
@keeteeh
@keeteeh 2 года назад
I've been working on a Gameboy emulator and only just implemented DIV recently! Very nice timing haha
@grengren6421
@grengren6421 2 года назад
Love having this kind of insight into old games.
@gamernaut8864
@gamernaut8864 2 года назад
Excellent video. What an usual and interesting piece of Tetris history. Thanks MVG. Love the channel.
@xeostube
@xeostube 2 года назад
This could have been explained so much clearer. Basically you have a location in memory that's getting incremented relatively fast, going from 0 to 255, and then wrapping around to 0 again. When the player presses start the current value is divided by the number of Tetris shapes, and the remainder selects the piece. So the first piece is decided by when you press start. And the next piece is decided by how quickly you drop the first piece. And so on. There are some implementation details that makes it slightly more complex than that, but this is the core idea. It could have been explained so much better than it was in the video. Also, your C pseudo random function is the worst. Add and then multiply, or vs versa, don't add and then subtract. Geeze.
@xeostube
@xeostube 2 года назад
Nonetheless I encourage you to make more of this content, as it's genuinely interesting, an I'm sure you could do a better job with a little practice.
@LusRetroSource
@LusRetroSource 2 года назад
Another great episode and example of developers having to get creative due to the hardware limitations.
@vaclavtrpisovsky
@vaclavtrpisovsky 2 года назад
Sorry but actually, the Game Boy is way more powerful than it needs to be for Tetris. You could get away with no sprites, scrolling, secondary background layers, scanline interrupts and most other hardware features, and the game would be near-identical to the final product. I am fairly certain that a decent, possibly better RNG could have been made with the z80 CPU core only. This is because unlike what MVG is implying, the Game Boy’s buttons could be polled WAY faster than 60 Hz. Also, 32 kB is a lot for Tetris.
@Leyendlink
@Leyendlink 2 года назад
wow that screen in the original GB looks awesome!
@MultiTelan
@MultiTelan 2 года назад
I be playing Tetris since it was frickin current on game boy yet you just taught me how to say tetromino.
@markst.5383
@markst.5383 2 года назад
Even if it is truly random, it would be possible to get the same piece two times in a row. Thanks for the video! Keep up the great work.
@vytah
@vytah 2 года назад
7:03 XOR A is not used for the ex-or operation, it's used only to set the A register to zero in the most efficient way (as it takes only 1 byte and 1 M-cycle as opposed to 2 bytes and 2 M-cycles if done via LD A,0).
@tolstoj_
@tolstoj_ 2 года назад
Good to know.
@filanfyretracker
@filanfyretracker 2 года назад
the story of Tetris getting to the west itself is always interesting too. For what appears like a simple puzzle game its probably one of the most important games in the history of video games.
Далее
How Graphics worked on the Nintendo Game Boy | MVG
12:56
The Game Boy Color
40:06
Просмотров 171 тыс.
Why Doom is Awesome: Binary Space Partitioning
26:25
Can You Play A Game of Tetris... Forever?
7:44
Просмотров 843 тыс.
Lies of the Robots
34:26
Просмотров 221 тыс.
The Story of Another World on the Amiga | MVG
13:44
Просмотров 202 тыс.
Nintendo DS vs. Game Boy Advance
24:46
Просмотров 586 тыс.