Downloading from database
by Daniel Brown · in General Discussion · 06/28/2004 (7:28 am) · 32 replies
Hey all,
Well I will need to, in my game, download from my database new object, enemies and other things with their stats and that, but i am asking how would be the best way to store this info when its downloaded, what way can i store it so its in a database like format so i can easily access it? and most importantly how can i stop the user from editing with ease?
i know there will be some who might spend weeks trying their best to crack it but hopefully if they do change it, the game will realise and download the correct data again.
Thanks for any help!
Well I will need to, in my game, download from my database new object, enemies and other things with their stats and that, but i am asking how would be the best way to store this info when its downloaded, what way can i store it so its in a database like format so i can easily access it? and most importantly how can i stop the user from editing with ease?
i know there will be some who might spend weeks trying their best to crack it but hopefully if they do change it, the game will realise and download the correct data again.
Thanks for any help!
About the author
#22
first of all, the post (under adam's name was make by me, i was using his computer that day)
secondly, adam has his a license(believe it or not). anyway he is doing avartar modeling(nothing to do with torque)
lastly, and most importantly, i am here to look for help and not debating about whether adam has a license or not. so stop ask about it. i really need help in link torque to my database.
chunwei
08/16/2005 (6:58 pm)
To Stefan, Rod and Chirs.first of all, the post (under adam's name was make by me, i was using his computer that day)
secondly, adam has his a license(believe it or not). anyway he is doing avartar modeling(nothing to do with torque)
lastly, and most importantly, i am here to look for help and not debating about whether adam has a license or not. so stop ask about it. i really need help in link torque to my database.
chunwei
#23
Daniel
08/17/2005 (5:02 am)
Have you added ODBC32.lib and ODBCCP32.lib to the project settings, under the linker section in additional Dependencies? You shouldn't have to add ODBC32.lib and ODBCCP32.lib to any .cc files, as far as i rememberDaniel
#24
DatabaseConnection::Execute - SQLExec direct failed
starter.fps/server/scripts/dbTest.cs (0): Unable to find object: '0' attempting to call function 'nextRow'
starter.fps/server/scripts/dbTest.cs (0): Unable to find object: '0' attempting to call function 'commit'
do u know what happen?
and for the two line below
$error = $db.connect("SQL Server", "SERVER=servername; UID=username;PWD=password;");
$results = $db.execute("SELECT * FROM Test");
i have a few question:
(1)username is the database-username or the server-username?
(2)password is the password-username or the password-username?
(3)"Test" is the name of the database?
thk ur all ur help!
chunwei(tp student)
08/18/2005 (11:13 pm)
Daniel, i got the compiling done. but when i run the game the following error appear.DatabaseConnection::Execute - SQLExec direct failed
starter.fps/server/scripts/dbTest.cs (0): Unable to find object: '0' attempting to call function 'nextRow'
starter.fps/server/scripts/dbTest.cs (0): Unable to find object: '0' attempting to call function 'commit'
do u know what happen?
and for the two line below
$error = $db.connect("SQL Server", "SERVER=servername; UID=username;PWD=password;");
$results = $db.execute("SELECT * FROM Test");
i have a few question:
(1)username is the database-username or the server-username?
(2)password is the password-username or the password-username?
(3)"Test" is the name of the database?
thk ur all ur help!
chunwei(tp student)
#25
$error = $db.connect("SQL Server", "SERVER=danielsSQLServer; UID=daniel;PWD=APassword;");
SERVER is the network name of the computer, on which MsSql is installed.
3) Not to be rude but it seems you don't know much SQL, the best thing to do is search the net and get a begginners book on SQL, as its too vast of a subject to cover here!! But the 2 commands you need to execute when starting is:
$results = $db.execute("USE torque");
Torque being the name of the database your using, the use command tells the server which database you are looking in, as you can have multiple databases at one time.
$results = $db.execute("SELECT * FROM userInfo");
userinfo is the name of the table in the database called torque. The * means you want to get all the columns in that table for every row. If you just wanted to select the strength for the player named cuddlyBunny, you would use the command.
$results = $db.execute("SELECT strength FROM userInfo WHERE username = 'cuddlyBunny'");
Hope that makes some sense, like I said its best if you get a book on it.
Daniel
08/19/2005 (3:22 am)
1 and 2) The login information is the username and password you setup when you installed MsSql, for example:$error = $db.connect("SQL Server", "SERVER=danielsSQLServer; UID=daniel;PWD=APassword;");
SERVER is the network name of the computer, on which MsSql is installed.
3) Not to be rude but it seems you don't know much SQL, the best thing to do is search the net and get a begginners book on SQL, as its too vast of a subject to cover here!! But the 2 commands you need to execute when starting is:
$results = $db.execute("USE torque");
Torque being the name of the database your using, the use command tells the server which database you are looking in, as you can have multiple databases at one time.
$results = $db.execute("SELECT * FROM userInfo");
userinfo is the name of the table in the database called torque. The * means you want to get all the columns in that table for every row. If you just wanted to select the strength for the player named cuddlyBunny, you would use the command.
$results = $db.execute("SELECT strength FROM userInfo WHERE username = 'cuddlyBunny'");
Hope that makes some sense, like I said its best if you get a book on it.
Daniel
#26
$error = $db.connect("SQL Server", "SERVER=danielsSQLServer; UID=daniel;PWD=APassword;");
all the information i should enter is for the server and not the database?
chunwei
08/19/2005 (9:08 pm)
Thanks daniel, but i am still not very sure. do you mean that for line:$error = $db.connect("SQL Server", "SERVER=danielsSQLServer; UID=daniel;PWD=APassword;");
all the information i should enter is for the server and not the database?
chunwei
#27
i used the correct ones this time and got the following error:
DatabaseConnection::Connect - SQLDriverConnect failed
Got error 0 trying to connect to database
do u know what wrong?
btw, i dun really know anything about sql. trying to learn as i do.
could u recommend any book?
chunwei
08/21/2005 (8:52 pm)
Daniel sorry, i got the wrong .cc and .h fileslast time.i used the correct ones this time and got the following error:
DatabaseConnection::Connect - SQLDriverConnect failed
Got error 0 trying to connect to database
do u know what wrong?
btw, i dun really know anything about sql. trying to learn as i do.
could u recommend any book?
chunwei
#28
and got the following error:
Loading compiled script starter.fps/server/scripts/dbTest.cs.
start execute
done first execute
DatabaseConnection::Execute - SQLExec direct failed
done second execute
starter.fps/server/scripts/dbTest.cs (0): Unable to find object: '0' attempting to call function 'nextRow'
starter.fps/server/scripts/dbTest.cs (0): Unable to find object: '0' attempting to call function 'commit'
i know that it cannot connect to my table name "user". anyone has any idea wat i can do?
chunwei
09/15/2005 (1:18 am)
Hello. anyone still there?i run the dbtest.cs as follow:{
$db = new DatabaseConnection();
$error = $db.connect("SQL Server", "SERVER=SVR1;UID=torque;PWD=torque;");
if ($error != 1)
{
echo("got error");
echo("Got error " @ $error @ " trying to connect to database");
}
else
{
echo("start execute");
$results = $db.execute("USE torque");
echo("done first execute");
$results = $db.execute("SELECT * FROM User");
echo("done second execute");
echo($results.testCol1);
echo($results.testCol2);
echo($results.testCol3);
echo($results.testCol4);
$results.nextRow();
echo($results.testCol1);
echo($results.testCol2);
echo($results.testCol3);
echo($results.testCol4);
$results.testCol1 = "it works";
$results.commit();
}and got the following error:
Loading compiled script starter.fps/server/scripts/dbTest.cs.
start execute
done first execute
DatabaseConnection::Execute - SQLExec direct failed
done second execute
starter.fps/server/scripts/dbTest.cs (0): Unable to find object: '0' attempting to call function 'nextRow'
starter.fps/server/scripts/dbTest.cs (0): Unable to find object: '0' attempting to call function 'commit'
i know that it cannot connect to my table name "user". anyone has any idea wat i can do?
chunwei
#29
09/15/2005 (3:59 am)
Use code brackets, makes your post alot easier to read.
#30
09/16/2005 (11:19 am)
Um, the eula for torque specifically states that code like this cannot be posted in this forum... it must be in the private SDK Forum...
#31
09/16/2005 (9:56 pm)
Isn't that just for source? I thought script was ok?
#32
Edit: It is however recommended and preferred that anything that has to do with Torque is posted in the Torque section.
09/17/2005 (10:11 am)
Read the EULA again Vince, you're not correct.Edit: It is however recommended and preferred that anything that has to do with Torque is posted in the Torque section.
Torque 3D Owner Chris "DiGi" Timberlake