A stack can be used for an "undo" system! If your stack data type represents actions the user has taken, you can easily pop off the top item in the stack and call some function to undo its effects.
@AnnisVeryGoodGames3 жыл бұрын
Nice, awesome example! :)
@Tarodev3 жыл бұрын
That's a fantastic use case
@HamieSAE Жыл бұрын
I am asking this: Wouldn't Command work better for Undo/Redo?
@qzlocxx3 ай бұрын
Thats the command pattern :)
@Tarodev3 жыл бұрын
This was a really thorough breakdown and I wish I had videos like this when first starting my journey. Subbed! Keep them coming!
@saffetsiraz2 жыл бұрын
Absolutely I agree. Keep them coming!👏👏
@Enzo_TheRizzler Жыл бұрын
Ok. So... after finishing this series I can say that it is awesome. Not only that you tell us how to use the code and so, but you also gave us some examples and I think this is very, very helpful, cause I learned some practical stuff, not just code and how to use it. 10/10 😁
@edisyo5 ай бұрын
Really professional and in-depth series. Thank you!
@voidling2632 Жыл бұрын
I don't understand anything but that's not your fault, it's 3am and I'm tired from programming all day long ... and my ADHD brain keeps distracting me. I like short videos, thanks for putting so much effort into them.
@Ryaurezh3 жыл бұрын
I like your simple-yet-comprehensive breakdown of how the structures work, how similar structures are different, as well as the practical examples on when to use them. I'm often frustrated when trying to implement something, only to realize it doesn't work and I don't know why, only to later find out there was a better solution all along. Look forward to seeing more videos like these.
@AnnaGlin Жыл бұрын
thank you for making this little series! I'm a beginner at coding and have had no formal education in the field (I'm normally an artist/illustrator ;)). this was a good initial overview of what these things can do. However, I'm still not sure how to actually use them. I would love to see a concrete example, like Brackeys does in his tutorials which are very effective for me - being more visually oriented I need to see what actually happens😅 but I understand it's a lot more work. I would love to see maybe small tutorials like, for example, recreating game mechanics (can be just one part of a game, like a character creator for example), using these methods. I just have no idea where to start and what it would look like actually using these, not just a bunch of abstract examples!
@LeahTynan2 жыл бұрын
This video is fantastic! 👏 Love how you combined theory with practical examples in game dev.
@turkeyjerkey3 жыл бұрын
One of my favorite uses of Queues and Stacks is in Graph traversal. The use of a Queue for BFS and a Stack for DFS perfectly benefits the algorithmic implementation of each! Great job on your video series, btw!
@AnnisVeryGoodGames3 жыл бұрын
Thank you! Great points, definitely. I considered making a video on graphs as well, maybe some day! :)
@yess.6558 Жыл бұрын
AMAZING SERIES!!! Thank you so much for these videos, this has been a massive boost to my C# & Game Dev journey :)
@wiglord2 жыл бұрын
a bit late to the party with my comment but thanks for this tutorial series, I have been using lists for a while but had no real grasp of dictionaries or queues/stacks. Your videos explained it pretty clearly and the use case examples really helped me get my head around the concepts.
@AnnisVeryGoodGames2 жыл бұрын
Great to hear, thanks! :)
@Soulzjd23 жыл бұрын
I have something to say. I approve of this educational content. That is all, good day.
@theblackdragon7321 Жыл бұрын
MTG (Magic the Gathering) is a great example of "the stack" because that's how the game is played. First in, Last out. TY for this little series. I'm trying to make a card game, and was wondering if I should use a list, dictionary, ect. It's going to be similar to Slay the Spire, so I may want to add cards to the middle of the deck, or discard pile, ect.
@veotachigo38472 жыл бұрын
This series was really compact and easy to understand, well done. 👍
@GabrielDias02233 жыл бұрын
That is the best explanation about Queues and Stacks I've ever seen, thank you so much!
@AnnisVeryGoodGames3 жыл бұрын
What an honor, glad to hear!
@purplegoop1247 Жыл бұрын
had no idea these were a thing, very helpful
@levayv2 жыл бұрын
We got Pool explained as a Bonus ? Nice !
@Skeffles3 жыл бұрын
This was a fantastic video series! I use queues all the time but I rarely find myself using stacks but now I know to use them in a card game.
@AnnisVeryGoodGames3 жыл бұрын
Haha yes, stacks are a bit less practical, really, but make sure to use them in every card game you ever make! ;P
@Skeffles3 жыл бұрын
@@AnnisVeryGoodGames Actually I take it back. I just found a use for a stack. I've got a lives system with a set number of hearts, so push on new lives and pop off old ones.
@AnnisVeryGoodGames3 жыл бұрын
@@Skeffles heh, awesome! I actually used lives as a generic example for lists in the first video, but a stack can totally work for this! Someone else mentioned an undo-system as a stack use case BTW, which I thought was a great example as well.
@divainsyoutube42542 жыл бұрын
Great video series and content. I loved the simplicity and examples
@AnnisVeryGoodGames2 жыл бұрын
Thanks, glad to hear that!
@jsn45913 жыл бұрын
Great little series! This was all stuff I vaguely knew but you've helped solidify much of it. You explain things really clearly, great visuals too and the occasional joke is nice. Thanks
@chelwebster4782 жыл бұрын
Thanks for making these videos, they've been great! Very informative and at the same time very concise
@andreyradovski85143 жыл бұрын
Very nice beginner-friendly explanation, thank you!
@saffetsiraz2 жыл бұрын
Thanks for the simple explanation ❤
@charlesgosmexr2 жыл бұрын
Just finished your amazing set of tutorials. These really helped!
@GlennVerheij3 жыл бұрын
Thank you, I learned things. 😌 As a jack of all trades game developer, these fundamental videos are super useful. Wouldn’t mind seeing more of these, or maybe something like design patterns in the context of Unity? Anniway (HA) well done. 🙂
@AnnisVeryGoodGames3 жыл бұрын
Awesome, that's glenntastic to hear (double HA!) 💥
@GlennVerheij3 жыл бұрын
@@AnnisVeryGoodGames 👌💀
@MuhammadAli-gs1co2 жыл бұрын
Great video from start to end!
@markorossie92963 жыл бұрын
A pathfinding game - Make a bot find the path through a mesh. You can use a stack to record the moves of the bot & backtrack in case it reaches a dead end. Use a depth-first search algorithm here. Similarly Exploring nearest ally bases - Create a battlefield map with ally & enemy bases spread out through the map. Drop your commando at a random location & make it search for the nearest ally base. To implement this can use a queue to traverse through the map, & find the nearest ally base from your location. The algorithm to be used here is Breadth-first search. Stacks are often used when there are interrupts to handle, or when having recursive functions, or even when constructing a rudimentary AI for your games. So pretty much an extreme useful DataStructure in some cases.
@AnnisVeryGoodGames3 жыл бұрын
Great practical examples, nice!
@berthasebastian14902 жыл бұрын
Thank you, your series is very helpful. I use it as a study aid for job interviews! I think you should do some algorithms for game dev?
@dererzherzog3 жыл бұрын
Your videos are very informative, but what I really like is how you keep them short and to the point. I am looking forward to watching new content on your channel!! As for queues, is it possible to acces a particular [i-th] element of a queue, like in arrays or lists?
@AnnisVeryGoodGames3 жыл бұрын
Thanks :) Yeah, since Queue inherits from IEnumerable, you can use yourQueue.ElementAt(i).
@visheshkhurana12112 жыл бұрын
Amazing!! waiting for binary trees and graphs and linkedlist :P
@Berndr3 жыл бұрын
Amazing and best tutorial on data structures I have seen.... sorry a total noob question not sure if it is stupid ... I am curious what happens if two trains arrive at the same time to the crossing, how is this managed by queue and what train will have priority ... do train crash or the unity system? by the way absolutely loved your approach to tutoring
@AnnisVeryGoodGames3 жыл бұрын
Thanks! Haha, I hope Unity doesn't crash because the trains arrive at the same time! ;) Even if they arrive during the exact same update cycle, Unity's event functions (Awake, Start, Update, etc.) and collider functions (OnTriggerEnter etc.) are called in _some_ order, so one train will be added to the crossing's Queue first, and then the other one. Once a train leaves a crossing (as determined by a collider), the crossing checks for any remaining queued trains and "tells" the first in-queue to continue. In the game, trains from two different directions will always take turns moving onto the crossing due to the Queue data structure. Hope that makes it clearer!
@Berndr3 жыл бұрын
@@AnnisVeryGoodGames That is a fantastic answer and very clear thank you so much for clearing this up ...
@sh4dup6923 жыл бұрын
Hey I'm curious about your project on track and how did you create train movement on the track /path
@lufasumafalu50692 жыл бұрын
would be grear if you make step by step example in simple games demonstrating the use of each data dteucture
@googleuser47208 ай бұрын
Thanks, I had ChatGPT answer this question in less than 30 secs compared to your 9 minute video. Also chat GPT is more concise
@mercantilistic3 жыл бұрын
Please do more on object pooling
@AstralNostalgia11 ай бұрын
sorry I got a question , in the middle of the queue? you say "read only"... but tecnhically you should copy a queue collection in new one? because you can not access to any elemens in fifo (queue)? or am I wrong? ...if an element in the middle is needed , probably list or array are better? thank you.
@AnnisVeryGoodGames11 ай бұрын
I'm not sure about what you are asking at the beginning of your comment. But if you need elements from the middle of the collection, then a queue is probably not the correct data structure for your use case, yes.
@DonsT1992 жыл бұрын
Good Tutorial but if we had an good open world , how to do parkours based on particular building or thing ...eg: Dying Light .. I Don't know right or wrong so any data structures behind this much handlings?
@edi_gun_awan3 жыл бұрын
Thank you
@abdurraqib70313 жыл бұрын
where can i play the train game? it looks so fun !!
@AnnisVeryGoodGames3 жыл бұрын
Thanks! It'll be on the Android Play store soon! I'll make a video when it's ready. :)
@kaleb_t48183 жыл бұрын
Hey, I'm working on an enemy spawn system with waves. But I new to programming and cant figure out how to make a system which allows me to control the amount each type of enemy I spawn in a specific wave.btw I saw all your vids on data structures, they were very helpful. But I cant couldn't find a way to use them for my case. Any tips?
@AnnisVeryGoodGames3 жыл бұрын
It sounds like you could for example try out a pooling system using a Queue or Stack to store all the Enemy GameObjects. Not sure what the exact issue is that you're facing for your enemy types, but consider posting your question in the Unity forum with more details! (What exactly is the issue? What do you want the wave spawn system to do?)
@kaleb_t48183 жыл бұрын
@@AnnisVeryGoodGames my issue is I can't figure out a way to control the number of each type of enemy per wave. For example if i wanted to spawn only enemy-1 3 times in the first wave and in the second wave enemy1 - 4 times and enemy2 - 2times then in the third only a single enemy3 as a boss fight. I'm looking for general tips of what I should be looking into
@AnnisVeryGoodGames3 жыл бұрын
Sounds like you'd want to store those numbers somehow, for example as simple constants, or if you have a lot of waves and a lot of enemy types, you could actually use a dictionary of dictionaries: Dictionary numberOfEnemies; The first int is the wave index, EnemyType could be an enum of available enemy types, and the last int would be the number of enemies to spawn for a given wave and enemy type. For wave 5 and enemy type "CrazyKaleb" ;) , you can get the number of crazy Kalebs to spawn like this: int numToSpawn = numberOfEnemies[5][EnemyType.CrazyKaleb]; But it always depends on your situation of course.
@kaleb_t48183 жыл бұрын
@@AnnisVeryGoodGames oh so dictionaries are the way to go, I'll do more research into them(I'm sure ur vid will suffice). Tnx alot I really appreciate it 😊
@dragonalias3 жыл бұрын
I knew about all of the data structures, but the one I knew least about was Hashsets. You mention you can do something called intersect/union... and I still don't understand what that means.
@AnnisVeryGoodGames3 жыл бұрын
Oh no, the tutorial failed you! :-o You can check the C# docs, the HashSet has these operations documented as well.
@dragonalias3 жыл бұрын
@@AnnisVeryGoodGames Yes it's very sad. I even watched it twice XD Alright, maybe I'll do that some day.
@quasar47803 жыл бұрын
In short, since HashSets cannot contain duplicates, you can use IntersectsWith and UnionWith to compare two HashSets and see if they have values in common (Intersection) or to combine them together without having any value added twice (Union).
@dragonalias3 жыл бұрын
@@quasar4780 Ah, I get it now. Maybe her example made me confused, it's actually pretty simple. Thank you :)