How NES Games Use State Machines For Everything

  Рет қаралды 35,918

NesHacker

NesHacker

Күн бұрын

Пікірлер: 148
@atilathenun
@atilathenun Жыл бұрын
I was twisting my brain into a knot trying to program without atate machines, and then i finally bit the bullet and learned how to implement them. Completely changed my world and actually made me love programming
@NesHacker
@NesHacker Жыл бұрын
They provide such a great way of organizing many processes. Glad you learned how to leverage them :)
@colonthree
@colonthree 5 ай бұрын
Then you go into Hidden Markov Models and Markov chains... :'3c
@datboi1861
@datboi1861 4 ай бұрын
I'm currently at the "bite the bullet" stage of this transition.
@atreyumclewin8282
@atreyumclewin8282 Жыл бұрын
I'm a CS student in my third year right now, and games are my passion, and someday maybe even my career. As someone who's always thought of the NES hardware as brilliantly concise and who's limits allowed for excellent lessons in video-game design, I've always wanted to show off to friends, family, and employers "hey, look at this thing I made! it's a full-fledged game and it costs less computer storage than a screenshot!" NES games (and all video-games in general) always inspire me to continue learning, and now that I have the resources to actually start making the games that continue to inspire me... I feel more determined than ever Thank you so much for these absolutley amazing videos! They've given me excellent motivation and passion to continue working on games. Even if this channel doesn't survive for the next decade, just know that your work has inspired people like me to continue their second quest. For that, I thank you!
@deanrumsby
@deanrumsby Жыл бұрын
Glad to hear and see that the channel is growing at such a rate. The quality of the videos and the scripts are incredible! Thank you for all the content.
@NesHacker
@NesHacker Жыл бұрын
Thanks Dean. I put a *lot* of effort into the script and editing for this one in particular. I really wanted to cover the basics of SMs but do in a way that could also be entertaining. Turns out that's hard xD
@ReverendTed
@ReverendTed 5 ай бұрын
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!
@brandonr8269
@brandonr8269 3 ай бұрын
Buy an Arduino and start state machining your home. The lights, an aquarium, heck, anything. It's a very powerful concept that as the video says, takes programming from something that will drive you mad trying to keep everything straight in your head, into a network of simple functions that may or may not involve one another - your choice.
@massimobaldrighi
@massimobaldrighi 9 ай бұрын
Man, I have just done an exam at uni about state machines. I did not fin any “useful” application outside of theory, but after this video I understood a lot more of what I have done. Thansk
@FryAndLeelaAndBender
@FryAndLeelaAndBender 6 ай бұрын
Remember that computers are big Turing machines, so computers and their programs are composed of many, many states in practice... State machines are everywhere... no matter if you implement them as sequences of if-else, switch-case or with a shift register or some variable just changing its internal value, states are in every program you create...
@banban8481
@banban8481 26 күн бұрын
If you have already had an exam and do not understand the use of the state machine . I guess your uni or Professor already failed at teaching.
@doncapo732
@doncapo732 Жыл бұрын
I just came across your content, and wow! What an incredible channel! Not only is the content extremely interesting, but the presentation, depth, and delivery are all perfect. As a bonus, the audience has the opportunity to learn a few things. Thank you very much for the effort you invest in this. Keep up the outstanding work. Subbed!
@NesHacker
@NesHacker Жыл бұрын
Thanks, I’m glad you enjoy it!
@Brice23
@Brice23 Жыл бұрын
The first concept I learned in computer science. We had to describe a finite state machine for the behavior of an elevator.
@NesHacker
@NesHacker Жыл бұрын
They are extremely useful… so many applications it’s mind boggling 😂
@dedgzus6808
@dedgzus6808 Жыл бұрын
Hey man, I saw your message about being burned out. Really appreciate the videos you made. They helped me get my basic of NES coding in ASM down. Thank you.
@brandonr8269
@brandonr8269 3 ай бұрын
My Hallowe'en Arduino games work in the same way using state machines. It truly is the only way to keep track of things in the main program loop. I typically determine the main things I want to do, list them and use a byte variable initialized at 0 to be the "waiting for some player input" state of my (relatively) simple games, then either increment the byte or jump between 0-n states and end the game by resetting back to 0. Understanding what, why and how to implement state machines (it's quite simple, really) is truly like a cheat code if you are trying to learn programming.
@javirodriguez6852
@javirodriguez6852 Жыл бұрын
It was very interesting. It's always amazing when you discover the mechanics inside the code of a game. Thank you!
@NesHacker
@NesHacker Жыл бұрын
You're welcome, thanks for watching :)
@Nat-qm5vb
@Nat-qm5vb Жыл бұрын
Holy cow, this is EXACTLY the information I've been looking for.
@RedMoonArcade
@RedMoonArcade Жыл бұрын
Oh my! This is pretty great! From the content to the editing. Nice job!
@NesHacker
@NesHacker Жыл бұрын
Heck yeah! Thank you so much. Not sure why it performs so poorly... probably the thumbnail and title. Should have entitled it "Computers hate this one weird trick..."
@RedMoonArcade
@RedMoonArcade Жыл бұрын
@@NesHacker Well, the topic and content should interest only a select group of people, I assume.. and being at the mercy of YT recommendations.
@NesHacker
@NesHacker Жыл бұрын
@@RedMoonArcade Yeah it is kinda niche, but still… I think it’s possible to reach a wider audience with the right white hat clickbait 😂
@RedMoonArcade
@RedMoonArcade Жыл бұрын
@@NesHacker Haha, indeed! Never really tried to exploit thumbs myself but it is the "cover of books". Good luck with your channel, mate! Something really unique and cool you decided to cover.
@uberdan08
@uberdan08 Жыл бұрын
Thanks for this episode. Im learning programming now and like watching videos on programming for retro hardware. Seeing how the programming language is translated into bits/bytes makes a lot of the basic concepts more understandable.
@NesHacker
@NesHacker Жыл бұрын
You're welcome. At the end of the day it's not magic but math and modeling that make games :)
@thehollowknerd3858
@thehollowknerd3858 Жыл бұрын
@@NesHacker Math in programming is both a blessing and a burden (I'm referring to motion in three dimensions when I talk about a burden)
@BrendanMilos
@BrendanMilos Жыл бұрын
Love these videos! From a design perspective, my guess on elimnating state from the 8th row rather than the 9th is that most ui (points, health, time, etc) will need to display in that top row and that needs to account for state to update the values. Again, this channel is awesome, can't wait for more art and design related breakdowns.
@NesHacker
@NesHacker Жыл бұрын
I’m glad you liked the video! I have some ideas for an animation related video in the future so keep an eye out 😊
@AaronFullerMusic
@AaronFullerMusic Жыл бұрын
Wow, what a cool channel! Dude, I’m the guitar player in that band you saw last night in Vegas at the MGM…great to meet you yesterday!
@alexandreauclair8857
@alexandreauclair8857 Жыл бұрын
damn I need to revisite my computer math book there where talking about "automate" when it's in fact state machine
@NesHacker
@NesHacker Жыл бұрын
Automata and SMs are basically the same thing. Usually the term "Automata" is used when formally defining them mathematically (as in Deterministic Finite Automata, etc.).
@LukeKido
@LukeKido Жыл бұрын
The quality of your content is astounding! Thank you very much ♥
@kirby0louise
@kirby0louise Жыл бұрын
The waterfall on Zelda 1's title screen is animated using a group of 16 8x16 sprites. Related fun fact: The middle part of the sword's blade is made out of sprites in order to work around the 4 color limit for BG tiles. Same for some of the leaves on the title screen.
@NesHacker
@NesHacker Жыл бұрын
Leave it to @Kirby0Louise to go above and beyond with the knowledge :)
@violator1017
@violator1017 Жыл бұрын
No offence but this is not an explanation of HOW it works... 😉 The animation of the waterfall is made with 5 metasprites of 4 tiles each (4 times 8x16). The top of the waterfall(the splashings) is made of 2 metasprites that simply alternate between each other. The waterfall in itself is made by 3 metasprites BUT only the white part of it not the blue one... The blue part is made with background tiles. Now, everything is moving according a pattern of 5 cycles of 3 steps and there is a shift on the y position for each metatiles. It's difficult to explain by words but the effect is made by updating the metatiles AND by shifting downward them on a 5 cycles of 3 steps... Really smart ! 😎
@Xplouding
@Xplouding Жыл бұрын
Great video, very clear!! But i’ve a question anyway!! How we code a “state machine” in asm?? General idea is great, but how we implement it?
@elchappo1320
@elchappo1320 11 ай бұрын
Yall need girlfriends lol
@desertdude540
@desertdude540 5 ай бұрын
@@Xplouding The usual scheme is that if you have M things that can cause state transition ("inputs" in automata theory), you assign each a unique ID between 0 and M-1. Likewise, if you have N states, you also assign each a unique ID between 0 and N-1, where the starting state is assigned ID 0. Each state is then an array of M next-state IDs (indexed by current input), and the state machine is either an array of N states or an array of N addresses that point to states (indexed by current state), depending on whatever is most convenient for the underlying hardware's addressing modes.
@glauco_rocha
@glauco_rocha Жыл бұрын
Very good video as a playful yet technically sound introduction to general game design by showing the central primitive algorithm behind a game's logic. Well done.
@NesHacker
@NesHacker Жыл бұрын
Thanks! I put a lot into this one 😊
@reaver111
@reaver111 5 ай бұрын
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.
@thinksie
@thinksie Жыл бұрын
Cool! It's always the creativity and usage of simple and not-so-simple concepts in video games! The compressed images in many rpgs for example. The animated backgrounds of course. Getting to create "impossible graphics" by mixing sprites and background tiles or precise timing while editing the graphics memory :D
@NesHacker
@NesHacker Жыл бұрын
Game programming on retro systems is such a rich topic, I'll probably be making videos like these for years, haha
@thinksie
@thinksie Жыл бұрын
@@NesHacker At least that's what we are hoping for, more videos yay :p
@Bofner
@Bofner Жыл бұрын
As someone learning assembly language as a hobby (z80 for Master System, but same concepts) and living in Japan, I have to say I love your videos, especially the little Japanese messages thrown in. あなたも日本語を勉強している?
@NesHacker
@NesHacker Жыл бұрын
Great, how are you? :)
@captrojothe3rd
@captrojothe3rd Жыл бұрын
1:42 The waterfall is animated using sprites. Some of the leaves and part of the sword in the title itself are also sprites.
@NesHacker
@NesHacker Жыл бұрын
Yep :)
@brianspence3297
@brianspence3297 10 ай бұрын
Yep. Just ordered that hoodie. 🔥
@max1point8t
@max1point8t Ай бұрын
I mean, at the end of the day, state machines - as you said - are just a model for computation. you can model ALL of programming through state machines, the difference is the layer abstraction you're working at. Parsers and compilers are almost entirely implemented via abstract state machines as well.
@thehollowknerd3858
@thehollowknerd3858 Жыл бұрын
Thank you for making this video. It was really interesting. I'm glad to see your channel is becoming so successful. Have a wonderful day!😊
@NesHacker
@NesHacker Жыл бұрын
Thank you! You too!
@alizaidi5610
@alizaidi5610 Жыл бұрын
Such an underrated channel.
@NesHacker
@NesHacker Жыл бұрын
I’m glad you like my work!
@372leonard
@372leonard Жыл бұрын
I only use an actual state machine class for stuff if the logic has branching paths. for stuff like animations or level completion i just use a number or boolean.
@NesHacker
@NesHacker Жыл бұрын
Yeah, it's subtle but even if you're using a number of a boolean the animation can technically still be modeled as a machine. How you go about implementing the animation or logic is independent of the computational abstraction involved.
@FryAndLeelaAndBender
@FryAndLeelaAndBender 6 ай бұрын
Yeah! Indeed the "state" is a number or combination of bits signaling some event happening now...
@jaysonl
@jaysonl Жыл бұрын
1:39 - Sprites, sprites all the way down!
@NesHacker
@NesHacker Жыл бұрын
Correct!
@AndreasWilfer
@AndreasWilfer Жыл бұрын
I wish the like-button state machine let me like more than once.
@NesHacker
@NesHacker Жыл бұрын
One can only dream...
@James-l5s7k
@James-l5s7k Жыл бұрын
Love this channel.
@knghtbrd
@knghtbrd Жыл бұрын
Having actually done game development, the importance of this concept cannot be overstated. The overall structure even on a modern PC of how we *do* games is init, repeat game loop until done, shutdown. Game loop is draw, get input, think. Draw before think is a side-effect of modern GPU hardware and the driver stacks that feed geometry and shaders to them. From there everything is, as you say, either updating a state or making a decision based on a state. Even enemy AI is comprised of of states. Am I where I want to be? If not, move there. Is it time to update where I want to be? If so, choose a new destination. Can I attack? If so am I close enough to attack any heroes? If so choose the best target and attack them. A lot of programming works this way too, but _all_ games do it.
@NesHacker
@NesHacker Жыл бұрын
Yep. Even though I kinda thought it wouldn't do well as a video, the concept was so important I figured I needed to take a crack at teaching it for those who follow the channel earnestly trying to learn game programming. Maybe I should have entitled it "The dark secret behind ALL games..."
@sunderark
@sunderark Жыл бұрын
The waterfall is done through bank switching the tilemap? At least that's what I recall.
@bahamutdragons
@bahamutdragons Жыл бұрын
I doubt very much that the doors in Metroid which take 5 missiles are "5 states". Likewise enemies don't have as many states as they have health, states are about behavior. It's more likely that the state only changes once 5 missile hits have been registered.
@NesHacker
@NesHacker Жыл бұрын
The key point here is that it "can be modeled" as a SM involving multiple states. What you're talking about is called an "implementation detail".
@maverick_loneshark
@maverick_loneshark Жыл бұрын
State machines are abstractions ultimately and just like how there are many ways to implement a system, there are also many ways to model a system. That being said, I do take issue with the anti-pattern idea of "if you aren't doing it *this* way, then you are doing it wrong". We may have learned to use state machines as a formal way to describe and model systems, but that doesn't mean it HAS to be the only way. Had history been a little different we may have wound up using some other modeling methodology (whether for better or for worse is a separate issue).
@YouTrolol
@YouTrolol Жыл бұрын
I feel like i have to fundamentally disagree on your perspective of what a state machine is. in my experience and terminology, you'd use a state machine for a single object (you can have multiple objects with different state machines, or one object with many state machines, or any mix). for instance, a player character idle, running, jumping (up and falling down, or even just "in air" and allow variables just as the vertical speed to dictate which part of that state you're in. And to me that's the big difference. and idle waterfall doesn't have a state, it's an object or series of objects stitched together and alternates color pallette with a variable that changes over time. the variable is not in itself a state machine, but the variable can tell the object(s) when to change states. Edit: i guess what i'm trying to say is there's no good reason to need to segment off portions of code on an animated waterfall by using a state machine. maybe a normal animation function and then a different state for the fade, but to me i don't think the video came across in that sense.
@NesHacker
@NesHacker Жыл бұрын
I chose the words “modeled by” carefully. State machines are a way to model computation, and are not in and of themselves programs. Thanks for watching.
@darkkrenaissance42
@darkkrenaissance42 Жыл бұрын
Super Mario 3 stated right on the box ~ THE FIRST 4 MEGABIT GAME EVER ~!
@nickst2797
@nickst2797 Жыл бұрын
Hey man. Why did you take down the "The code that makes Mario move" video?
@simplicity69420
@simplicity69420 Жыл бұрын
Yeah, I'm also wondering why.
@NesHacker
@NesHacker Жыл бұрын
It’s back up now
@wishusknight3009
@wishusknight3009 Жыл бұрын
What is the difference between a state machine and a state variable?
@antagonista8122
@antagonista8122 Жыл бұрын
State machine is a higher-level concept/abstraction (that may be implemented in many different ways under the hood), state variable is just implementation detail.
@markaven5249
@markaven5249 Жыл бұрын
State machines are what I use instead of coroutines and/or events in .NET, C# and Unity. They're also more translatable to other languages, say you wanted to translate your C# codebase into C. You would want to use a procedural programming approach, making all public static classes and public static 'methods' first.
@CoolJosh3k
@CoolJosh3k Жыл бұрын
Not how I would explain it, but I do like these videos.
@NesHacker
@NesHacker Жыл бұрын
Haha, thanks. How would you explain it, though?
@CoolJosh3k
@CoolJosh3k Жыл бұрын
@@NesHacker I’d focus on branching code that depends on some value for where to branch. A visual example mimicking a switch statement from C, eventually ending with an ASM example where the branch instruction uses an address that is modified to effectively change the behaviour that is chosen. For non-code, I’d take the sample of gravity on a player falling off a cliff. Walking on ground, the state machine uses behaviour for player walking and checking if on ground. Then if ground isn’t there, change to a behaviour of falling, where it applies player falling and checking if on ground. This simple 2 state machine means it either has a player control routine or a player falling routine, with the only shared functions being checking for ground and setting the state. I’d then go into a what happens if it was in the walking state, but the ground was never detected from a bug (or missing instruction) just to show how the player would keep walking over the air like some Looney Tunes cartoon. This clarifies that there is a different behaviour that needs to be switched to be state machine control. For a real example, I think of the elevators in Metroid. If the player happens to press down while standing on the elevator, their normal behaviour switches to the behaviour state of freezing the character in place while the camera scrolls up. Animation state machines are too simple, imo. They don’t show the true power of state machine design.
@Xplouding
@Xplouding Жыл бұрын
@@CoolJosh3k some related link... to learn about??
@twobob
@twobob Жыл бұрын
The water looks like a set of pixels that move based on a lookup table of sines? maybe? differing speeds? doesnt sound very fast.... maybe alookup into already genned lumps of water? sounds faster
@NesHacker
@NesHacker Жыл бұрын
The real code uses foreground sprites to perform the animation
@brunch1572
@brunch1572 Жыл бұрын
The waterfall is palette cycling. Essentially periodically switching the assigned colors of a "paint-by-number" drawing to simulate animation.
@NesHacker
@NesHacker Жыл бұрын
I thought so too... but it's not ;)
@jengelenm
@jengelenm Жыл бұрын
Thanks you sooo much for your videos!!!! I can`t wait for the next one, i am curious on how to code the graphics. I wanna make my own game, but it looks so difficult. I am not sure if i will succeed, but it never hurts trying!
@ninjaguyYT
@ninjaguyYT Жыл бұрын
Before learning graphics, use text to represent stuff. For example, I had a checkers game with weapons. Instead of going straight to graphics, I made the game logic first by using X for player 1, O for player 2. Then I print out a screen that looks like. [X...] [X...] [....] [....] [O....] [O....] Then I made holes in the stage be like [----] And so on. If I added weapons to a unit, I wrote a number next to it to show what they have (5 might be a bomb for example). I also made it at some point to where the [X...] changed to To show player O that the enemy is on that square. Basically... Point is you can convey a lot with text.
@bitwize
@bitwize Жыл бұрын
I'm writing a 2D sidescroller and am quite surprised how many levels of state machines I need to encode behavioral changes in the player character, enemies, scenery objects like elevators, and the game itself. The engine contains special code constructs to manage all these states and make it easier to add or change them, because let's face it -- I'm lazy and scatterbrained and managing all this stuff on my own is hard!
@NesHacker
@NesHacker Жыл бұрын
For real, I am working on a simple movement demo for an upcoming video now and it's nuts how many state machines are involved even for something so basic.
@MrDarchangelomni
@MrDarchangelomni 11 ай бұрын
the mapper maps alternate tile data, to a single referenced memory location.
@Borhamus
@Borhamus 3 ай бұрын
amesing video!
@TheRootBeerKing
@TheRootBeerKing Жыл бұрын
Did you remove a video? I'm trying to find this video you did on Movement in Super Mario Bros 3, but I can't seem to find it anymore. Was it taken down by youtube? Did it even exist in the first place? Or am I having a false memory? Please help! I've been looking for at least an hour now.
@NesHacker
@NesHacker Жыл бұрын
It’s back up now, I had to fix a thing and repost it. Sorry about that!
@terry-
@terry- Жыл бұрын
Great!
@NesHacker
@NesHacker Жыл бұрын
Thanks!
@Protoman3
@Protoman3 5 ай бұрын
1:42 sprites moving downwards maybe?
@akko8210
@akko8210 Жыл бұрын
SOOO COOLL!!!!
@Xplouding
@Xplouding Жыл бұрын
Hi, wow, your videos are pure quality!! Thanks about that... but, (allways apears a but haa) can you expose an example of “how to code” a simple state machine in asm, I think I’ve an idea, but... thanks anyway
@Yu-Fei-Hung
@Yu-Fei-Hung Жыл бұрын
Any plans for a SNES Hacker channel or series?
@NesHacker
@NesHacker Жыл бұрын
Maybe… 😉
@twobob
@twobob Жыл бұрын
well i think you are great anyway. theres is that.
@NesHacker
@NesHacker Жыл бұрын
Well thank you for that, I hope you have a wonderful day :)
@XXLuigiMario
@XXLuigiMario Жыл бұрын
What happened to the latest video?
@NesHacker
@NesHacker Жыл бұрын
Just posted a community update about why I took it down.
@retropalooza
@retropalooza Жыл бұрын
But how did Nintendo code games in 1985. Did they have a programmer made? I'd like to know
@NesHacker
@NesHacker Жыл бұрын
Yeah as for the specific tools they used I am not too sure. The definitely coded the games using 6502 assembly, and probably used either 16-bit or 32-bit (absolute state of the art in 1985) 8086 or x86 systems. I'll look for more information about how it was done back then and if I find some good stuff I'll turn it into a video :)
@retropalooza
@retropalooza Жыл бұрын
@@NesHacker thank you sir. I've been looking into what devices if any they used but come up empty most times. I find it odd u don't see NES dev kits for sale. I hear ya state of the art, technology premiere might be just graph paper and coding on a PET lol...I had a girlfriend who worked in the Kyoto offices in the 2000s but she never knew what the NES utilized. She did manage to get me a disk writer kiosk that says property of G. Yokoi dept 2 on a sticker in the back and it appears to have all the wiring still intact but I believe it was to diagnose system trouble not create games. I was shopping auction houses to see which would give me the best take, but they aren't sure if the name tag is all the value or the writer it's a $500 or $50000 coin flip. I can't confirm if it's for programming. You interested in taking a peak at some photos to make an educated guess? Let me know and thanks for the reply and not treating me as a moron lol
@horsethi3f
@horsethi3f Жыл бұрын
Whats the alternative though
@gulpdiator
@gulpdiator 11 ай бұрын
4:51 I am pretty sure Luigi leaves an L, so the state is a bit more than true or false.
@Roxor128
@Roxor128 8 ай бұрын
State machines are amazing, but one of the most annoying things about trying to learn about them is that the overwhelming majority of material about them is only about software implementations. Hardware only gets mentioned in passing, and rarely mentions anything that would be useful if you wanted to actually try building one.
@Wuddigot
@Wuddigot 5 ай бұрын
A state machine is a coding pattern though. Each instance in a system has data for that "state" and the conditions to look out for to pass to a different state. you then have a handler that looks at the active state and looks for the the conditions to move to a different one that is defined in the active state. the hardware doesnt matter as much other than that it determines the memory/processing available needed to consider how much data and what methods should be used to hold the data within each state. State machine are a great way to organize the systems of any program running on tomagachis to cars, to anything using bluetooth, and more
@Wuddigot
@Wuddigot 5 ай бұрын
Disclaimer, I'm only aware of the software side of this myself 😅😂
@Roxor128
@Roxor128 5 ай бұрын
@@Wuddigot It's not just a coding pattern. It's extensively used in hardware as well. Things like DC balancing in communications links, error detection and correction, and as part of the control circuitry of a CPU. Hell, I think there are even devices out there with programmable state machines for use with I/O. You can find heaps of state-transition diagrams for state machines used in hardware, but very little about translating those into actual circuits.
@Wuddigot
@Wuddigot 5 ай бұрын
@@Roxor128 Oh that is very cool
@terry-
@terry- Жыл бұрын
Can you use OOP or ECS when programming retro systems (or show pseudo code that could be the implemented using OOP, ECS etc)? I know that you kind of must do the most performant code and such, and OOP is kind of in a bit of conflict but I feel that to be really usefull to game devs, the content I watch has to have some best practices to work with modern game development languajes and engines or APIs, becose, now days, the code has to be readable by other devs and manteinable. I have the same feeling for something like Pico-8, its nice and all, but such constraints I think its not good for beginners or rookie game devs like myself, trying to learn the best way to develop games. I feels this much constraints are good and exiting for experienced game developers that know the best practices and when to break them and hack away to get the best performance and save memory etc, and no so much for beginners that should learn the best practices for readability and manteinability for further expansion of the codebase and to posibly work with other devs without needing a manual for an advanced hack made for performance and such. This is only my opinion, of course you channel is about NES assembly programming, but I think you knowledge and way to explain things are great and could also be used for modern game dev too!. This video on the state machines is great, becose like you said it can be applied to any game, old and modern. More like this one! Chears!
@NesHacker
@NesHacker Жыл бұрын
It all depends on what you're trying to accomplish. If you just wanna make a game and do it quickly then going about it this way is a bad call. But if you specifically want to make an NES game, then you kinda have to do it this way... If you use engines or "maker" programs for the NES you'll be constrained because they don't implement everything that is possible.
@JarppaGuru
@JarppaGuru 9 ай бұрын
so lets use state machine draw 3d cube xD
@gizaha
@gizaha Жыл бұрын
Why "state machines" and not object state or animation frame, or even "cases"?
@NesHacker
@NesHacker Жыл бұрын
Because all of those things are methods of implementing state machines (which is a model of computation, not a specific implementation strategy).
@ceroenblanco
@ceroenblanco Жыл бұрын
This is why I pay the internet!
@NesHacker
@NesHacker Жыл бұрын
Haha, I'm assuming you liked the video xD
@BagOfMagicFood
@BagOfMagicFood Жыл бұрын
If we want to be pedantic, wouldn't Super Mario Bros. 3 levels have more than 2 states because they can be cleared by either Mario or Luigi, which makes a difference in what gets uncleared by a Game Over?
@NesHacker
@NesHacker Жыл бұрын
Something like that
@snitkofb
@snitkofb Жыл бұрын
If I recall, the waterfall uses palette cycling to get the animation.
@NesHacker
@NesHacker Жыл бұрын
Nay said the horsey
@snitkofb
@snitkofb Жыл бұрын
@@NesHacker I peeked at the asm. I should have predicted another state machine… (a loop that moves the sprites down, and cycles them based on next state).
@BagOfMagicFood
@BagOfMagicFood Жыл бұрын
I recall being impressed by The Fantastic Adventures of Dizzy animating its river by editing just the graphics tile used for water at any given time.
@jackwt7340
@jackwt7340 Жыл бұрын
Building an 8bit operating system is not an easy task, go for it 🐿
@NesHacker
@NesHacker Жыл бұрын
Maybe someday, that sounds arduous...
@cyko28
@cyko28 Жыл бұрын
Sub 300 view crew! Love your content!
@NesHacker
@NesHacker Жыл бұрын
Haha, you're so dangerously close to posting "Early Gang" ;)
@nodrance
@nodrance Жыл бұрын
I feel like you're giving the wrong impression here. NES games aren't fundamentally programmed as state machines, state machines are just a natural way to think about games and their systems.
@NesHacker
@NesHacker Жыл бұрын
I'm pretty sure I say "can be modeled using state machines" or something to that effect a lot in the video. I guess folks might not understand the difference between interpreting solutions by way of models and actual programming though if they are novices.
@Yadobler
@Yadobler 10 ай бұрын
Wow state machine, what a ptsd from cs computer org module
@lolcat69
@lolcat69 11 ай бұрын
4:36 ONE PIECE????!!!
@NesHacker
@NesHacker 11 ай бұрын
Secret anime reference…? Perhaps. 😂
@pinekel8987
@pinekel8987 Жыл бұрын
Hi, how are ya?
@NesHacker
@NesHacker Жыл бұрын
Great, how are you?
@esoij
@esoij Жыл бұрын
Wtf why are you a small KZbinr I thought you were bigger
@NesHacker
@NesHacker Жыл бұрын
Haha, I often wonder the same thing xD
@Mr7Shane
@Mr7Shane Жыл бұрын
my dude, a state machine is a high level formalisation, they don't exist in low level code. You are just talking about state. A number being incremented is not a state machine. You say "you can think of this like a state machine" to anything. Yea any state change can be thought of state machine. You could do math with a state machine. Just have every single number ever be a state, and then create your infinite transitions to all the other numbers. Being able to imagine something as a state machine doesn't mean it is one. Again, a state machine is a code formalisation. It's existence is fickle and trying to define things as state machines is pointless.
@NesHacker
@NesHacker Жыл бұрын
Yep, it's why I used the phrase "modeled by" a lot. Thanks for watching!
@SussyBacca
@SussyBacca Жыл бұрын
This title was clever but ultimately a waste of my time as I know state machines well 😢 please stop doing that
@NesHacker
@NesHacker Жыл бұрын
I’m sorry to hear that, hopefully it was still enjoyable 😔
@NesHacker
@NesHacker Жыл бұрын
I fixed the title and thumb... would you have watched this video had you seen it in your feed?
NES Hardware Explained
8:54
NesHacker
Рет қаралды 111 М.
Programming My Own 40KB NES Game
14:33
Inkbox
Рет қаралды 153 М.
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 3,2 МЛН
快乐总是短暂的!😂 #搞笑夫妻 #爱美食爱生活 #搞笑达人
00:14
朱大帅and依美姐
Рет қаралды 12 МЛН
МЕНЯ УКУСИЛ ПАУК #shorts
00:23
Паша Осадчий
Рет қаралды 4,9 МЛН
Game Boy Graphics & How To Code Them
9:02
NesHacker
Рет қаралды 100 М.
Making a cube in the most complicated way
7:27
tEEvy gamez
Рет қаралды 3,8 М.
Keeping Score on the NES
9:03
NesHacker
Рет қаралды 13 М.
New divisibility rule! (30,000 of them)
26:51
Stand-up Maths
Рет қаралды 233 М.
TAS Explained: Super Mario Bros. 3 in 0.2 seconds
19:39
100th Coin
Рет қаралды 445 М.
Programming a BETTER state machine
10:16
iHeartGameDev
Рет қаралды 81 М.
How To Get Back Into A Game, According to Science
22:26
Mark Maxwell
Рет қаралды 1,1 МЛН
NES Development Environment
14:58
NesHacker
Рет қаралды 355 М.
How we fit an NES game into 40 Kilobytes
12:04
Morphcat Games
Рет қаралды 3,6 МЛН
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 3,2 МЛН