# US 2019/0377672 A1 · Method and system for improved performance of a video game engine

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2019/0377672 A1
- Document ID: US20190377672A1
- Status: Published application
- Kind: A1
- Application number: 16/006,610
- Filed: 2018-06-12
- Published: 2019-12-12
- Earliest claimed: 2018-06-12
- Assignees: Unity IPR ApS
- Applicants: Unity IPR ApS
- Inventors: Joachim Christoph Ante; Tim Johansson
- Web page: https://patentgrep.com/patent/US20190377672A1

## CPC

- G06F 12/0223: {User address space allocation, e.g. contiguous or non contiguous base addressing}
- A63F 13/00: Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F 13/67: adaptively or by learning from player actions, e.g. skill level adjustment or by storing successful combat sequences for re-use
- A63F 13/77: involving data related to game devices or game servers, e.g. configuration data, software version or amount of memory
- G06F 8/315: {Object-oriented languages}
- A63F 2300/60: Methods for processing data by generating or executing the game program
- A63F 2300/8082: Virtual reality
- G06F 2212/15: Use in a specific computing environment
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- A63F: CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR

## Abstract

Methods and apparatuses to improve the performance of a video game engine using an Entity Component System (ECS) are described herein. In accordance with an embodiment, the ECS creates and uses entities, to represent game objects, which are constructed entirely using value data types. The ECS constructs the entities within a memory in a densely packed linear way, and whereby the ECS constantly monitors (e.g., during game play) objects within a game and adjusts the entity distribution within the memory so that a maximum density of memory usage is maintained in real time as the game is being played.

## Claims

### Claim 1

A system comprising:
one or more computer processors;
one or more computer memories;
a set of instructions incorporated into the one or more computer memories, the set of instructions configuring the one or more computer processors to perform operations for automatically managing a set of memory chunks within the one or more computer memories at runtime for a computer application, the operations comprising:
receiving a set of entities from the computer application, each of the set of entities including a set of components, wherein each component of the set of components has one type of a set of types;
classifying the set of entities into a set of archetypes, each archetype representing a different count of the set of components or a different combination of types of the set of components relative to other archetypes of the set of archetypes;
based on a determination that one of the set of archetypes corresponds to a new archetype, building a new memory chunk, adding the new memory chunk to the set of memory chunks, and populating the new memory chunk, wherein the populating of the new memory chunk includes adding data from the set of components included in one or more entities of the set of entities that are classified under the new archetype, the adding of the data including contiguously adding the data to ends of a set of component data arrays included in the new memory chunk, each of the set of data arrays included in the new memory chunk corresponding to a respective component of the set of components included in the one or more entities that are classified under the new archetype.

### Claim 2 (depends on 1)

The system of claim 1, wherein each component data array of the set of component data arrays is contiguous with a next component data array of the set of component data arrays.

### Claim 3 (depends on 1)

The system of claim 1, the operations further comprising based on a determination that the one of the set of archetypes corresponds to an existing archetype, populating an existing memory chunk of the set of memory chunks, wherein the populating of the existing memory chunk includes adding data from the set of components included in one or more entities of the set of entities that are classified under the existing archetype, the adding of the data including contiguously adding the data to ends of a set of component data arrays included in the existing memory chunk, each of the set of data arrays included in the existing memory chunk corresponding to a respective component of the set of components included in the one or more entities that are classified under the existing archetype.

### Claim 4 (depends on 1)

The system of claim 1, wherein the adding of the new memory chunk to the set of memory chunks ensures that the set of memory chunks includes at least one memory chunk for each of the set of archetypes.

### Claim 5 (depends on 1)

The system of claim 1, including receiving a first list of components, a second list of components, and an additional set of instructions for modifying components within the first list of components, the operations further comprising:
searching the set of archetypes for one or more matching archetypes that includes all the components from the second list of components; and
using the additional set of instructions to modify one or more of the components included in the one or more matching archetypes based on a correspondence between the one or more components and the first list of components.

### Claim 6 (depends on 1)

The system of claim 1, wherein each of the set of entities is created as a result of a game event occurring within the application.

### Claim 7 (depends on 1)

The system of claim 1, the operations further comprising:
receiving a notification of a deletion of an entity of the set of entities;
removing data corresponding to the entity from each of the set of data arrays included in a memory chunk of the set of memory chunks corresponding to the entity; and
ensuring that the memory chunk is contiguously packed by moving data corresponding to an additional entity from an end of each of the set of data arrays to locations of the removed data corresponding to the entity.

### Claim 8 (depends on 1)

The system of claim 1, the operations further comprising:
determining that an entity of the set of entities within a first archetype has been modified;
based on a determination that the modified entity corresponds to an additional new archetype, adding the additional new archetype to the set of archetypes, building an additional new memory chunk for the additional new archetype, populating the additional new memory chunk with data from the set of components included in the modified entity, and deleting data corresponding to the modified entity from the first archetype;
based on a determination that the modified entity corresponds to an existing second archetype in an existing memory chunk, populating the existing memory chunk with data from the set of components included in the modified entity, and deleting data corresponding to the modified entity from the first archetype.

### Claim 9 (depends on 1)

The system of claim 1, wherein the data from each of the set of components included in the one or more entities of the set of entities that are classified under the new archetype is extracted from variables of an object-oriented-programming object representing the component.

### Claim 10

A computer-implemented method comprising:
receiving a set of entities from a computer application, each of the set of entities including a set of components, wherein each component of the set of components has one type of a set of types;
classifying the set of entities into a set of archetypes, each archetype representing a different count of the set of components or a different combination of types of the set of components relative to other archetypes of the set of archetypes;
based on a determination that one of the set of archetypes corresponds to a new archetype, building a new memory chunk, adding the new memory chunk to the set of memory chunks, and populating the new memory chunk, wherein the populating of the new memory chunk includes adding data from the set of components included in one or more entities of the set of entities that are classified under the new archetype, the adding of the data including contiguously adding the data to ends of a set of component data arrays included in the new memory chunk, each of the set of data arrays included in the new memory chunk corresponding to a respective component of the set of components included in the one or more entities that are classified under the new archetype.

### Claim 11 (depends on 10)

The method of claim 10, wherein each component data array of the set of component data arrays is contiguous with a next component data array of the set of component data arrays.

### Claim 12 (depends on 10)

The method of claim 10, further comprising based on a determination that the one of the set of archetypes corresponds to an existing archetype, populating an existing memory chunk of the set of memory chunks, wherein the populating of the existing memory chunk includes adding data from the set of components included in one or more entities of the set of entities that are classified under the existing archetype, the adding of the data including contiguously adding the data to ends of a set of component data arrays included in the existing memory chunk, each of the set of data arrays included in the existing memory chunk corresponding to a respective component of the set of components included in the one or more entities that are classified under the existing archetype.

### Claim 13 (depends on 10)

The method of claim 10, wherein the adding of the new memory chunk to the set of memory chunks ensures that the set of memory chunks includes at least one memory chunk for each of the set of archetypes.

### Claim 14 (depends on 10)

The method of claim 10, including receiving a first list of components, a second list of components, and an additional set of instructions for modifying components within the first list of components, the operations further comprising:
searching the set of archetypes for one or more matching archetypes that includes all the components from the second list of components; and
using the additional set of instructions to modify one or more of the components included in the one or more matching archetypes based on a correspondence between the one or more components and the first list of components.

### Claim 15 (depends on 10)

The method of claim 10, wherein each of the set of entities is created as a result of a game event occurring within the application.

### Claim 16 (depends on 10)

The method of claim 10, the operations further comprising:
receiving a notification of a deletion of an entity of the set of entities;
removing data corresponding to the entity from each of the set of data arrays included in a memory chunk of the set of memory chunks corresponding to the entity; and
ensuring that the memory chunk is contiguously packed by moving data corresponding to an additional entity from an end of each of the set of data arrays to locations of the removed data corresponding to the entity.

### Claim 17 (depends on 10)

The method of claim 10, the operations further comprising:
determining that an entity of the set of entities within a first archetype has been modified;
based on a determination that the modified entity corresponds to an additional new archetype, adding the additional new archetype to the set of archetypes, building an additional new memory chunk for the additional new archetype, populating the additional new memory chunk with data from the set of components included in the modified entity, and deleting data corresponding to the modified entity from the first archetype;
based on a determination that the modified entity corresponds to an existing second archetype in an existing memory chunk, populating the existing memory chunk with data from the set of components included in the modified entity, and deleting data corresponding to the modified entity from the first archetype.

### Claim 18 (depends on 10)

The method of claim 10, wherein the data from each of the set of components included in the one or more entities of the set of entities that are classified under the new archetype is extracted from variables of an object-oriented-programming object representing the component.

### Claim 19

A non-transitory machine-readable medium storing a set of instructions that, when executed by a processor, cause the processor to perform operations comprising:
receiving a set of entities from a computer application, each of the set of entities including a set of components, wherein each component of the set of components has one type of a set of types;
classifying the set of entities into a set of archetypes, each archetype representing a different count of the set of components or a different combination of types of the set of components relative to other archetypes of the set of archetypes;
based on a determination that one of the set of archetypes corresponds to a new archetype, building a new memory chunk, adding the new memory chunk to the set of memory chunks, and populating the new memory chunk, wherein the populating of the new memory chunk includes adding data from the set of components included in one or more entities of the set of entities that are classified under the new archetype, the adding of the data including contiguously adding the data to ends of a set of component data arrays included in the new memory chunk, each of the set of data arrays included in the new memory chunk corresponding to a respective component of the set of components included in the one or more entities that are classified under the new archetype.

### Claim 20 (depends on 19)

The non-transitory machine-readable medium of claim 19, wherein each component data array of the set of component data arrays is contiguous with a next component data array of the set of component data arrays.
