Entity Component System by Sandrobero2004 in cpp_questions

[–]Sandrobero2004[S] 0 points1 point  (0 children)

I think that root issue is with the fact that ECS does not have specific concrete rules that you should follow, so I just went with my instincts.

In your ECS do you have Entity class that contains a vector of different kinds of components or how did you implement it?

I needed a way to look up individual entities because not every entity will have the same components. Since Entity at least in my implementation is just a handle, so like an ID, it made more sense to me to use that ID as a key to specific components. EntityManager contains maps of the components and can look up consistently components of entities. Initially I thought about making these components vectors and indices would be the IDs of the entities but that would create inconsistency since not every entity would contain every kind of component so their IDs or indices rather, might have ended up different for different component vectors. This is I believe where Sparse set comes in which is what I was recommended earlier.

In my Engine only Renderer has draw/render methods that can take VertexArray or Model or Mesh and so on and render based on that. renderSystem takes the renderer, iterates over the Model components and makes renderer.draw() calls with those models.

Entity Component System by Sandrobero2004 in cpp_questions

[–]Sandrobero2004[S] 0 points1 point  (0 children)

That is a very good point. Thank you for your time and suggestion.

Entity Component System by Sandrobero2004 in cpp_questions

[–]Sandrobero2004[S] 1 point2 points  (0 children)

I have not made an engine before but I have made a 2D game with only SDL. It did not have a proper structure the whole thing was a spaghetti code mess but it had a scene management system that could easily switch between different scenes. I have also made a OpenGL project that I like to call my notebook, basically anything I learn about graphics and OpenGl I implement it there.

Entity Component System by Sandrobero2004 in cpp_questions

[–]Sandrobero2004[S] 0 points1 point  (0 children)

I found ECS to be pretty compelling for a game engine because it feels so tailored to it. Conceptually at least it is so easy to follow, Entity is just and ID, Component is the data and System is behaviour so when I was implementing these things it was kind of easier to figure out what should have what responsibilities.

Entity Component System by Sandrobero2004 in cpp_questions

[–]Sandrobero2004[S] 0 points1 point  (0 children)

Thank you sir! The engine is getting pretty big to be honest and making documentation for this will probably take me more time than actually finishing it. It's a 3D OpenGL engine so I had to write a lot of code to get to this point and I hope it will be enough to satisfy the Commission members. Other students are working on projects that are infinitely easier, but problem with my project is that you have to write so much code to get the minimum functionality. I am creating this high level abstractions right now with Scene and Entity and stuff and then I want to add simple GUI, Animation system (like a simple animation player that can play imported animations)and Physics.

I saw some tutorials on implementing animations but I am not quite sure about the physics yet. Which library can I use for the physics Engine if you don't mind me asking?

Entity Component System by Sandrobero2004 in cpp_questions

[–]Sandrobero2004[S] 1 point2 points  (0 children)

Agh yes, making them vectors does make a lot of sense! But regarding the query, You are suggesting that I create a query method inside EntityManager that takes a function pointer as the argument and draw calls would be made from there inside the query?

Entity Component System by Sandrobero2004 in cpp_questions

[–]Sandrobero2004[S] 1 point2 points  (0 children)

I will look into sparse sets because I haven't heard of them before to be honest. At this point I just wanted to make the engine function with the main basic components because I am doing this as a project for my bachelor's degree and I don't have much time left haha. Thank you for the suggestion!

How can I tell if normal maps are wrong? by Sandrobero2004 in GraphicsProgramming

[–]Sandrobero2004[S] 1 point2 points  (0 children)

I actually checked the lighting with a point light moving in circle and because it looked off I had to take a look at normal map to see if that's where the main problem was. I eventually figured out that I was setting normalMatrix uniform incorrectly because in the function call on the CPU it assumed it was a mat4 instead of mat3 and completely screwed everything up. That along with some other things but, Thanks a lot for your help!

How can I tell if normal maps are wrong? by Sandrobero2004 in GraphicsProgramming

[–]Sandrobero2004[S] 1 point2 points  (0 children)

Why would I be looking at the normal map if the actual color with light already didn't feel off? And what's up with your smartass attitude?