Hi,
During these couple of days I’ve been learning about DOD and ECS, watching videos, view tutorials and some examples. And while I’m already convinced that ECS is the “correct” way for the game development at least, I’ve yet to see concrete help how to change my problem solving mindset from OOP that I’m familiar with for longest time (and I admit, I might not even that good on it), into DOD mindset. Watching Mike Acton videos on how he designed the data feels like ethereal to my puny brain.
So here’s some points of confusion during my learning:
-
Single Object (like player or BGM manager) - If I know I will make games with one player only, how to design it for ECS? Usually on OOP I make it Singleton for ease access, and put some Player behaviour and capabilities there. Alright, some of you might groaning about this, but yeah, how do you guys usually break it down?
-
Events & Trigger - I used a lot of events previously, and I’m confused on how to translate that to pure ECS. From Collider, to Animation Events, and many other triggerable conditions. ECS seems on quite contained loop by themselves, and events seems crashing into that philosophy. How do you guys handle events?
-
State Machine - Usually I make a lot of if and conditions about state, and do appropriate behavior for particular state. But from what I read (I forgot where), for ECS you need to reduce branching and testing. How can we did that?
-
Sprite Renderer - the built in renderer is only for mesh. If my game is 2D, what should I do (I also have very limited understanding about shaders)
-
Job Schedule size - This code is quite common in ECS (
JobHandle moveHandle = moveJob.Schedule(this, 64, inputDeps);), so the number 64 if I’m not wrong, is the job size. How to determine that? -
Unity UI - How to combine ECS with that? With all of the components seems still tied into GameObjects, like RectTransform, Layout, etc.
-
(Almost) No GameObject on Scene? - Is this the target to achieve with pure ECS?
-
Game Flow - Usually all in ECS are parallel, or if sequential is needed, that’s for specific contained system. I’ve yet to see for big interconnected things like game flow (on main menu, char select, then main game, score screen, and such), which usually handled by game manager. How can we achieve this in ECS?
-
Physics - Just like UI, how to do ECS with physics? Seems unity is not supporting this yet, but if I want to change my mindset, how should I approach Physics in my game?
-
Inject vs InjectAttributes (and then chunks?) - Sometimes I stumbled upon some examples that use Inject, and sometimes InjectAttributes. What’s the difference? Should I care? Because later on I read somewhere that Unity will drop this, and replace it with chunks? What about that?
Sorry for lots of points, and some of it might seem dumb questions. But you can see that these were leftover OOP mindset that I have, and I have no idea how to transition to think like DOD. Personally, I don’t think using Hybrid ECS is a good way to change the mindset. I tried it with my game demo, and still has no idea how to make the full game with pure ECS. Lots of stumbling blocks are unanswered by self learning, I don’t know if my question problems are DOD (principal) or Unity ECS (implementation syntax) things, and if I see my final build of the demo, a lot of it actually has no difference than usual OOP.
So here’s hoping you guys can help :). Thanks.