RF2 Component Objects Introduction

Discuss the development of Reality Factory 2
Post Reply
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

RF2 Component Objects Introduction

Post by paradoxnj » Sat Apr 30, 2011 11:50 pm

Finally...the new way to do entities is complete. RF2 now uses a component based object system. This means that a game object is built from several precanned components which have data that can be altered. Component Game Objects (GOBs) will be defined use Lua tables. Every GOB must have at least one component. That component is called Transform. Transform contains the position and orientation of the game object in the world. There is no need to include this in your object definition. Here is an example of a simple object definition. It defines a ninja object.

Code: Select all

local Ninja = {
    name = "Ninja",
    description = "Ninja Warrior",

    actor = {
        mesh = "ninja.mesh"
    }
}

rf2.ObjectManager:registerObjectTemplate("Ninja", Ninja)
This creates a non-animated object called Ninja for the editor to place. The editor will have a GUI to create these objects. It will be similar to Unity and will save the templates in Lua script format like above.

There will be many built in components and you will have the ability to make components in script by defining an update function for the component along with a name and a description. For example, you might want to make an inventory component so that your object can carry stuff and drop it if it is killed.
Many Bothans died to bring you this signature....

Post Reply