So far, I have 2 hard coded components:
-- Actor - assigns a mesh to your entity
-- Animation - assigns a skeleton to your entity and applies animation
Planned components are:
-- Physics - Physics properties for an object
-- Inventory - Object can hold an inventory
-- Brain - AI related properties and scripts
-- Conversation - Object can hold a conversation
-- Debris - Object can leave a mess when it is destroyed
-- Fader - Fades out an object
I don't have any scripted components yet.
There will be a GUI in the RF2 Editor to create these objects and save them to the format they need to be saved in. The format is just a text file that is parsed using a custom parser that is derived from the Ogre Script parser interfaces. The test object is the robot mesh. To define it, I did the following:
Code: Select all
// test.rfobject
object Robot
{
actor
{
mesh robot.mesh
material Examples/Robot
}
}
Components will update every frame with the object. So the hierarchy is as follows:
-- Object instance created from object template
-- Object instance added to world
-- World updates object instances
-- Object instances update component instances
-- Component instances apply logic based on properties
The combinations you could use would be endless and you are not stuck using the same old entities again and again as you can create new components using script. I see this as a great community building tool as the more prominent scripters can create components for the community as components will work from game to game as long as all scripts are included with them.
I used the following Squirrel code to create the object to display in my test scene. You could also change the properties of an object's components to change the behavior of that object during runtime. It will only affect the instance that you are working on and not the template. If you create another object, the changes you made to the previous object will not carry over.
Code: Select all
local rob = RFObject("Robot");
rob.setPosition(Vector3(0.0, 99.0, 0.0));
rob.setScale(Vector3(0.50, 0.50, 0.50));