TGB and handling variable data best method.
by Keith Mc Dowell JR · in Torque Game Builder · 12/07/2007 (1:57 pm) · 4 replies
Hello,
We have fleshout our data we are going to be using in a title we are developing with TGB. The data is assoicated with the player, which there can be up to six player profiles that the user will be able to select. We plan to create a playermanager.cs file to handle some of the functions related to the user, but some of the data will need to be accessible during game play.
Setting up an array has been toss around, the data during the game play would be updated and saved to disk in a binary format, and then when the game is select it will be load (and updated while in game play) and a small update will be written to the disk to prevent loss of data.
We working on a RPG game, so we have couple of these c++ structure types, any suggestions would be most helpfull or same coding, on how someone else handled the data input and output.
We have fleshout our data we are going to be using in a title we are developing with TGB. The data is assoicated with the player, which there can be up to six player profiles that the user will be able to select. We plan to create a playermanager.cs file to handle some of the functions related to the user, but some of the data will need to be accessible during game play.
Setting up an array has been toss around, the data during the game play would be updated and saved to disk in a binary format, and then when the game is select it will be load (and updated while in game play) and a small update will be written to the disk to prevent loss of data.
We working on a RPG game, so we have couple of these c++ structure types, any suggestions would be most helpfull or same coding, on how someone else handled the data input and output.
#2
Thanks for the input, have few more questions regarding this. We are setting up functions with a file we are calling PlayerManager.cs to handle some of the basic functions we need it to do. But, will the sceneObject allow us to past the object of the data? I guess I need to create a datablock first so , that it has items predefine and making reference to it between the sceneObject and PlayerManager.cs, do you know of any examples of setting the datablock?
Thanks,
12/11/2007 (12:26 pm)
Hey, PhillipThanks for the input, have few more questions regarding this. We are setting up functions with a file we are calling PlayerManager.cs to handle some of the basic functions we need it to do. But, will the sceneObject allow us to past the object of the data? I guess I need to create a datablock first so , that it has items predefine and making reference to it between the sceneObject and PlayerManager.cs, do you know of any examples of setting the datablock?
Thanks,
#3
When adding behaviors to datablocks, all of the default values will be used unless you specify a new value for a particular field. Each value in that list is spaced with a TAB.
That what you're after?
12/11/2007 (12:59 pm)
Sure:new t2dSceneObjectDatablock(PlayerTemplate)
{
Class = "PlayerClass";
Size = "10 10";
Layer = "1";
_Behavior0 = "BehaviorName ChangeThisField ToThisValue";
_Behavior1 = "AnotherBehavior AnotherField AnotherValue";
};
new AnimatedSprite()
{
Config = PlayerTemplate;
Scenegraph = sceneWindow2D.getScenegraph();
AnimationName = "PlayerIdle";
};When adding behaviors to datablocks, all of the default values will be used unless you specify a new value for a particular field. Each value in that list is spaced with a TAB.
That what you're after?
#4
I see, Yes I think we are going in the same direction but I think I might be confused. On the t2dSceneObjectDatablock, here is an example of what I'm working with. Since, the players information is more text and static, and the only two movable items would be a ship and terrian car I've not added the graphics part.
1. Created a Scriptobject(PlayerObjects)
new ScriptObjects(PlayerObjects
{
class="PlayerObjectclasses";
superclass="SuperPlayerObjects";
};
which should allow me to use the PlayerObjects as an interface for other functions...
PlayerObjects::Add(), ::Delete(); forth..
datablock SimDataBlock( PlayersRecords)
{
PlayerName="";
};
Which i believe again.. I would be able to pass the datablock like this
PlayerObject::Add(%PlayerRecords)
{
do things here
};
12/11/2007 (3:30 pm)
Hi, PhillipI see, Yes I think we are going in the same direction but I think I might be confused. On the t2dSceneObjectDatablock, here is an example of what I'm working with. Since, the players information is more text and static, and the only two movable items would be a ship and terrian car I've not added the graphics part.
1. Created a Scriptobject(PlayerObjects)
new ScriptObjects(PlayerObjects
{
class="PlayerObjectclasses";
superclass="SuperPlayerObjects";
};
which should allow me to use the PlayerObjects as an interface for other functions...
PlayerObjects::Add(), ::Delete(); forth..
datablock SimDataBlock( PlayersRecords)
{
PlayerName="";
};
Which i believe again.. I would be able to pass the datablock like this
PlayerObject::Add(%PlayerRecords)
{
do things here
};
Associate Phillip O'Shea
Violent Tulip
If you're talking about things like script etc, then you are able to use XML to import data (there is a resource floating around about it).
In terms of storing that information, I like to use script objects. They are handy, low footprint objects which store dynamic variables nicely.