ECS or MVC

I would like to ask the differences between ECS and MVC, which one is better to use? Pros and cons , are they the same thing, for which game gander should they be used? Could I combine them? Here is an example:

For me MVC and ECS are different things ; you can implement your game using MVC with ECS in either Model or Controller.

The major issue with ECS is that inside your M/C modules you’ll have to engineer your code in a functionality per functionality code which is not the usual way for a RPG for example :


Imagine you want to define items ; a classic way would be to create a new class item with a “use” method and some properties (an icon, a weight, whatever) and then you would define each item class (potions, weapons, other interactables) in subclasses of items which implement the base “use” method.


Putting ECS inside this method would be meaningless (unless the method itself has huge performance requirements but that’s trivial) since each “use” methods would be called 1 by 1 by your game controller (so there is no use of any multithreading nor any gain in the memory allocation from pooling).


Effectively implementing ECS in that case would require you to refactore all your code in order to create all ECS inputs in your “Use” methods (which would therefor not trigger anything), handle them in a centralized ECS method (which means creating highly dependant code where you don’t want any), and then run it with ECS manager.

So should you use ECS or not is highly dependant of the type of game you want to create and associated “best” architecture. Also know that ECS integrates very well with new Multiplayer system.

Some interesting video here to complement

Hey there,

in some way they are the same and at the same time they are not.

They are the same in a way that they are both architectural approaches that try to divide the programms setup into Data and functionalities. (though the ecs will not have this focus on the third “view” component of the mvc setup)

can they be combined? For sure. But the fact that you ask this question makes me wonder if you did enough research on the ecs and if you are aware of the downsides that come when using the ecs. It heavily depends on your programms needs and most important on your experience with unity and programming in general.

My advice when it comes to the ecs: Unless you have a project ahead where you know that you will have performance related issues just stick with the standard unity gameobject approach. there you can try to apply some neat architectural approach like mvc which is more of a choice to make your programm/game understandable and well designed. Choosing to use the ecs will end up in a completly different programm setup and might create problems that you would not encounter when using the gameobject oriented design. (for example when you have some object that should reference to another object of the same type. This can be difficult to accomplish in the ecs)

So rather try to ask yourself the question gameobject vs ecs first.

Hope this helps. If anything was unclear or you need more info feel free to ask.