Game Development Community

Simple Database Support for Torque 3D.

by Anthony Merlo · in Torque 3D Professional · 07/28/2011 (8:55 pm) · 16 replies

I tried doing a search but couldn't find what I was looking for.

Can someone post a link to a resource on integrating simple database support for Torque 3D?

Do databases like SQLite or MySQL need some sort of database server running locally to be able to access the database? And would that server code be integrated into Torque or would I have to distribute or have others playing my game download and install a database server? If so, is there a database I could use that doesn't need a server?

I'm trying to create a small, single player, stand alone RPG and just needed to store some merchant, player inventory info, etc... Maybe even save game info. Right now I'm doing it all in text files and can already see this wont work.

Thanks in advance!

#1
07/28/2011 (9:27 pm)
Try this one.

http://www.garagegames.com/community/resources/view/9656

I'm pretty sure I used this resource in one of the T3D beta's. Although you'll probably have to make a few changes.
#2
07/28/2011 (10:45 pm)
Do the databases in that resource require the installation of a database server?

Do games usually run database server software?

Sorry, kinda new to this.

Thanks!
#3
07/29/2011 (12:53 am)
Anthony, you can use SQLite to store data locally:
http://www.garagegames.com/community/resources/view/10905
#4
07/29/2011 (6:42 am)
If you are making a small RPG, you could also just store your data in XML. I find that easier than maintaining a SQLite database.
#5
07/29/2011 (11:21 pm)
I've rad about people using XML files, From what I've read the problem comes with security. Don't want players cheating and giving themselves tons of money or something.

What ever happened to good old simple MS Access databases?

I was also thinking of using a saved state method for saved games. Where the contents of every container and npc position of the games is saved, like in Fallout 3. I would think the best way to do that would be to use a database.

Problem is, like I said, I don't want to use a database where the player needs to install a database server or drivers to get it to work. And, as far as I know, most databases use a server. Either that or I'm just confused on how SQL databases like MySQL or MS-SQL work.

SQLite says it's serverless and I took a look at the link supplied I'll try it out and see where that gets me.


#6
07/30/2011 (5:50 am)
Sqlite is serverless the integration into torque is relatively painless and theres an example script file for torquescript access to your database(s), you could also consider creating your own data files.

MySQL and MS-SQL are massively scalable databases, capable of things that many games dont need, there are smaller footprint databases that do install a server but that can be integrated into your own games setup, firebird is the most common but there others.

As far as MS Access databases, i used to use these all the time in a commercial venture, but back then you needed to have specific system drivers installed unless an office package that included access was installed, so no different to installing a 3rd party database there. I'm not sure if theres direct coded methods to access MSA databases now, if there is they are probably part of the .net architecture and probably difficult to wrangle into torque, but its probably not impossible. That said, there are GUI frontends to SQLite and firebird that almost rival Accesses usability, you dont have to ship these with your game but they surely are useful during testing and development.
#7
07/30/2011 (7:51 am)
@Anthony - You could easily encrypt the XML files. And also, considering it is a single player game, I wouldn't worry about people cheating all that much, but that is just my opinion.

I just find and SQL database is a lot of overkill for a small single player game as you described.
#8
07/30/2011 (8:33 am)
Going on the fact that I've found myself cheating in games in the past I can just assume people will look for ways to cheat in my games. If they find ways more power to them. Some of the fun can be in finding ways to do it. But I don't want to make it as easy as just editing a file in a text editor.

I haven't gotten the SQLite resource to work yet but I think that would be the best way to go.
#9
07/30/2011 (10:58 am)
LOL - so that makes "figuring out how to cheat" part of the game, too! Which is cool....
#10
07/30/2011 (12:53 pm)
It is. Finding out how to get extra money in Fallout: New Vegas was like finding lost treasure. I think I was way more excited about that then completing the main story line.
#11
07/30/2011 (12:56 pm)
It is. Finding out how to get extra money in Fallout: New Vegas was like finding lost treasure. I think I was way more excited about that then completing the main story line.
#12
08/01/2011 (7:21 pm)
@Anthony

As you said though, Obsidian didn't make it very difficult to cheat in their game. You just typed player.addItem into the console.
#13
08/02/2011 (10:09 am)
I only ever played the Xbox 360 version.

I'm not a big fan of cheat codes but I am a fan of finding glitches or hidden Easter eggs. I didn't find the caps glitch until my 3rd play trough of the game.

I think I told everyone I knew that had the game where the glitch was when I found it. I don't think I ever bothered to tell anyone when I actually finished the game.

I guess I could have looked up the glitch online, but where's the fun in that?
#14
08/02/2011 (10:58 am)
Easter eggs and bugs - usually more fun than actually cheating, I agree.

I make a point of finishing a game as it was made before I turn to cheat codes. Sometimes I'll finish it a few times before looking for cheats.
#15
10/30/2011 (1:28 am)
Cheating adds a certain amount of re-playability to a game.

The best cheat I ever ran into was for KOTOR 2. You can use a glitch in the game to apply level up stats to a player other than who was actually leveling up. It had something to do with who was selected and what datablock was being applied to that character. You could multiclass people to make them extremely powerful. You could also dump higher stats and abilities into each character. The best part was you could do it at level 1! Lots of fun. Made the game far better and helped ease the fact that the plot was not great. The best part was giving droids force points. Not sure it ever worked, but it was cool to know your assassin droid was in tune with the force. :)

Thanks for this post on Sqlite. I wanted to use it with Torque and was not sure it still worked.



#16
10/30/2011 (7:43 am)
Well, Sqlite still works - it's just a matter of finding out if the T3D integration needs tweaking... lol