3 ms·
> Duck would have a GameObject, rather than be a GameObject Duck should not be a class, it should be a factory function that creates a generic GameObject and c
by Jare 12y ago
> Duck would have a GameObject, rather than be a GameObject
Duck should not be a class, it should be a factory function that creates a generic GameObject and configures it with the set of components that allows it to look, walk and quack like a duck.
- JoshTriplett 12y agoCan you elaborate on the reasons for that?
- Jare 12y agoOnce you move to components, these implement all the game-related behaviour and the GameObject becomes a simple piece of scaffolding to hold components together. You don't gain anything by making different GameObject code-level classes that only differ in the components they contain (there may be a debate in the case of languages that support mixins). It's also much easier to data-drive entity types; at some point you will even do away with factory functions for GameObject types and describe these types in data files loaded at runtime. This opens up options for designer-friendly editing tools and even 3rd party modding.
- snake_case 12y agoThis also is a good solution to my problem. Thanks!