I'm working on a small farming game in C++ after transitioning from Java, and I have a design choice to make regarding my architecture. I prefer to avoid deleting objects and reuse them for various purposes, so each entity has a `GameEntityType` enum that determines what it represents, and rendering relies on this type as well. However, I've encountered a challenge: I currently have no clear separation between systems and components, which makes it tough to access lower-level components or perform checks like `instanceof` from Java. I see two potential approaches: 1) Iterate through a `HashMap` containing all entities and manually check their types each frame, or 2) Use separate vectors for each component type, like a vector for `HarvestingComponent`. I've heard that separating components and systems is often preferred in C++ game development, but I'm hesitant as it could complicate my design and create multiple sources of truth. What's considered the cleanest and most efficient approach for a small game like mine? Should I stick with a simple OOP design, or would it be better to adopt an ECS architecture despite its added complexity?
1 Answer
For a small project like yours, I'd suggest sticking with a simple OOP design at first. It can make your code more manageable and straightforward, especially since you're still getting used to C++. Just focus on getting things working smoothly before you dive deep into ECS. Eventually, you might appreciate the benefits of separating components and systems as your game grows. But don't stress over it now!

Exactly! Start simple, and once you're comfortable with the basics, you can refactor. It's all about learning at this stage.