Crave For Games


You are in the Article list. If you want a full list of the StoneDrop develompent log notes you can go to the DevLog page.
Entity component system (ECS)

I've come across an excellent lecture with the examples of using ECS (ECS is a key concept in Unity3d, Unreal Engine and probably in many other game engines) with maximum profit from this approach to the objects organization: video 1


Video 1

Briefly: we break the object behavior (or data) into small, independent components then we adjust the messaging system between these components. Now to create a character with any combination or sequence from earlier created movements, it is enough to add the appropriate components to its GameObject (for a complex behaviors combination it is necessary to write a small script that receives signals from the components and manages their states). Thus, for example, if in a side-scroller game you have already implemented different types of aircraft movements and various types of attacks it will take matter of minutes to create a boss with any sequences and combinations of these movements and attacks.

 

I've considered the using of this information in my project:

In my case, the game architecture implies a strict division into model and view for the following reasons (pattern MVC goo.gl/UUN6xq[1]):

1. To evaluate a decision tree the AI will create copies of the current game field state and calculate the results of possible moves. These calculations shouldn't rely on the objects from the namespace UnityEngine to be processed in a separate thread to increase performance;

2. For the final choice of the game visual style, I want to create several independent views (with different sets of animations and behaviors) and at any time I want to be able to switch between them;

3. At the subsequent addition of multiplayer, it will be much easier to synchronize the gameplay at different devices through the model without affecting the GameObjects and their components.

Therefore, ECS in my project can be only applied for the view – those objects that are placed on the stage and represent different aspects of the game state.

 

In case of that side-scroller from the lecture, it can be considered that the model is a physical engine for Unity, which is consistent with the ECS. Hence in that example project using of ECS is appropriate.

 

Link 1: goo.gl/UUN6xq

This article in social networks: