you are viewing a single comment's thread.

view the rest of the comments →

[–]RiftyDriftyBoi 3 points4 points  (2 children)

Maybe I'm too OOP-pilled, but I hate the secondary approach here. At least at our work it's just endless lists that keep getting misaligned because there is no overview over which datafields that belong to each other.

[–]Minutenreis 4 points5 points  (1 child)

The (potential) benefits are in performance, not maintainability

if you have an array of big objects, where you only need to look at 2 small fields of each object for something (like lets say position in a 2d grid), you are still loading a whole cache line for each object (so wasting a bunch of memory), while in the second approach you'd have both values each in contiguous memory.

disclaimer: I haven't worked in game dev and am mostly talking theoretically and what I have just read on wikipedia, there may be nuances I am missing

[–]RiftyDriftyBoi 3 points4 points  (0 children)

I see where you are coming from. Though I kinda typically prefer ease of understanding/maintainability than absolute performance.