February 11, 2016

[Update 6]Serious engine,the "components" update.



Hello!

I decided to take a break from the shaders and that stuff and worked a bit on the forgotten component system.

Let me first explain how the component system work:

The "unit" of the game is the GameObject, a GO could have many different components like a Mesh or a Material.
There are three basic components: Transform,Mesh and Material.Also, we have a script component (LUA) each GO could have more than one script (it is not decided yet).

We store all the components in a big "cache" (just a vector) , we store a reference of the basic components into the GO(mostly like in Unity where you have go.transform,go.rigidbody without doing a GetComponent<>() )

To add a components, I have made a function with templates!

Lets take a look at how it works:


//Add components
epicMonster.AddComponent<Transform>();
epicMonster.AddComponent<Mesh>();

//Acces basic components
epicMonster.transform->SetPosition(...);
epicMonster.mesh->SetMeshData(...);


Basically,under the header file I have a template function and then, in the .cc file I did each version of the template.


Another thing I have been working on, is the interface of the editor.Now you can properly change the values of the transform.
The material properties and settings is work in progress.

And thats all!