Yeah just for me personally I also really liked making things as efficient as possible, but I thought data structures and algorithms were lame because I had zero context around it.
Maybe that’s just how it’s taught though, because there are really cool examples of what data structures to use and why. For instance if you have npcs with attacks that all have different cooldowns, and a central system that applies the attacks, what’s the best way to store it? A min tree is O(log n) on insertion, so that seems best, but what if it’s very likely an attack is invalidated and you need to remove it before it triggers? Lots of interesting concepts to consider there, instead of just “this does x and has y properties, so it’s good in this use case.”
Oh yeah, and that’s where I think that knowledge comes in handy because they don’t just say “here’s a list of structures to use and the rules of when to use them” but they give you tools for evaluating how good various ideas are for handling that problem. It boils down to pretty much counting the CPU operations (which IMO is obvious, if tedious-seeming) and then goes through examples of how to do this to show that the math isn’t actually that overwhelming.
Also it helps seeing equivalence between problems. Like your example is pretty much equivalent to scheduling threads on shared CPU resources with different priorities, especially if there’s a shared global cooldown between all those skills so they don’t just fire off when ready. They are a bit different but they might be close enough for a similar solution to work. So research can include CPU schedulers. Though on the other hand, something running at a game time resolution is trivial compared to the OS that needs to determine this as quick as possible so it can switch to the next thread (which is also an important consideration because it might not be worth optimizing this part at all vs say the order you process the data in each frame, though this isn’t a lesson from algorithms or data structure class but more general “how to optimise usefully” advice).
Yeah just for me personally I also really liked making things as efficient as possible, but I thought data structures and algorithms were lame because I had zero context around it.
Maybe that’s just how it’s taught though, because there are really cool examples of what data structures to use and why. For instance if you have npcs with attacks that all have different cooldowns, and a central system that applies the attacks, what’s the best way to store it? A min tree is O(log n) on insertion, so that seems best, but what if it’s very likely an attack is invalidated and you need to remove it before it triggers? Lots of interesting concepts to consider there, instead of just “this does x and has y properties, so it’s good in this use case.”
Oh yeah, and that’s where I think that knowledge comes in handy because they don’t just say “here’s a list of structures to use and the rules of when to use them” but they give you tools for evaluating how good various ideas are for handling that problem. It boils down to pretty much counting the CPU operations (which IMO is obvious, if tedious-seeming) and then goes through examples of how to do this to show that the math isn’t actually that overwhelming.
Also it helps seeing equivalence between problems. Like your example is pretty much equivalent to scheduling threads on shared CPU resources with different priorities, especially if there’s a shared global cooldown between all those skills so they don’t just fire off when ready. They are a bit different but they might be close enough for a similar solution to work. So research can include CPU schedulers. Though on the other hand, something running at a game time resolution is trivial compared to the OS that needs to determine this as quick as possible so it can switch to the next thread (which is also an important consideration because it might not be worth optimizing this part at all vs say the order you process the data in each frame, though this isn’t a lesson from algorithms or data structure class but more general “how to optimise usefully” advice).