Functional versus Object-Oriented: help me understand the purpose of it all

EntityManager is indeed a type of class (a singleton to be more precise), but the reason I did it that way is basically because I wanted to and because it’s an appropriate pattern for the context. In other words, it’s an implementation detail - not a logical necessity.

Not quite - EntityManager is intended to be required by the server and each client, and its main purpose is to hold data structures containing information about entities and components. Neither entities or components are classes; they are pure data, and this brings us to the crux of the matter:

ECS is about dealing with your game in terms of data, not objects. It’s quite a bit different than OOP (some even think that they are directly opposed). That being said, I encourage you to do further research!

Additionally, it seems like you may be experiencing analysis paralysis. Don’t worry about about creating the “perfect” or “most optimal” architecture. Go with what makes the most sense to you, and then refactor mercilessly once any problems with your initial design become apparent

3 Likes