3 ms·
> games built on top of Unity For the curious, here is Unity's components reference page: http://docs.unity3d.com/Documentation/Components/index.html http://d
by snprbob86 14y ago
> games built on top of Unity
For the curious, here is Unity's components reference page:
http://docs.unity3d.com/Documentation/Components/index.html http://docs.unity3d.com/Documentation/Components/index.html
- reitzensteinm 14y agoThough, if anyone's actually interested in coding a game in this style in Unity3D, I would heavily recommend against using Unity Components directly if you're at all concerned about performance and code clarity. Instead, have one MonoBehavior and a base properties class which you can delegate your events to (usually only a half dozen). That way you're not relying on undefined behavior on the Unity side, and you can, eg, new and clone properties without issue. I use something similar for Under the Ocean (http://www.underthegarden.com http://www.underthegarden.com), which has to deal in worst case with hundreds of objects with potentially tens of behaviors that cannot be known ahead of time. The system works damn well - for my type of game, perhaps it's the only way to do it. But performance is forever a concern. Monobehaviors are nice (eg, you can edit its variables in the editor), but they're heavy weight.
- deleted 14y ago[deleted]
- Impossible 14y agoThere are shipping AAA games and game engines that use some variation of a component system for entities, including Unreal Engine 3 and CryEngine. In practice, "component entity system" simply means favor composition over inheritance. There are different ways you can architect your code to fit the definition, some of them efficient and cache friendly.
- Tuna-Fish 14y agoAnd to elaborate more: The reason for this shift is that the current-gen consoles (xbox360 and PS3) are really, really bad at random access into memory. Chasing pointers on PC is bad, chasing pointers on them is suicidal. With them, it's better to do a linear copy of ~3kb than it is to reference one more uncached pointer. And this is especially bad because they don't have any kind of decent prefetchers -- if you haven't actually touched an object, it's probably uncached. Becaus of this, if you use traditional OoO to structure your code, you leave an order of magnitude or more of performance on the table. And since the CPUs are slow as it is, you can't afford to do this.