TNT Basic Forums > Feedback
Data storage and management
< Last Thread     Next Thread >
Thread        Post A Reply

07-14-2003 11:50

Posted by:

Click Here to Email jodal   Find more posts by jodal

I'm a veteran C++, PHP (and Basic) programmer, but a TNT Basic beginner. I have so far only used it to prototype a CRPG. I'm pretty impressed so far. Since my game is an old school RPG, it seems like it could almost be produced, and not just prototyped, in TNT Basic.

It might be that I'm a TNT beginner, but I miss a slightly more powerful data storage and management structure. RPGs require massive amounts of data.

It would make my day to have multidimensional arrays (although the same thing can be accomplished with a single dimensional array and some extra code).

It would also make my day to have some form of data collections, like the structs in C++. It makes data management a lot more structured!

Declaration for an array of 3 data collections could maybe look something like this

data collection myCharacters[3]
int health
string name
int armourclass
end collection

Accessing the content of the name field of the second collection array item could maybe look something like this

myCharacters[1].name = "Merlin"

Another suggestion is to have a command to load and save such a collection as a resource.

Load Collection "Characters", myCharacters
Save Collection "Characters", myCharacters

I'm currently writing (sort of) a library doing all of this since I desperately need to manage my data in a more structured way.

Feel free to tell me if it is just me being a newbie TNT Basic coder or if I have a point.

07-14-2003 16:15

Posted by:


Click Here to Email eekaydee   Find more posts by eekaydee

Well you'll be happy to know that your day has already been made! You can make multidimensional arrays.

int array[10,10,10]

As for the structures, I don't think TNT has anything like structures or classes. You might have to settle with arrays of each variable you wanted in the structure. As for data storage, you can write to a file and read from it. You can use the "data", "restore", and "read" commands to store and retrieve numbers, but I don't think this works with strings, which might be nice.

I've been working on an RPG in TNT for about 9 months...actually I'm still working on the engine and I haven't come up with any story yet. :) The game development should probably have started with the story, but oh well. Anyway, I'm interested in your "library". Would you mind explaining it?

07-14-2003 17:33

Posted by:

Click Here to Email Boo   Find more posts by Boo

I second your thoughts. Building a CRPG in TNT Basic is an interesting idea, because it has several features that lend itself to such an endeavor out of the gate, what with maps and graphic management and such. It's when you start getting into detail work and enhancements to the engine that make TNT Basic feel a little cramped.

I agree that the compartmentalization of data like you describe sure would be nice. For now, you just have to do something like:


...instad of...


Which, I guess, isn't too bad, really. It's just hard to work with when you've enjoyed an object-oriented programming language.

07-16-2003 20:34

Posted by:

Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

Despite TNT doesn't support object-oriented programming, you can use it almost as if it was, because of procedures. In fact, in OO programming, I start by setting a double-buffering class, a keyboard/mouse input class, a sprite class, a sound class, an image class, but then, in TNT, they are already made !!! Of course, if you do a RPG, you cannot "create" enemies, like " Monster troll=new Troll(power,speed,level) ", but you can fake it with arrays.

07-17-2003 02:57

Posted by:


Click Here to Email eekaydee   Find more posts by eekaydee

Or hard code all of it like me, and create disturbing code! :)

I decided not to bother with the whole do it like you're supposed to thing. For example, instead of creating a scripting language to use items and enemies etc, I just hard coded all of it.

07-17-2003 03:12

Posted by:

Earth>USA>New Jersey>Clifton>My Chair

Click Here to Email DanLurie   Find more posts by DanLurie

OOP is great, but in the meantime something like structs would be a big help in TNT.

07-21-2003 22:59

Posted by:
Mark Tully

TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

We really want oop as well, it will appear in the future but for now, you have to use arrays.

As eekaydee pointed out, you do have multidimensional arrays. You can also use the 'read', 'data' and 'restore' commands to read data into variables. You can do this for ints, floats and strings. You can't currently restore to a label that isn't a constant, so you can't restore to a label like:

restore "label"+"1"


Which can be a bit limiting.

As Boo pointed out, you have to use a collection of arrays, which is annoying, but hopefully we'll get away from it in the future.


int kNumSprites=50
int xLocations[kNumSprites]
int yLocations[kNumSprites]
float health[kNumSprites]


Hope this helps,


All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.