Game Development Community

Question about how T3D Pro enhancements like sqlite3 and libcurl support work with networking and web plugins

by Marc B · in Torque 3D Professional · 03/17/2010 (9:18 pm) · 2 replies

Hello,

I couldn't come up with a better subject, but with the current T3D Pro discount I am considering upgrading...
I'm just playing around a bit with T3D basic hobby wise, but extending T3D with sqlite3, libcurl and rule based terrain painting (http://www.torquepowered.com/community/resource/view/17145) is intriguing.
(And without the discount it would have been a distant intrigue... but let me get to my questions.)

I saw some posts about extending T3D with sqlite3 for some rpg style attribute tracking, etc. (Ex: http://www.torquepowered.com/community/resources/view/18425)
In a networked game, would the server track everything in its sqlite3 database or do all the clients keep their own sqlite3 database as well?
I realize it depends on the implementation, but I'm wondering in general how the engine extension like that are likely to work out to keep things synchronized/secure?

I'm also wondering if there are any restrictions to extending T3D Pro when publishing a game as a web plugin.
If I extend T3D with libcurl for example, can the game client request any url or only from the domain of the web page that the game is hosted on?

Thanks,

-Marc

About the author

Recent Threads


#1
03/18/2010 (12:07 pm)
As far as databases go, the general rule is that you want the server to store all game-critical data in a multiplayer game. If you allow clients to save their data locally and then upload this info to the server, you're basically inviting cheats/hacks, as people will edit their stored data offline.

You're probably more likely asking about how the data gets stored on the client once it's downloaded... in my experience, you don't want to actually read from the database everytime you bring up the inventory or look at your stats, as that would simply bog down the disk and DB. Generally you'll want to load this data on the server when a player logs into their character and store it in their Player Object for the duration of their play session, from which you can easily do network sync with the class's existing pack/unpack functions. You won't need the database code on the client, as your Torque Player object is holding all the client-side data itself. In most cases this is going to be a much better solution than actual making a copy of the DB on the client when you connect (seems like overkill for most applications).

The exception would be extremely massive datasets, an example of which would be the "bank" systems in many MMOs which can hold 100s of items. Preloading this info into the Player class would be a waste of memory, and this kind of data is best loaded as-needed. I'd still say you're goign to load it on the server into the Player and then stream it to the clients via Torque's netoworking, it's just the kind of data you only bother loading/sending when the player actually accesses this part of the game. If this dataset is truly massive, it might actually be worthwhile to temporarily save it in a local database simply so you don't have to redownload it or keep it in active memory. There's no cheating concern here, because your game logic should prevent players from using (for example) an item their client claims to have that they don't actually have on the server.

Whenever it's appropriate, the server can write data back to the database for long-term storage. When this happens is kind of a question of game design; you could write every change to inventory or stats, creating lots of mini-writes to the DB, or you could save the entire character state at intervals, or whenever the player D/C's or loses connection, creating a smaller number of larger write events.

The short version: Access your databases through the server, that way the players can't change anything in their stored data without it going through server-side game logic. Don't let clients connect directly to the server DB, have the Torque server handle getting this data to the clients through the existing networking code.
#2
03/18/2010 (9:31 pm)
Henry,

Thanks for the detailed reply. This gives me a good overview of how this could work in Torque 3d.

-Marc