NesHacker
NesHacker
  • Видео 39
  • Просмотров 22 088 288
RNG on the NES
Try brilliant free for 30 days, and get 20% off an annual premium membership - brilliant.org/NesHacker/
In this episode I tackle Random Numbers on the NES and show a good way to implement RNG on 8-bit retro systems.
Support the channel: patreon.com/NesHacker
NES-RNG Example Project: github.com/NesHacker/NES-RNG
Credits:
Technical Editing - Kirby0Louise
Content Editing - Thomas O’Neil
Sources:
en.wikipedia.org/wiki/Pseudorandom_number_generator
en.wikipedia.org/wiki/Linear-feedback_shift_register
en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator
en.wikipedia.org/wiki/Randomness
en.wikipedia.org/wiki/Linear_bounded_automaton
en.wikipedia.org/wiki/Halting_problem
github.com/bbb...
Просмотров: 71 942

Видео

How Zelda Saves Your Game
Просмотров 236 тыс.3 месяца назад
Sponsored by Brilliant - brilliant.org/NesHacker/ In this episode I explore the history and technology that allowed the Legend of Zelda to be one of the first games to have saves. Credits: Technical Editing - Kirby0Louise Japanese Language Research Support - Masayo Okamoto Sources: en.m.wikipedia.org/wiki/The_Legend_of_Zelda_(video_game) en.m.wikipedia.org/wiki/Saved_game tedium.co/2019/02/21/v...
Game Boy Graphics & How To Code Them
Просмотров 91 тыс.6 месяцев назад
In this episode I explain Game Boy graphics and fly through some of the code behind those graphics... Support the channel: patreon.com/NesHacker Game Boy Graphics Project - github.com/NesHacker/GameBoyGraphics
Game Boy Development Environment
Просмотров 249 тыс.7 месяцев назад
I show you how to set up a Game Boy development environment so you can start coding your own games. Support the channel - patreon.com/NesHacker Amazon Affiliate Links: Game Boy T-Shirt - amzn.to/3tW8TCu Everdrive GB X7 - amzn.to/3sgTA6N Everdrive GB X3 - amzn.to/475Hmgk Development Tools / Repo: RGBDS - rgbds.gbdev.io/ VS Code - code.visualstudio.com/ GitHub Demo Project - github.com/NesHacker/...
A Tour of Game Shops in Japan
Просмотров 17 тыс.9 месяцев назад
I take you on a tour of some awesome places to buy retro games in Japan. Support the Channel - patreon.com/NesHacker Akihabara: Akihabara Station - goo.gl/maps/YherehXMwXSRCtVx7 Super Potato - goo.gl/maps/zS4VYoG4xsLDgfR68 Mandrake Complex - goo.gl/maps/XnXqqkyP1J4izJzM9 BEEP - goo.gl/maps/2x2jb7w4fMZ6oBKB6 Surugaya - goo.gl/maps/U2H8YPbuvsKfKbHS6 Friends - goo.gl/maps/SmiT7276PUDnSmiS9 Hardoff...
The Code That Makes Mario Move
Просмотров 518 тыс.10 месяцев назад
The Code That Makes Mario Move
How NES Games Use State Machines For Everything
Просмотров 32 тыс.Год назад
How NES Games Use State Machines For Everything
Computing Pi on the NES
Просмотров 183 тыс.Год назад
Computing Pi on the NES
NES Hardware Explained
Просмотров 108 тыс.Год назад
NES Hardware Explained
Coding NES Subroutines
Просмотров 55 тыс.Год назад
Coding NES Subroutines
NesHacker Patreon
Просмотров 2,1 тыс.Год назад
NesHacker Patreon
Coding NES Loops
Просмотров 28 тыс.Год назад
Coding NES Loops
The CIC & 10NES Explained
Просмотров 59 тыс.2 года назад
The CIC & 10NES Explained
NES Architecture Explained
Просмотров 276 тыс.2 года назад
NES Architecture Explained
Bitwise Logic - 6502 Assembly Crash Course 04
Просмотров 21 тыс.2 года назад
Bitwise Logic - 6502 Assembly Crash Course 04
Channel Update - October 2021
Просмотров 4,3 тыс.2 года назад
Channel Update - October 2021
Zelda Warrior Princess
Просмотров 15 тыс.2 года назад
Zelda Warrior Princess
Branching - 6502 Assembly Crash Course 03
Просмотров 23 тыс.2 года назад
Branching - 6502 Assembly Crash Course 03
NES Controllers Explained
Просмотров 83 тыс.2 года назад
NES Controllers Explained
RAM & Addition - 6502 Assembly Crash Course 02
Просмотров 40 тыс.2 года назад
RAM & Addition - 6502 Assembly Crash Course 02
Basics - 6502 Assembly Crash Course 01
Просмотров 110 тыс.2 года назад
Basics - 6502 Assembly Crash Course 01
NES Graphics Explained
Просмотров 228 тыс.3 года назад
NES Graphics Explained
NES Development Environment
Просмотров 346 тыс.3 года назад
NES Development Environment
Welcome to NesHacker
Просмотров 11 тыс.3 года назад
Welcome to NesHacker
Final Fantasy Better Shops ROM Hack Pt. 3
Просмотров 7 тыс.3 года назад
Final Fantasy Better Shops ROM Hack Pt. 3
Final Fantasy Better Shops ROM Hack Pt. 2
Просмотров 9 тыс.3 года назад
Final Fantasy Better Shops ROM Hack Pt. 2
Final Fantasy Better Shops ROM Hack Pt. 1
Просмотров 14 тыс.3 года назад
Final Fantasy Better Shops ROM Hack Pt. 1
Binary & Hexadecimal Demystified
Просмотров 16 тыс.3 года назад
Binary & Hexadecimal Demystified
NES Carts Explained
Просмотров 36 тыс.3 года назад
NES Carts Explained

Комментарии

  • @iLLadelph267
    @iLLadelph267 21 час назад

    this reminds me of the exploration Veritasium and Vsauce did a few gears back exploring random vs truly random. in short, no macroscopic natural process is truly random since knowing the initial conditions to a system and its properties theoretically makes it perfectly predictable. really hard to predict, but in theory not *truly* random. the only truly random systems we've discovered are quantum processes which have no discernable way to predict an outcome thanks to the ol Heisenberg Uncertainty Principle: the more you know about one part of a quantum process, the less you know about its other parts. which is one reason quantum computing is a big field of research. almost like a holy grail of encryption awesome video! now i wanna know how modern game consoles took things further than just using bigger numbers and faster processing

  • @Retroman8000
    @Retroman8000 22 часа назад

    Assembly yes c++ nope python yup cobol dope

  • @Dicateaux
    @Dicateaux День назад

    dude, this is really really cool of you to do. thank you

  • @patrickaker4380
    @patrickaker4380 День назад

    Shout out to one of the greatest shapes to ever exist in human history.

  • @Aki-kh2qe-StreetKidZZZ
    @Aki-kh2qe-StreetKidZZZ День назад

    pseudo comes from the Greek world ψεύτικο which translates into fake Either way that was informative video

  • @mistery8363
    @mistery8363 День назад

    doesn't the background color use the "transparent" colors of the palettes?

  • @ButteredToits-
    @ButteredToits- День назад

    This was awesome

  • @seanstephenson7081
    @seanstephenson7081 День назад

    I had zelda...you didn't have to do this..

  • @DarkShroom
    @DarkShroom День назад

    so no like test or demo at the end of it running, no point then.... you should at least make a deal or running it like and the final result... run program, compare it to other contemporary examples, and one modern one for a laugh

  • @tbird81
    @tbird81 День назад

    Such a scmbag company. I hate that the internet loves them.

  • @ManuFortis
    @ManuFortis День назад

    That styrofoam filler is more important than you might realize. If the PCB sticking out of the bottom of the cartridge were to be impacted in a bad way, that's damaged goods. That's lost profit. Putting a bit of styrofoam (which was all the rage back then) solves the entire problem. The plastic shell mostly protects the PCB from the sides on all 5 covered sides, except that slot opening. The styrofoam does the job well enough, while being cheap enough to not care about lost profit from adding the styrofoam. The box being bigger because of it all, is just a nice addition for marketing.

  • @airsoftgunjk
    @airsoftgunjk День назад

    Why would you compute pi using 6400 bytes when you can hard code 960 digits of pi in 480 bytes or less?

  • @Agnes.Nutter
    @Agnes.Nutter День назад

    But, if this RNG algorithm can’t start with 0 or it will get stuck, surely that means it can also never output a 0, since the output is the starting point for the next iteration? So wouldn’t the d20 code want to range from 1-20 instead of 0-19?

  • @stone5against1
    @stone5against1 День назад

    I did it for every single game, even the ones without saves, because I was used to do it for the ones that "required" it. I mean better do it for all than risk forgetting for the ones that matter.

  • @krishacz
    @krishacz 2 дня назад

    haha pee pee you

  • @Scrap-dog8181
    @Scrap-dog8181 2 дня назад

    Which is why the older games are better then the games of today.

  • @IVR02
    @IVR02 2 дня назад

    Off the top of my head, I know that the two R.O.B. games generally had the converters inside. Were there any others?

  • @peterp79
    @peterp79 2 дня назад

    Dumb.

  • @lindoran
    @lindoran 2 дня назад

    I recommend you look at George Marsagela's paper on the xor shift algorithm. This could be implemented at any bit depth and produces a very large sample space while using no arithmetic operations simply bit shifts and logical xor. This is absolutely producable by using a memory location and a battery backed ram. It's a shame the paper wasn't published until 2003, this kind of algorithm would have been formative If used in the 1980s for video games or cryptography.

  • @mkaali
    @mkaali 2 дня назад

    Yes.

  • @crackedfrost
    @crackedfrost 3 дня назад

    Are you wearing a bra?

  • @RetroCabeza
    @RetroCabeza 3 дня назад

    As a classic Tetris player, I find this video really interesting. Thanks to the seed being randomized before the game starts, we can have Tetris GYM and play with the same seed in two separate games.

  • @Akwardpotion99
    @Akwardpotion99 3 дня назад

    5:02 nice easter egg :3 可愛い猫<3

  • @Drake33333
    @Drake33333 3 дня назад

    I remember as a kid holding reset for the first few times and then trying it without holding reset and it still worked fine so I stopped holding reset. I never lost a save, so it seems I was lucky. :-D

  • @nyguesswho
    @nyguesswho 3 дня назад

    It’s really mind blowing how programmers did all this math in assembly, with no float point calculations and essentially had to write their own math rules. Programming took a different kind of genius back then, especially to pave the way and come up with all of this as a standard for things like movement.

  • @Bagadeso
    @Bagadeso 3 дня назад

    Und deshalb hatten unsere Konsolen immer diesen restbug und wir haben die Spiele ausgeblasen wie verückt

  • @Jerupitus
    @Jerupitus 3 дня назад

    Great video, fascinating stuff

  • @8KilgoreTrout4
    @8KilgoreTrout4 4 дня назад

    Interesting!

  • @BrunoSGamba
    @BrunoSGamba 4 дня назад

    A lot of bla bla bla, to have more time on video, I just left in the middle of the video, please try create a content without repeating the same information over and over to create more time on videos :) our lives are busier 😂 thank you!

  • @________Cj_________
    @________Cj_________ 4 дня назад

    5:42 the lick

  • @rj6n_
    @rj6n_ 4 дня назад

    👾

  • @vuurniacsquarewave5091
    @vuurniacsquarewave5091 4 дня назад

    Funny that the way I tested my RNG implementation was by writing the output to the $4011 register continuously at a decently fast rate to produce a sound with it. Since I pretty much remade what the noise channel does by default I heard the same white noise that repeats over a few seconds. But I never thought of rejection sampling, I was satisfied by masking off the bits and then looking for some value(s) to get chances of x over 2,4,8,16, etc.

  • @gabrielesilinic
    @gabrielesilinic 4 дня назад

    I like xorshift better

  • @Uneke
    @Uneke 4 дня назад

    EVERYTHING has a pattern. Even dice It all comes down to math. If you have the exact same momentum, starting points, movements and release/ shake times every time, you will get the same rolls.

  • @reaver111
    @reaver111 4 дня назад

    I'm working on my own game in Godot, and seeing how older devs did things sometimes has modern world implementations. Game Maker for example is almost entirely state machine based.

  • @SittingDuc
    @SittingDuc 4 дня назад

    Not all dice are "fair", and may provide some numbers more often than others. A good lfsr is of maximal length: providing every possible output before repeating, but some have been notably shorter - 96 values not 255 in one example - usually to the delight of the hackers and speedrunners..

  • @EliasWolfy
    @EliasWolfy 4 дня назад

    2:47 6.25 / 2 is 3.125 🤯

  • @DDavEE
    @DDavEE 4 дня назад

    I don’t quite understand how the socket makes any difference? Unless the pin holes themselves need to be soldered regardless of whether the chip is there or not, that seems like it was completely unnecessary.

  • @domi-no1826
    @domi-no1826 4 дня назад

    Z = 0 Loop(Y) Add Z, X, A X*Y=A

  • @max_e_maxxy_
    @max_e_maxxy_ 5 дней назад

    A lot of later games did utilize the entire space, I wonder what tricks they used to keep them small on the Japanese market

  • @PowerStar004
    @PowerStar004 5 дней назад

    Here in 'merica, we like BIG carts and boxes. If only they'd included a gun with the system, it would've been perfect.

  • @user-qd7zb4wm9b
    @user-qd7zb4wm9b 5 дней назад

    quick question about the algorithm, if you need to store what base each digit is in, what makes the algorithm better than just storing all the digits in base 10? or is this just a proof of concept that the nes can indeed calculate the digits of pi 'by hand'?

  • @lincruste
    @lincruste 5 дней назад

    Don't EVER listen to people telling you asssembly is "not that hard". It's fucking hard and you gotta be a real smart person to use it. Really.

  • @pilotandy_com
    @pilotandy_com 5 дней назад

    0:11 - all the digits of pi?

  • @just-mees
    @just-mees 5 дней назад

    I love it when games have rng systems that are easy to guess and exploit. GBA Fire emblem's rng system is derived from the cursor's movement and it's movement arrow's direction, which means that with savestates you can rig anything just by wiggling the cursor around a bunch Edit: it's actually.. not that. Pathing a unit's movement is done when you move the cursor and this requires a call to randomness so your unit realistically pathfinds around obstacles and units which causes a shift and changes every subsequent random number generated. Shoulda googled it

  • @thomasphillips885
    @thomasphillips885 5 дней назад

    1:07 that empty() function bothers me. Just return (s.size == 0)

  • @OriginalSebie
    @OriginalSebie 5 дней назад

    I tried this but got different numbers? From 87 [01010111] shifted to 43 [00101011], since we removed 1 from end, did 43^184 (or [00101011] ^ [10111000] in BIN) with result of [10010011] = 147 🤔 next from 147 [10010011] shifted to 73 [01001001], last removed bit was 1, so [01001001] ^[01001001] gave result [11110001] = 241 .. So instead of sequence 87, 192, 201, 55, 32, 173, ... I got: 87, 147, 241, 192, 96, 48, 24, 12, 6, 3, 185, 228, 114, 57, 164, 82, 41, 172, 86, 43, ... and so on. Am I doing something wrong?😮 The sequence repeats itself after 255 values as there is no 0 (as explained in the video). Two annoying things about this generator: - even numbers get just shifted to right and therefore create very recognizable patterns of descending values in the sequence.. - sequence repeats itself with same numbers, so after a specific value you will always have the same next value as in previous run Maybe this can be fixed by getting not only "random" seed, but also "random mask" for XOR operation?

  • @CrimsonSteelMoonTheWolf64
    @CrimsonSteelMoonTheWolf64 5 дней назад

    I remember there was a computer experiment to overload ram to the point it spits out garbage numbers and values that are truly random. Don't know the validity of it though

  • @darthtorment
    @darthtorment 5 дней назад

    So what does a NES do when you you feed it an endless string of 0s for it's seed?

  • @themnemosyne666
    @themnemosyne666 6 дней назад

    In fact, it's just Americans who don't accept what the Japanese do and want to Americanize everything, they do this with games, films, cartoons, etc.