Introduction to Data-Oriented Design [pdf]

39 points10 comments3 hours ago
dustbunny

The real key pillar to this world view is putting the data first in your design of the algorithm.

So if your working on a physics engine and your optimizing collision detection, you think about the data in -> data out of the problem you are solving as the primary driver of how the code should be written.

You start with defining the data, and build from there.

Different types of applications all have different shapes of data so would have differently shaped optimal code. Eg) a physics engine would use some kind of spatial hash thing which can be optimized differently based on if stuff can be added/removed while it's running. A 3d renderer operates on big buffers of matrices and vertex data. A game is usually composed of some long lived things and a lot of short lived things.

The key message in Mike Acton's talk was:

"If you have different data, you have a different problem."

While ECS systems are not a panacea that solves all problems in a perfect data oriented way, they are generally more malleable than Object Oriented hierarchies. This means it's generally more feasible to write "near optimal" code in an ECS framework than in a mature Object Oriented code base.

But the key message isn't "use X framework", it's "start by defining the data".

inigyou

Serious question. Does DOD mean anything more than array programming, in practice?

show comments