![NesHacker](/img/default-banner.jpg)
- 39
- 21 945 974
NesHacker
United States
Registrace 20. 12. 2019
Videos that teach 8-bit hardware and software hacking by way of the original Nintendo Entertainment System.
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/bbbradsmith/prng_6502
codebase64.org/doku.php?id=base:small_fast_8-bit_prng
docs.amd.com/v/u/en-US/xapp052
users.ece.cmu.edu/~koopman/lfsr/
www.eetimes.com/tutorial-linear-feedback-shift-registers-lfsrs-part-1/
forums.nesdev.org/viewtopic.php?t=21496
electronics.stackexchange.com/questions/248950/sram-isnt-blank-on-powerup-is-this-normal
research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/
Music:
“Solar Flare” by Adi Goldstein
“Fragments” by Palm Blue
“Don’t Lose Your Grip” by Diamonds and Ice
“Blue Beings” by Tamuz Dekel
“Lost” by Downtown Binary
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/bbbradsmith/prng_6502
codebase64.org/doku.php?id=base:small_fast_8-bit_prng
docs.amd.com/v/u/en-US/xapp052
users.ece.cmu.edu/~koopman/lfsr/
www.eetimes.com/tutorial-linear-feedback-shift-registers-lfsrs-part-1/
forums.nesdev.org/viewtopic.php?t=21496
electronics.stackexchange.com/questions/248950/sram-isnt-blank-on-powerup-is-this-normal
research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/
Music:
“Solar Flare” by Adi Goldstein
“Fragments” by Palm Blue
“Don’t Lose Your Grip” by Diamonds and Ice
“Blue Beings” by Tamuz Dekel
“Lost” by Downtown Binary
zhlédnutí: 50 901
Video
How Zelda Saves Your Game
zhlédnutí 231KPřed 3 měsíci
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
zhlédnutí 90KPřed 6 měsíci
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
zhlédnutí 249KPřed 7 měsíci
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
zhlédnutí 17KPřed 9 měsíci
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...
How NES Games Use State Machines For Everything
zhlédnutí 31KPřed rokem
How NES Games Use State Machines For Everything
Bitwise Logic - 6502 Assembly Crash Course 04
zhlédnutí 21KPřed 2 lety
Bitwise Logic - 6502 Assembly Crash Course 04
Branching - 6502 Assembly Crash Course 03
zhlédnutí 23KPřed 2 lety
Branching - 6502 Assembly Crash Course 03
RAM & Addition - 6502 Assembly Crash Course 02
zhlédnutí 39KPřed 2 lety
RAM & Addition - 6502 Assembly Crash Course 02
Basics - 6502 Assembly Crash Course 01
zhlédnutí 110KPřed 2 lety
Basics - 6502 Assembly Crash Course 01
Final Fantasy Better Shops ROM Hack Pt. 3
zhlédnutí 7KPřed 3 lety
Final Fantasy Better Shops ROM Hack Pt. 3
Final Fantasy Better Shops ROM Hack Pt. 2
zhlédnutí 9KPřed 3 lety
Final Fantasy Better Shops ROM Hack Pt. 2
Final Fantasy Better Shops ROM Hack Pt. 1
zhlédnutí 13KPřed 3 lety
Final Fantasy Better Shops ROM Hack Pt. 1
I'm unlikely to ever make practical use of any of the content in your videos, and as a result I'm frequently coasting through them without fully internalizing the details, but the manner in which you present these esoteric and technical topics is simply addictive to watch. I'm definitely on a binge! Thanks so much!
Wonderful explanation! The only thing missing from this video is the "Nintendo Seal of Quality". (Except for being visible on the game boxes in the background.)
It's to remind the scum who's boss. Nintendo always liked to flaunt their contempt for their audience.
What can you do with a nes if you make a custom pcb with a altera max II CPLD 128k sram, and for shits and giggles throw an 8087 in there, and a esp32, and a small bit of flash,.im not sure if nes can boot from expansion port Throw a cartridge with another 128k of ram and ay8930, fpga, Put some serial ports and db25 and sd slot Now you have an nes thats just as capable as any c64
Side load "apps" via Bluetooth from my phone And can play everything anyone ever made for it back then And does more your nes can't Interesting if you include 8087 with mmc3 for the scanline counter Or use 80187, doesn't have to be connected to an x86, if the 6502 knows how to address it
Generate random numbers with 64bit precision quick then Including floating point!
Then with the nes you have two processors the 6502 for the logic and code Then The ppu with it's own separate ram and ROM So all that modding was for the 6502 You can repeat the same thing with ppu And add some sram, fpga and flash memory to store certain textures and tiles and can be manipulated on the fly quick using all those CPU expansions
Another mod you can do is replace both system ram and ppu vram with dual port sram So 4k dual port sram split in 2 2k banks ( iirc they both have 2k stock of ram) so they still from a stock point of view have their normal ram, but can also access another 2k page, just dont access the same memory location at the same time Interesting since now CPU has direct access to ppu ram and ppu can use CPU ram... so you also can use a shared or dynamic ram structure Blows Even Miyamoto and the rd1 engineers who made that Famicom minds なぜ私たちはそれを思いつかなかったのでしょうか?!
I wonder how much CPU went for rendering and how much for computing? Would be interesting to see video side by side where on one side your current code fills screen and on other side entire number is calculated first and then everything is printed once and with no animation.
Resume of Mario & Luigi: Brothership 1) Good: We got a amazing return of this saga. 2) Neutral: I cant process all of this, I was traumatized than this saga wont return cuz fault of Nintendo, and also the remakes Alphadream do just to SURVIVE, and Nintendo seeing them dying, without doing nothing...i hate this, they just spitted up this game, playing with our minds and making us suffering psicologicaly (if it wasnt for new and maker cant exist wonder) and economically...i cant process the trauma I just received yesterday...idk if cry or laugh of the boom-shot i receive... 2) Bad: I am upset cuz Toadsworth, Stuffwell, Alphadream and Charles Martinet are ☠️ rn cuz fault of Nintendo 🎉
question for programming peeps; when using a deterministic RNG like that found in most games... what's a way to reliably randomize what the 'first' seed is on power on?
jim jom jabackeram
Oh great! A battery inside a game cartridge. So what happens when the battery looses voltage and needs to be replaced?
ive been playing zelda 1 and 2 and crystalis for 30 years and have never had to hold reset before powering down. never once lost save data
2:58 16x16 or 4x4?
I had both Final Fantasy and Zelda and I NEVER held down the reset button. I never had any issues with it
It's still very manageable for something with a scope like this. I have never written anything for 6502, but I can tell you that 68k assembly is actually p*ss easy compared to MIPS and x86 asm.
I was literally going to say that I liked your T-shirt and then you you just gave me the link to buy it😊
tau
My muscle memory still holds reset to this day.
😂😂😂 the only way they can sue you for it is if they call you using one of the off Brands without their logo on it how would they know that you're using your own game and one of their devices it shouldn't be possible
Kirby's Adventure is one of the best NES games and the fact it came late into the system's lifecycle, literally after the SNES, is a huge reason why
I never had to hold reset to get zelda to save. Never had any corruption issues, either
Do this but better. Makes no since.
What is the NES cartridge with the largest amount of size inside? I played Empire Strike Back pirate for famicom and the chip was so big that it broke the case
Too many bits? Eh throw away ! Good stuff
y u didnt call the video "randomNESs"?
cause they never thought of that
brotato theme heart
today i learned that by overloading my brain with such complex algorythm and sophisticated math at a faster pace i can go sleep faster
Epic! Did not know you could do so much stuff in the NMI
Great explanation!
I always figured this was them being a bit too cautious. Back in the day I never did this and I never had a problem.
i had zelda back in the days ..i lever held reset before turning it off ...... ?!?! ......
Suddenly a windows user realizes: Most modern software is written in Assembly too. Programming languages like C, C++ and so on just convert their stuff into assembly.
Dam so letting my friends borrow my game when I was younger was a crime 😮
Another fun fact, you don't have to push the cartridge down. The games played just fine if you insert the cartridge and left it up.
It is possible to create a better random number generator these days. There is a cool video by Shironeko Labs called, SuperRT - Realtime raytracing on the SNES. I don't know if a video on how a custom expansion chip actually works. That would be cool though.
A blog called "The Cave of Dragonflies" has a great article about the rng in the first generation of pokemon games. If memory serves, the simplistic algorithm meant that when you're out of range and forced to reroll more than once the values end up highly correlated. This makes using certain balls to catch pokemon much harder than it's supposed to be 😅
I was looking for a way to more smoothly scale 0..255 to 0..20 after watching this video. ⌈20×tanh(x/128)⌉ where x is between 0 and 255 and ⌈⌉ means the ceiling function seems to produce a nice smooth (as smooth as integers can be) curve. 🤓 Having said that I do realize it would be absolutely slow on that (or any) hardware 🤔
Great vid!
If you're worried about the unpredictable cycle times of the d20 method (for reference, galois16o is 63 cycles) and you're willing to sacrifice 256 bytes of ROM, you could create a lookup table for each of the possible values of A to one of the 20 desired values. You could then e.g., use: "jsr galois16o, tay, lda d20_lookup_table,y", which has a predictable cycle count (tay is 2 cycles, lda has 5 if you don't cross a page boundary): Guaranteed 7 cycles instead of an unknown multitude of 63 cycles, doing the age-old Space vs. Time tradeoff.
Though 256 doesn't evenly divide by 20. So you'd introduce bias since you have each number 12 times for 12*20=240 bytes and are then left with 16 bytes for 20 numbers. You can use that to your advantage if you want to bias toward the middle and reduce the number of 1's and 20's (or bias toward them), but yeah, it's going to be slightly biased because you're 4 bytes short of exactly 13 repetitions. Another potential trade-off to make.
I would have preferred the Japanese version because any of us who owned the original NES know that the front loading system wasn't all that great and broke a lot of the time period and the whole concept allowing the games to expand is a complete joke because when you're going vertical there is no limitation
Fun fact : I have never once held reset during power off, and I have never lost a single save from this.
Best explanation I have ever heard for these concepts thank you!
I always enjoyed games where the RNG was the most unpredictable. It made it so you couldn't simply "go on autopilot" and repeat the same inputs just to force the same results. Sure, speedrunners can usually find ways around this, but to a casual gamer, excellent RNG is "truly" random. 🙂
That food mnemonic for exclusive or is so good. Can't believe I never thought of it that way. No food on either side? Can't choose any. Food on each side? I can't decide, there's too many choices!
in my dyslexic mind I read the title as "RING on the NES".
4:17 depending on the taps the number of random numbers can be way less than the size of the container
Cool stuff to share and no bs delivery is what I like
But, logicians know that when you offer 'sushi or pizza' the answer is 'yes'.
Now I want to know how RNG works in real life.
Ummm did you forget that you need random numbers to prevent a satellite from crashing into your camp? Watch wet hot American summer to learn more
Fascinating video, thank you for going so in depth.
Is a dice random? I think its debatable. If you could use the same force, pressure, angle, spin and possibly a few other things one could conceivably have a repeatable way to throwing a die that isn't random. But for all practical purposes its random.