I quote from " The complete guide to Torque x " by John Kanalakis

Quote

Torque x promotes a new approach to game programming.
Unlike the classic inheritance model,objects share common components that provide reusable functionality instead of sharing a common base class.
For example when an object needs to process collisions, you simply add a collision component.
The aggregation methodology results in more code reuse and less copy and past code sharing "

and again

" Object oriented languages such as C++ and C# promote the practice of inheritance.In this case , new functionality is added to an existing object by deriving a new class and adding the functionality there.
....over Time it becomes increasingly complicated to add new functionality to an existing class hierarchy "

again

" Components are simply packaged element of game functionality.
In Chapter 2 we used the physics, Collision, worldLimits components...
In the following chapters we wil create several additional components from movement components to weapon components to AI components.
Each of this components will be designed to be as generic as possible to add functionality to a wide variety of games "

unquote

I do not know how to explain it better, to me the different game engine architecture is evident

In classic OOP you focus on objects and you add functionalities to your objects
C++ has not been designed for games wink
Suppose you want to develop a database for a Company
You declare a Class Employee which contains variable such as : id , name , salary etc and functions such as : CalculateSalary() etc
You can instance hundreds or even thousamds employees objects: Mr Smith, Mr John etc

This may not be the case of games

In games it may be better to focus on functionalities , I called them "task" in my previous post
Functionalities can be : Movement, Collision,Physics etc

Of course you must link the components to the objects thus you must use pointers such as "my" or "this" or such pointers may be even implicit




Last edited by AlbertoT; 03/26/10 21:47.