Her I'm again. I'm developing a Game Engine(
Screenshots) inspired in Blender, Game Maker, and RPG Maker.
I want to give total freedom to the end user, and for for that, I'm paying total attention to the details of design. My new dilema(
See here the previous one, already solved) is how the Engine will make objects:
-With a "Universal Class", with a list of propertiesFor example, the base class of Blender objects,
KX_GameObject. The end-user dont create true variables when it create a new object, the class have a dynamic List(TList in Free Pascal or Delphi). Using this method it will be easy to make save files and load them(the end user will be able to choose with properties and objects will be saved in file).
Like that:
Code:
TPropertie = class
public
FPropertieName : String;
FPropertieType : TypesClass; // Integer, String, Float, Char, Boolean... etc;
FPropertieValue : Value acording to the FPropertieType;
end;
KX_GameObject = class
public
FListProperties : TList; // each element is a TPropertie;
procedure LoadFromFile(filename : String);
// This way, the end user will be able to add properties to the FListProperties;
end;
procedure KX_GameObject.LoadFromFile(filename: string);
var
Index : Integer;
begin
for Index := 0 to NumberOfPropertiesInFile - 1 do
begin
Self.FListProperties.Items[BIndex].FPropertieValue := PropertieInFile[BIndex].FPropertieValue;
end;
end;
-Keep the actual way I'm doing thisMy game engine will not really compile a script language, it will create a ObjectPascal project, and compile it. So, the end user will have a base class
TGameBaseClass, and it will be able to create other classes from that base class. There will be not a Variable FListProperties with the properties inside, the properties will be true variables. This way, load objects from saved files will be a headache, because there is no "Item Index" like in FListProperties.
So, these are two way I can do, and I really would appreciate your opinion.
_________________
"Life finds a way." - Ian Malcolm
My WebBlog: PixelDeveloperEnglish is not my native language, so excuse me for any writing mistakes.