Posts

Showing posts from October, 2020

An introduction to ECS by example

In this post, I'm taking a closer look at how an ECS system works, talking about the pros and cons of different approaches, and trying to answer if it's something that could be used outside of gaming. What is an ECS ECS is a programming pattern commonly used in high-end game engines, simulations, visual effects and CAD/CAM software, among others. The acronym stands for Entity-Component-System, and it forms the foundation of the ECS architecture. Unlike the traditional object-oriented programming approach based on inheritance, this architecture uses composition. While it's not as well-known for smaller projects, ECS is a go-to choice for top-tier applications where performance is of utmost importance. This is because it efficiently utilizes CPU instruction and data caches. In the following sections, we'll explore the ECS design of a basic game. Components To create basic movement, two main components are used: transformations and movement. Transform2d enables entiti