6 Comments
User's avatar
Rioni's avatar

This looks like ECS. I've seen it many times but when I try to make a game following that paradigm. Everything is harder to do than in OOP. Sure performance is great but if I can't finish the game it's not worth. I've always been old that "you lack the mindset". That said, the megastruct approach seems to work fairly well for me and for people I know

0x's avatar

I am not a game developer, Data oriented design is hard at first but gets easier, it’s like using VIM for the first time until it’s starts feeling natural.

Dylan Falconer's avatar

I used to program OOP and I find it harder than DOD or straight procedural style. What helped for me is learning about the internals of a computer.

This is not ECS, ECS just follows similar principles. The framing of this article is about performance, though it's not an either/or performance vs reasonability. Understanding what the machine is doing makes the code more reasonable if it's aligned.

Rioni's avatar

I try to think that way too, I studied how memory works, registers, caché, TLB... I try to take that into account on my OOP, which isn't pure OOP but sometimes procedural and/or functional. Ah also, I didn't want to say that is ECS, just that it seems similar.

I think I can create programs following DOD but not for games as they're usually more dynamic programs with lots of changing behavior and sometimes that behavior changes or there is a general behavior with many exceptions.

I'm also biased since I was told OOP in University and I've never seen the source code of game that follows DOD that I find reasonable, but I've read source code of games following OOP that I find elegant and performant

Could I get orientation on where to see DOD in games applied correctly other than basic examples?

Dylan Falconer's avatar

Right, sounds like you already have the understanding. Are you applying it to everything? I've noticed in programming culture many people become dogmatic and inflexible which leads to dismissing ideas because there are edge cases they can't fit into the paradigm. Not saying you are doing that, just something I've noticed.

As for sources of DOD game code--not sure, perhaps anything Mike Acton or Tony Albretch have worked on.

0x's avatar

I believe every program should be written using DOD , it’s a system that aligns with the CPU , OOP doesn’t make sense if one actually thinks from the perspective of the CPU.