26 ms·
>When something should change, you edit the freakin' code. If you have different kinds of hits then you make different procedures. e.g. magicPixieDustHit(monste
by Novashi 8y ago
>When something should change, you edit the freakin' code. If you have different kinds of hits then you make different procedures. e.g. magicPixieDustHit(monster, pixieDust, weapon, damage).
I dunno, maybe aim for something a little better than writing an exponential amount of functions for all of your interactions.
>FP apologetists want to make you believe that, but side effects are the actual point of the program.
If you want to make all of your co-workers hate you because randomProcedure changes shared state when it shouldn't, go right ahead. If you want to stop that, you're like two steps away from OOP's dependency injection when you write validator functions on the shared state object.
>I mean at least acknowledge that that's a highly subjective statement...
Games are about the worst choice for criticizing OOP because OOP is so useful for describing games. Procedural style is fine for Pong or Sudoku or really simple games, I guess. It's highly subjective in-so-far as the entire industry has mostly adopted it and released great games with it.
- jstimpfle 8y ago> I dunno, maybe aim for something a little better than writing an exponential amount of functions for all of your interactions. You mean "polynomial". And you are still not acknowledging that OOP doesn't help there either. There is only one way out: You as the programmer must do the sensible thing. If you really need runtime polymorphism (which you rarely need, if you structure things correctly and keep separate things separate), then for god's sake go ahead and do it. But in my opinion it's much cleaner to do it with explicit function pointers. > Games... > the entire industry has mostly adopted it and released great games with it. I think you are at least 10 to 20 years late. The games industry, especially in the AAA sector where performance is critical, seems to long have acknowledged that OOP doesn't work out.
- atoav 8y agoPlease consider watching (or reading) this talk. If you are interested in how a modern Game ECS works and why indeed OOP often isn’t the way to go: https://kyren.github.io/2018/09/14/rustconf-talk.html https://kyren.github.io/2018/09/14/rustconf-talk.html