Game Development Community

creating J-RPG database in torque2d

by luke galutia · in Torque 2D Beginner · 09/27/2013 (5:48 am) · 8 replies

hi all, i am new to this forum and also to torque2d.
i am wanting to create a J-RPG in the fashion of final fantasy, and was wanting to know if there is functions in the torque package which will let you set up a character database for recording stats and creating game saves?

i am also new to programing so any direction will help.

About the author

background in blender and 3d animation. OS: ubuntu 12.04


#1
09/27/2013 (6:10 am)
It's as easy as taml-reading/writing a simset.
#2
09/27/2013 (6:40 am)
I usually use script objects for carrying large wads of data, then make simsets of those for collections of sets. But it's all about preferences.
#3
09/27/2013 (9:11 am)
As practicing mentioned, out of the box I would just use TAML for persistence. You can choose to use XML, JSON, or binary.

github.com/GarageGames/Torque2D/wiki/Taml-Guide

There was someone working on integrating SQLite into T2D for a proper database, but I am not sure how far along that work got.
#4
10/01/2013 (5:27 am)
ok, thanks :-) what exactly is a simset? i am kind of new game developing?
for sqlite, would a console say like steam / ps3 /ps4 be able to handle that?
#5
10/01/2013 (6:36 am)
Ok, you're going to want to read that wiki, and the Torque 3D documentation section on Scripting is pretty relevant, too - especially the first section....
#6
10/05/2013 (10:18 pm)
I was doing a similar thing recently. Here is an example of my code for saving a database of characters:

I would load my saved file like this:
$crew_owned = TamlRead("blablabla\crew_owned.taml");

or to originally create it, like this:
$crew_owned = new Simset();
      %crew_owned1 = new ScriptObject();
      %crew_owned2 = new ScriptObject();
      %crew_owned3 = new ScriptObject();
      
      %crew_owned1.nam = $crew_database[0].nam;
      %crew_owned1.num = 1;
      %crew_owned1.hit = 100;
      %crew_owned1.critical = 1;
      %crew_owned1.recovery = 10;
      %crew_owned1.level = 1;
      %crew_owned1.defense = 1;
      %crew_owned1.im = $crew_database[0].im;
      %crew_owned1.profession = $crew_database[0].profession;
      %crew_owned1.item_1 = $crew_database[0].item_1;
      %crew_owned1.item_2 = $crew_database[0].item_2;
      %crew_owned1.item_3 = $crew_database[0].item_3;
      %crew_owned1.item_4 = $crew_database[0].item_4;
      %crew_owned1.item_5 = $crew_database[0].item_5;
      %crew_owned1.item_6 = $crew_database[0].item_6;
      %crew_owned1.item_7 = $crew_database[0].item_7;
      %crew_owned1.item_8 = $crew_database[0].item_8;
      %crew_owned1.item_9 = $crew_database[0].item_9;
      %crew_owned1.sword_1 = $crew_database[0].sword_1;
      %crew_owned1.sword_2 = $crew_database[0].sword_2;
      %crew_owned1.sword_3 = $crew_database[0].sword_3;
      %crew_owned1.sword_4 = $crew_database[0].sword_4;
      %crew_owned1.sword_5 = $crew_database[0].sword_5;
      %crew_owned1.sword_6 = $crew_database[0].sword_6;
      %crew_owned1.sword_7 = $crew_database[0].sword_7;
      %crew_owned1.sword_8 = $crew_database[0].sword_8;
      %crew_owned1.sword_9 = $crew_database[0].sword_9;
	  %crew_owned1.Ability[1] = $crew_database[0].ability[1];
      %crew_owned1.Ability[2] = $crew_database[0].ability[2];
      %crew_owned1.Ability[3] = $crew_database[0].ability[3];
      %crew_owned1.Ability[4] = $crew_database[0].ability[4];
      %crew_owned1.Ability[5] = $crew_database[0].ability[5];
      %crew_owned1.Ability[6] = $crew_database[0].ability[6];
      %crew_owned1.Ability[7] = $crew_database[0].ability[7];
      %crew_owned1.Ability[8] = $crew_database[0].ability[8];
      %crew_owned1.Ability[9] = $crew_database[0].ability[9];
      %crew_owned1.Ability[10] = $crew_database[0].ability[10];
      %crew_owned1.Ability[11] = $crew_database[0].ability[11];
      %crew_owned1.Ability[12] = $crew_database[0].ability[12];
      %crew_owned1.Ability[13] = $crew_database[0].ability[13];
      %crew_owned1.Ability[14] = $crew_database[0].ability[14];
      %crew_owned1.Ability[15] = $crew_database[0].ability[15];
      %crew_owned1.Ability[16] = $crew_database[0].ability[16];

      $crew_owned.add(%crew_owned1);
      $crew_owned.add(%crew_owned2);
      $crew_owned.add(%crew_owned3);
      TamlWrite($crew_owned, "blablabla\crew_owned.taml");
#7
10/05/2013 (10:22 pm)
and whenever I made a change to the game (win/loss/new character/etc)

I would modify either the 'human_player' or the '$crew_owned', depending which way you create your data and then just TamlWrite it again.

TamlWrite(human_player, "C:\\blablabla\\Stats.taml");
TamlWrite($crew_owned, "C:\\blablabla\\Stats\\crew_owned.taml");
#8
10/07/2013 (5:22 am)
ok cool thanks :-)