# Half-time Presentation Time limit: 10 min ## Opening (<0.5 min) (Christoffer) Welcome to our half-time presentation! I'm XX and this is XX. <!-- Today we'll be presenting what our project is about, its goal, schedule, current status and some of our experiences up until now. --> We will begin broadly by presenting the general topic of our thesis. Then we will go through our goal and the project schedule. Finally, we will share how far we have come, as well as some of our experiences of working with the project. ## Introduction to project (2 min) (Christoffer) ### Game and Simulation Engines <!-- - We should start with this because we want to establish a context in which our project exists. - questions to answer: - why is flexibility important? - why does performance matter? - why is it relevant now? -> VR - why is ECS needed? --> A modern game engine needs to provide high flexibility and performance. Flexibility is important because it allows game developers to change and adapt the game throughout development. Performance makes it possible to fill the game world with many thousands of objects, while still having a responsive game. However, these two features have not always been available. ### Game Development in the 90s At the end of the 90s, people began to realize the problems that existed with object-oriented programming or OOP in game development. Modeling a game using class hierarchies is easy, but to later change - even simple behavior - turns into a head ache. Giving a bush a pair of legs, means that the whole hierarchy needs to change. And if there are dependencies on that bush, good luck. <!--Another problem is that it's difficult to optimize memory usage because of the way objects are accessed and stored on the heap.--> OOP and game development were simply not a good match. ### The problem ECS solves (data-oriented design + concurrency) <!--During the end of the 90s issues arose when using object-oriented programming for game-development. The hierarchies inherent to the framework made projects unwieldy and the optimization of memory management difficult. New innovations, in VR for example, has led to demands being placed upon an application for a throughput two or three times higher than what was previously deemed acceptable.--> This has led to the need to reevalute methods of implementing engines. A proposed solution was the predecessor to what is today called the entity component system framework. This framework more closely mirrors a processors input to output stucture and data and functions are seperated into independent components and systems. <!--This simplifications serve to illuminate avenues of optimizations to the developer since each step of a process execution is more easily transparent and as an extension provides opportunities where concurrency may be utilized to increase performance even further.--> ### What is ECS? Then what is an entity component system? An entity component system, or ECS, is a framework for how to structure core parts of an application. In terms of a game; an entity is for instance a particle, components are the data that makes a particle a particle, and systems are the way the components of entities are transformed. Data and functions are therefore seperated unlike in the object-oriented approach. ### How ECS solves the problems Compartmentalizing how an engine works in this way allows for a higher degree of flexibility and optimizations. <!-- compared to the hierarchical nature of object-oriented programming.--> Adding legs to a bush now only consists of adding already existing components for movement and AI to the bush entity. It simultaneously increases performance when performing work on a large amount of entities. In object-oriented programming an entire object is assigned to the heap. If you want to fetch a specific value like position for example a lot of unneccessary data would also be pre-fetched from each object by the processor. In ECS however all components of a specific type are contiguous in memory leading to each fetch operation most likely pre-fetching useful data. <!-- A system is able to act on all entities with its components regardless of what actual "type" of entity they are apart of. A single system for instance might handle all entities positional changes regardless of their entity type. If each specific type of components are placed contiguously in memory, the iteration of systems on these components are also more efficient. This since ability of processors to fetch relevant data to the cache during each fetch operation increasing the cache-hit rate.--> ## Project Purpose and Goal (1 min) (Christoffer) The purpose of this project is to develop a framework for developers to create well-performing simulations or games, while limiting the need for developers to explicitly handle issues like cache management and concurrency <!--To achieve this purpose we are developing an ECS engine that handles the concurrency and cache-management aspects of an game or simulation engine automatically-->. <!--The goal will be to create an engine that can be used by other developers to create games or simulations. --> It should utilize multi-core processors for concurrency and carefully store components contiguous in memory to increase iteration speeds. The engine should shadow these aspects from developers working with the engine, while being performant and well-behaved. The engine is written in the Rust programming language which was made with performance and memory management in mind. I will now hand over the presentation to Jacob, who will begin by presenting the project plan. ## Project plan (3 min) (Jacob) The project can be divided into 4 stages. Initial Research, Prototyping, development of a Minimum Viable product and Engine Development. ### Initial Research We began by looked at academic, industry and open-source resources. This gave us a wide perspectives on the subject. ### Problems Based on this research we identified 5 problems which would need to be solved for us to create our entity component system. ### Problem 1 The first problem is that we want to ensure that systems can be run currently, to maximize performance. However, there are cases were systems need to be run sequentially. An example of this is collision detection which require that nothing moves while the check is being performed. This means that you can not have a system that updates gravity at the same time. ### Problem 2 The second problem is that we want to store components closely in memory because it allows the processor to more effectively fetch and process data, which increases performance. ### Problem 3 A core feature of entity component system is the ability to add and remove components from entities during runtime. If this is NOT done correctly it will lead to fragmented memory, which will decrease performance over time. ### Problem 4 To allow many different types of systems to be implemented, we need to provide a flexible querying API. This includes features such as specify which components to fetch, and whether they will be modified or not. ### Problem 5 In some applications such as collision detection, a system might need to iterate components in a nonlinear fashion, accessing multiple entities at once to update a single entity. This will need to be supported by the querying API. ### Prototyping With these problems identified, the plan was to create three prototypes each investigating different aspect of entity component system. By working with prototypes, we could ignore many problems until later, such as how the different parts should interact and instead focus on how the parts work in themselves. It also gave us the opportunity to learn and get more familiar with Rust. This was important because most us have not used the language before. ### MVP The next stage is to create a Minimum Viable Product based on what we learned from the prototypes. This step will consist of integrating the different parts and rewriting some parts from the ground up. This MVP will be the basis for the final framework. ### Engine Development When the MVP is done, engine development will begin. This is the largest part of the project. Here we will further optimize the framework and add new features. We will develop a profiling tool to analyze behavior and resource usage. Benchmarking will be used to evaluate the framework. A case study, consisting of implementing a gravity simulation, will be used to guide development of missing features. ## Current Status Right now we are at the end of the prototyping stage. Through the prototypes we have been able to explore different ways of scheduling systems. We have also explored ways of determine the execution ordering of systems. Two of the most common component storage solutions has been implemented, with our conclusion being that a combination of both will be needed. A querying API has been implemented where you can specify components to be fetch and indicate whether they will be modified or not. ## Experiences Finally, some of our experiences: Prototyping has been a success, we have been able to learn and explore different ways of using Rust to implement parts of the ECS. A lesson we have learned, is that when you solve problems together with others, it is crucial that you have a shared understanding of the problem. If you don't, you will confuse each other. This issue can be resolved through dialog about the problem. By the end everyone will have a better understanding of the problem. Another lesson is that if you ever stuck on a problem, discussing it with someone else and getting their perspective on it often can lead to a solution, even if they are not familiar with the problem. ## Questions Thank you for listening, now we have time for some questions.