4 ms·
I don't have a lot of knowledge on ECS, are there any good articles out there that compare it to OOP?
by bloopernova 3y ago
I don't have a lot of knowledge on ECS, are there any good articles out there that compare it to OOP?
- skydhash 3y agoAnything that argues composition versus inheritance.
- GuestHNUser 3y agoI recommend reading this book on Data Oriented Design[0] since the underlying reason ECS has been widely adopted is because, written correctly, an ECS system can take full advantage of modern hardware. Most ECS vs OOP blogs come at it from a perspective that I personally find flawed. OOP has the tendency to have objects layed out poorly in memory which prevent programmers from utilizing SIMD instructions[1]. [0] https://www.dataorienteddesign.com/dodbook/ https://www.dataorienteddesign.com/dodbook/ [1] For instance, objects in OOP are typically bundled with other data related to the object. As an example, in OOP a Door object could have float X,Y,Z coordinates, an enum for type of door it is, a bool for opened or close etc. This leads to inefficiencies in cpu cache usage when you are iterating through a list of doors and not using every field of the door object. See this GDC talk for why this matters in the gaming world: https://www.gdcvault.com/play/1022248/SIMD-at-Insomniac-Games-How https://www.gdcvault.com/play/1022248/SIMD-at-Insomniac-Game...
- red_admiral 3y agoThis tutorial: http://web.archive.org/web/20120314005352/https://www.richardlord.net/blog/what-is-an-entity-framework http://web.archive.org/web/20120314005352/https://www.richar... although now defunct, makes a good start. Around halfway through there's a heading "Abandoning good object-oriented practice" which gets to the point you're asking about.