3 ms·
90s Java didn't do that because Java doesn't support multiple class inheritance. 90s C++, however, did. Funny you should cite a game example. I once read abou
by bitwize 3y ago
90s Java didn't do that because Java doesn't support multiple class inheritance.
90s C++, however, did.
Funny you should cite a game example. I once read about how the developers of StarCraft[0] ran into the same Goddamn inheritance problems I did when trying to build a custom game engine and a game with that engine. Adding behaviors via inheritance seemed like a good idea at the time (mid-late 90s), especially given all the propaganda we read from our C++ compiler manuals and such. But it turned into a situation where you either accepted multiple inheritance with all of its complexity and suck, including "which of the multiple base classes that implement 'foo' do I want when I call derived::foo()?" -- or resorting to delegates or other methods of composing behavior.
Me, for gaming, I became an ECS convert and haven't looked back. There are some pain points when writing a game in ECS style... but the advantages pay for the relatively minor pain many times over.
[0] https://www.codeofhonor.com/blog/tough-times-on-the-road-to-starcraft https://www.codeofhonor.com/blog/tough-times-on-the-road-to-...
CFlingy is a particle spawner. Why does that have to be in the inheritance chain, instead of a trait you add to an object?
- hprotagonist 3y agothe canonical blog post series:https://ericlippert.com/2015/04/27/wizards-and-warriors-part-one/ https://ericlippert.com/2015/04/27/wizards-and-warriors-part...
- lll-o-lll 3y agoWhy “canonical”? From what I can see, Entity-Component-System (ECS), long pre-date this blog series by Eric, and he doesn’t even reference the term. I did enjoy the read however! My own programming has evolved towards data oriented design over the years.
- fargle 3y agowow! that is a great reference. i've only found it summited a few times and only with comments here: https://news.ycombinator.com/item?id=10567360 https://news.ycombinator.com/item?id=10567360. not a lot of comments and i suspect somewhat missing the point because this submission started with part 5, which intentionally is only part of the series exposing the pros/cons, limitations, etc. of various approaches.