GPWiki.org
GPWiki.org
It is currently Wed Jun 19, 2013 10:04 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat Nov 26, 2011 7:37 pm 
Source Code Swashbuckler
User avatar

Joined: Wed Nov 09, 2011 3:58 am
Posts: 199
Location: Brazil
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 properties
For 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 this
My 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: PixelDeveloper
English is not my native language, so excuse me for any writing mistakes.


Top
 Profile  
 
PostPosted: Sat Nov 26, 2011 8:20 pm 
Bytewise

Joined: Sun Oct 16, 2011 3:09 pm
Posts: 282
Location: Here (where else?)
Do both?
That is, have a TGameBaseClass for the user, and derive a class with properties from it, also for the user.

Edit: As a side effect, it may also give the user an example of how to properly build a TGameBaseClass derived class.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group