How would i save the game?
by Toks · in Torque Game Engine · 07/29/2007 (10:55 am) · 6 replies
Hi everyone,
I need to create a way to save the game, and load it again when the player wants. i dont need to save a whole lot, i would want to save the players inventory and some other stats in the player and GameConnection. (from script that is). I tried exporting to a .cs file, and it works. but a .cs file can be edited by the player, and therefore i dont really want to use that.
I want to know, is there a way to save it in a format which is not readable with a normal text editor? or if there is not, would there be a way to save it, still in .cs file, but on a masterserver of some sort?
thanks
I need to create a way to save the game, and load it again when the player wants. i dont need to save a whole lot, i would want to save the players inventory and some other stats in the player and GameConnection. (from script that is). I tried exporting to a .cs file, and it works. but a .cs file can be edited by the player, and therefore i dont really want to use that.
I want to know, is there a way to save it in a format which is not readable with a normal text editor? or if there is not, would there be a way to save it, still in .cs file, but on a masterserver of some sort?
thanks
#2
Depending on whether this is a single or multi-player game, I have different answers. If it's multi-player, then you'll already be saving on the server, not the client, and there's no issue since the .cs files will only appear on your hardware. The client-server design dictates that the client can never be authoritative, so having clients save player stats on the client's PC and sending them to the server would make no sense.
IMO, one of the best ways to handle character saving in an MMO-type game is to just use MySQL. SQL provides an easy way to store your data in one central remote location, and has fairly efficient lookup and storage.
If it's single-player, then you could technically save on a remote server, but this would require players to be online to play a single-player game, which is honestly a bad idea. Anyway, the following points apply only to a single-player game.
I should first mention that you really can't do anything to stop players from editing their save files. No matter how much you try to keep these off limits, a clever user will figure out how to modify them (unless if course you're going to use 128-bit encryption or something crazy, but even then..).
That said, I personally don't think it's a good design decision to encrypt your save files. PC gamers are used to being able to access these sorts of things, and that's often part of the fun of playing a game on the PC vs. a console. While save game editing hardly counts as modding, in many cases this can be a fun way to play with a game you've otherwise finished (for example, "I'll give myself that giant missile launcher from the end boss which you can't otherwise get in the game," or, "I'll set my agility to 5000 and be able to jump over buildings.")
You really shouldn't be concerned about people cheating in a single-player game. As a developer, I understand the desire to have the player see the game as you intended, but we should remember that mission #1 is to give them something that they find fun.
08/19/2007 (1:23 am)
I just want to jump in here, though about 20 days late..Depending on whether this is a single or multi-player game, I have different answers. If it's multi-player, then you'll already be saving on the server, not the client, and there's no issue since the .cs files will only appear on your hardware. The client-server design dictates that the client can never be authoritative, so having clients save player stats on the client's PC and sending them to the server would make no sense.
IMO, one of the best ways to handle character saving in an MMO-type game is to just use MySQL. SQL provides an easy way to store your data in one central remote location, and has fairly efficient lookup and storage.
If it's single-player, then you could technically save on a remote server, but this would require players to be online to play a single-player game, which is honestly a bad idea. Anyway, the following points apply only to a single-player game.
I should first mention that you really can't do anything to stop players from editing their save files. No matter how much you try to keep these off limits, a clever user will figure out how to modify them (unless if course you're going to use 128-bit encryption or something crazy, but even then..).
That said, I personally don't think it's a good design decision to encrypt your save files. PC gamers are used to being able to access these sorts of things, and that's often part of the fun of playing a game on the PC vs. a console. While save game editing hardly counts as modding, in many cases this can be a fun way to play with a game you've otherwise finished (for example, "I'll give myself that giant missile launcher from the end boss which you can't otherwise get in the game," or, "I'll set my agility to 5000 and be able to jump over buildings.")
You really shouldn't be concerned about people cheating in a single-player game. As a developer, I understand the desire to have the player see the game as you intended, but we should remember that mission #1 is to give them something that they find fun.
#3
what do you mean, i cant save on a client? the client saves config files and preferences, so why shouldnt i be able to save a game on it? my problem with saving on the server is, that when you join a different server, you'd have to start over, versus the problem of easily altering .cs files when saving on the client.
and you say you can always edit your save files. well, ofcourse you can no matter how you save them, but theres a big difference between using, for example, a compiled script, something encrypted, or somehow not easily readable and on the other hand a file you can open with wordpad and then it says: $Level = 1; (so to say)
08/21/2007 (7:14 am)
No matter you're 20 days late i still get reminder mails:what do you mean, i cant save on a client? the client saves config files and preferences, so why shouldnt i be able to save a game on it? my problem with saving on the server is, that when you join a different server, you'd have to start over, versus the problem of easily altering .cs files when saving on the client.
and you say you can always edit your save files. well, ofcourse you can no matter how you save them, but theres a big difference between using, for example, a compiled script, something encrypted, or somehow not easily readable and on the other hand a file you can open with wordpad and then it says: $Level = 1; (so to say)
#4
For single-player it's fine to save on the client but for multi-player you don't want to do that because people can, and will, cheat.
08/21/2007 (8:44 am)
Quote:what do you mean, i cant save on a client?
For single-player it's fine to save on the client but for multi-player you don't want to do that because people can, and will, cheat.
#5
08/21/2007 (10:22 am)
You could have the multiplayer version create different profiles for each server perhaps. So aplayer would press save, and that server should remember it. and when youlog back in on that server it would return thecharacter its has save. But yah for multiplayer your prettymuch goingto have it on server side. So essential you would have a load screen with each character, that when selected automatically chooses what server you are loading on to.
#6
I assure you your game servers will all be filled with level 300 uber-cheaters if you have player characters saved on clients. I think what you're looking for is a master data server, like MMOs use. It's not as hard to deal with as it sounds; many web hosts provide MySQL databases, and you can easily run a database server yourself. This way, all player data will be saved to one remote location of your choice, regardless of where the server is being run from, meaning that characters will be persistent from one game server to another.
08/22/2007 (7:42 pm)
Quote:
No matter you're 20 days late i still get reminder mails:
what do you mean, i cant save on a client? the client saves config files and preferences, so why shouldnt i be able to save a game on it? my problem with saving on the server is, that when you join a different server, you'd have to start over, versus the problem of easily altering .cs files when saving on the client.
and you say you can always edit your save files. well, ofcourse you can no matter how you save them, but theres a big difference between using, for example, a compiled script, something encrypted, or somehow not easily readable and on the other hand a file you can open with wordpad and then it says: $Level = 1; (so to say)
I assure you your game servers will all be filled with level 300 uber-cheaters if you have player characters saved on clients. I think what you're looking for is a master data server, like MMOs use. It's not as hard to deal with as it sounds; many web hosts provide MySQL databases, and you can easily run a database server yourself. This way, all player data will be saved to one remote location of your choice, regardless of where the server is being run from, meaning that characters will be persistent from one game server to another.
Torque Owner Andrea Fraboni
C4DGames
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=11557
www.garagegames.com/mg/forums/result.thread.php?qt=25817
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4213
Start by them and develop your method !
;-)