Jump to content
  • Advertisement
Game HD

Java Saving data from multiplayer game

Recommended Posts

Hi,

 

I'm currently working on a 3D game multiplayer. I really need to save the data some where save so players can not edit it from there own computer.

Is there any way how i can make that it is saved like in a database or something also they need have accounts then so they save data for an account.

So when the game first starts up they first need to sign in or create a new account. Is there anyway i can do this on youtube there are only videos that explain how to save data for singelplayer games, i use LWJGL for all my code so i hope its possible. (I'm a bit new to LWJGL i coded before but never in this big off sorts so please do not be to hard on me :D)

Edited by Game HD

Share this post


Link to post
Share on other sites
Advertisement

The only form of relatively safe is keeping it all at your own server. Let users participate in a game at your server (eg by logging in and getting a copy of the game data), load/save the game data from the program at the server to whatever storage you like (data base or file, or something else, depending on what you need to do with saved games).

In particular, any data you get from a user cannot be trusted at all.

Share this post


Link to post
Share on other sites

@Alberththats indeed true but then i should make that on my server are them data stored but i can't find any good wiki page or tutorial to save data to database and retreiving that data.

Share this post


Link to post
Share on other sites

Standard data base access is SQL. Find a database library for your language, and do its tutorial. Common pattern is that you execute an SQL statement and then have a loop in your programming language where to write or read records.

Share this post


Link to post
Share on other sites

It's not quite true that data on the users computer can't be trusted. You can trust data that has been digitally signed by the server.

For example, you could send a file to the server, have it verify it, and return a signature. When loading the game this signature can be verified. Verifying the signature can be done with a public key, and does necessarily not require communication with the server. 

Or, if the data you wish to save is duplicated between the client and server, you can simply have the server send the digital signature to be saved. When the client attempts to save, it will verify that the data it generates matches the signature and save both. It is important that both the client and server compute all save data in a deterministically identical way in this case.

Share this post


Link to post
Share on other sites

Being able to generate a digital signature may prove he has the data, but it does not mean he is actually using that data, or that he is using your program, for that matter.

Share this post


Link to post
Share on other sites
9 hours ago, Alberth said:

Being able to generate a digital signature may prove he has the data, but it does not mean he is actually using that data, or that he is using your program, for that matter.

That's true, but that is a different question: when to do a calculation client side or server side. And it's orthogonal. You can store the data on each user's machine, then send it to the server when a user connects. Or you can use other means to attempt to ensure the authenticity of the client application.

In a 3d multi-player game it may be prohibitively slow or server intensive to make all calculations server side, so relying on client authenticity may be necessary, at least some of the time. For example, for things like obscured objects, generally you would want to rely on a graphics card to hide things outside the player view, instead of computing server side what the user can see, even though a hacked client could be made to see through walls (unless countermeasures are taken).

 

That being said, using a database with the server has another advantage: it allows you to have multiple servers that talk to the same database, allowing more horizontal scaling. So even if some data is stored on the client, it probably still makes sense for the server to have a data store anyway.

 

Share this post


Link to post
Share on other sites
On 1/21/2018 at 8:30 PM, King Mir said:

That's true, but that is a different question: when to do a calculation client side or server side. And it's orthogonal. You can store the data on each user's machine, then send it to the server when a user connects. Or you can use other means to attempt to ensure the authenticity of the client application.

In a 3d multi-player game it may be prohibitively slow or server intensive to make all calculations server side, so relying on client authenticity may be necessary, at least some of the time. For example, for things like obscured objects, generally you would want to rely on a graphics card to hide things outside the player view, instead of computing server side what the user can see, even though a hacked client could be made to see through walls (unless countermeasures are taken).

 

That being said, using a database with the server has another advantage: it allows you to have multiple servers that talk to the same database, allowing more horizontal scaling. So even if some data is stored on the client, it probably still makes sense for the server to have a data store anyway.

 

Verifying client authenticity is generally slow or easy to mess up, it's certainly not very dependable.

Of course the problem is a complicated one, we see a lot of different games these days handle potential cheating differently. A fast paced multiplayer FPS or action MMORPG or similar thing, obviously can't calculate everything server side or it would become a horrible bottleneck, so in reality they are often forced to at least accept some information from the client, and verify it with sanity checks. We also see that commonly paired with software like VAC or punkbuster, in a further attempt to just fish for players with obvious cheats. Of course the flaw with that is they often basically work like antiviruses, just searching for largely distributed cheats, and people that find bugs and workaround for themselves are almost never caught.

The answer of what is right to use depends too much on your game to give a general strategy. If you can afford to calculate everything important server side and just throw it at the client then I certainly would. If you can't then you have to start deciding what is important.

Share this post


Link to post
Share on other sites

From reading alle these anwsers i think om defently going to do database as IT seems to be the best option. Also i die SQL for aan website so i think i van handle thanks for alle Them replys 

Share this post


Link to post
Share on other sites

Just be sure to have a server handling client <=> database communication, that checks user accounts. You don't want to be shipping your database credentials in every game package ...

Beyond that from your clients it'll be typical GET / POST requests or however you want to structure that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!