sschmid / Entitas

Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
MIT License
7.16k stars 1.11k forks source link

Collaboration, Multiple Developers using Entitas #129

Closed zehreken closed 8 years ago

zehreken commented 8 years ago

What is the best way for multiple developers to work on the same project? I have created this example project to test and create fail points for merging. https://github.com/zehreken/entitas_merge_test For example, at the current state of the example project, it is not possible to merge branch_a into branch_b automatically. So my questions are:

Sorry if I asked too much. Thanks in advance.

ghost commented 8 years ago

+1

sschmid commented 8 years ago

Hi, the problem boils down to the code generator being based on reflection. I'm currently "fighting" for some time in my current project to finally tackle this issue because a roslyn based code generator would solve a lot of problems and we would all benefit. In the meantime I usually do as described here https://github.com/sschmid/Entitas-CSharp/wiki/Code-Generator#fixing-compilation-errors

The problem in a nutshell: Dev A adds ComponentA and dev B adds component B. If you merge you'll end up having a conflict in ComponentIds. The main goal is then to get the code into a compilable state as quick as possible to regenerate. My workflow: Build -> Jumps to error -> fix -> repeat In this example ComponentIds.B is missing but used in the code base. So I duplicate any existing line of the components indices an rename it to B. I don't care about the actual index, as it will be regenerated anyway, e.g

    public const int Position = 45;
    public const int Velocity = 45; // duplicated, doesn't matter that it's 45 too

Any other errors in generated files I just put comments around, because as I said, my main goal is to be able to compile first.

Sometimes 2 or 3 systems are also affected, so I temporarily put comments in those files as well and undo after regenerating. In total all these steps shouldn't take longer that 1 or 2 minutes. To keep conflict counts down it helps to merge more often.

At wooga we're around 4 to 6 devs per team. In my team we work agile and test driven, so nothing is designed in advance. Features and requirements may or may not changed at any given point of time. I personally never worked in an environment where you design everything up front. In my team we're totally guided by TDD principles.

Multiple pools should be a result of the game design and not dev head count I think. But if you have a working workflow for this I'd be happy to learn more about it :)