Game Engine Programming 010 - Entity and component implementation in C++ | C++ Game Engine

preview_player
Показать описание
In today's video, I'll work on the implementation of game entities and components in the C++ game engine. In contrast with the object oriented approach in the level editor, I now will use a data oriented design for faster CPU access to data. I'll also set up a means to expose engine functionality to the game code.
(Red Episode)

Courtesy of Éric Langlais:

00:00 - intro
01:59 - Entity Storage Explanation
03:54 - Entity.CPP
06:25 - Utilities Header (vector/deque overrides for future custom implementation)
09:00- Continue Entity Implementation
11:11- Match the Default Id between Debug & Release.
17:27- Entity API
20:50 - create_entity
25:36 - remove_entity
26:58 - is_alive
31:00 - Transform Component API
38:47 - Get Transform from Entity
40:33 - Transform.CPP
43:21 - MathTypes Utility
48:15 - Continue Transform Implementation
52:45 - Get Position Rotation and Scale

by Arash Khatami
-------------------------------------------------------------
#PrimalEngine #GameEngineSeries #GameEngineProgramming #TheGameEngineProgrammingSeries
Рекомендации по теме
Комментарии
Автор

I use the following to check if the generation part is valid after adding 1 in the 'new_generation' function: assert(generation < internal::generation_mask); I think it is the best practice since generation_mask will always hold the max-1 for generation_type as we set it in its definition above. Anyway, thanks a lot, keep up the good work.

danielrotnemer
Автор

I'm really enjoying watching this series, I'm learning a lot of new material. Really good stuff man! Also the little memes you sprinkle throughout crack me up hahaha

manlikehq
Автор

1:59 Entity Storage Explanation
3:54 Entity.CPP
6:25 Utilities Header (vector/deque overrides for future custom implementation)
9:00 Continue Entity Implementation
11:11 Match the Default Id between Debug & Release.
17:27 Entity API
20:50 create_entity
25:36 remove_entity
26:58 is_alive
31:00 Transform Component API
38:47 Get Transform from Entity
40:33 Transform.CPP
43:21 MathTypes Utility
48:15 Continue Transform Implementation
51:06 return "component{ transform_id{ entity.get_id() } };" instead (See Comments)
52:45 Get Position Rotation and Scale

ericlanglaismm
Автор

I am little bit confused with the transform.cpp on the method create_transform, which returns with component with transform_id 'position()-1'.
When we first reuse the index in the game entities (suppose we have generations vector sized with 1025, and the hole is at index 200),
we will create a transform component with transform_id 1024 at index 200.
But as we have 'transforms vector' and the last element in that vector has the same transform_id 1024 at that time.
I thought each game entity should have a different transform component with transform_id, but they are the same.
Could you explain to me with a little more details?
(Sorry for my bad English)

상원선-ll
Автор

When you made the create_entity function you added a line for **generations[ id::index(id) ]; but I am getting a syntax error saying "operand of '*' must be a pointer but has type "primal::id:generation_type". I didn't see you declare any pointers so I am kind of confused as to what I should do differently to keep it syntactically correct.
P.s. I am pretty new to C++ so syntax & pointers aren't my strong suit yet

rayman
Автор

Why am i getting a C4189 warning in the Entity.cpp file for the index variable in create game entity and destroy game entity

FBI_Master
welcome to shbcf.ru